Delay starting Unifi Video (NVR) until it’s recording partition has been mounted.


Unifi Video installed on Debian is setup to record to a remote filesystem.


The unifi-video service is started before the remote filesystem is mounted. unifi-video fails silently after the remote filesystem has mounted in that it neither keep recordings nor does it notify the user that it is failing to persist recordings.


Delay the start of the unifi-video service until after the remote filesystem has been mounted.

To do so, make note of the remote filesystem to which you wish to save recordings, then modify unifi-video’s init script and make it wait until that filesystem has been mounted.


By /etc/fstab, I’m mounting /video by NFS. /video nfs rw,async,hard,intr,noexec,_netdev 0 0

The following command returns 0 if the above has been mounted; 1 otherwise.

grep " /video nfs4" /proc/mounts

As such, unifi-video’s init script can be modified to start only if the aforementioned test passes.

The script is at /etc/init.d/unifi-video

Add the following after start) while keeping the same indention level as the following code (in that file).

while ! grep " /video nfs4" /proc/mounts
    sleep 1
    count=`expr $count + 1`
    if test $count -eq 30
        log_failure_msg "(the remote datastore is not mounted)"
        exit 1

Then execute the following to reload the init script.

systemctl daemon-reload

At this point it is a good idea to reboot the server, then execute the following to ensure unifi-video is able to start.

service status unifi-video

JetPack reports error 500 when activated on FreeBSD 11

If JetPack reports error 500 when activated and seams to work (reports XML-RPC server accepts POST requests only.) then try installing security/php72-filter and textproc/php72-ctype (replacing 72 with the version you are using).

Configuring a Debian 9 v.m. to perform unattended upgrades.

Debian’s wiki contains an general guide for unattended upgrades.
(PDF Archive: UnattendedUpgrades – Debian Wiki)

Uncomment the following lines in /etc/apt/apt.conf.d/50unattended-upgrades

Unattended-Upgrade::Mail "root";
Unattended-Upgrade::MailOnlyOnErrors "true";
Unattended-Upgrade::Remove-Unused-Dependencies "true";
Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-WithUsers "false";

FreeBSD: Setting a user’s locale and charset via a login class.

One way to set a user’s locale and charset is to:

  1. create a new login class,
  2. set the login class’s locale and
  3. set the user’s login class as the newly created class.

Example: Setting petur‘s locale and charset to en_GB.UTF-8 and UTF-8, respectivly.

Append the following to /etc/login.conf

danishKeyboard|Users with a Danish Keyboard:\

Update the capability database by executing cap_mkdb /etc/login.conf.

Set danishKeyboard as petur‘s login class by executing pw user mod petur -L danishKeyboard.

Finally, log in as petur and confirm that the locale has been correctly set as well as that the console correctly displays UTF8 characters.

VMWare Fusion – Unable to create the installation medium.

When installing High Sierra on VMWare Fusion, I had to provide the installation files. This is done by finding High Sierra in the App Store, then clicking on “Download”. Once downloaded, the “Install macOS High” is to be dragged from /Applications and into VMWare, as shown here:

Unfortunately, doing so results in the error “Unable to create the installation medium.”, as shown here:

The solution is to drag “Install macOS High” (hold down the left options key before and while you release the app) to a directory owned by your user, such as ~/Downloads, then drag it from there to the “Select the Installation Method” window.

Mapping Caps Lock to ESC in XFCE

I prefer the Caps Lock key over ESC because the travel to that key is shorter.

To map Caps Lock to ESC add the following to a script and ensure it executes shortly after logging into X.

/usr/local/bin/xmodmap -e "clear Lock"
/usr/local/bin/xmodmap -e "keysym Caps_Lock = Escape"

In my case, I use XFCE so I auto start it by adding /home/<user>/bin/ under Settings -> Session and Startup -> Application Autostart -> Add -> Command.

Installing BitBucket on FreeBSD 11.1

Step by step instructions on installing BitBucket on FreeBSD 11.1.

Install OpenJDK

pkg install openjdk8

Mount filesystems on boot

Add the two following lines to /etc/fstab:

fdesc   /dev/fd         fdescfs         rw      0       0
proc    /proc           procfs          rw      0       0
Mount the two filesystems so you don’t have to reboot.
mount -t fdescfs fdesc /dev/fd
mount -t procfs proc /proc

Install Perl

pkg install perl5

Install Git

pkg install git

Install bash

pkg install bash
cd /bin
ln -s /usr/local/bin/bash

Install PostgreSQL

pkg install postgresql96-server
echo 'postgresql_enable="YES"' >> /etc/rc.conf
/usr/local/etc/rc.d/postgresql initdb
/usr/local/etc/rc.d/postgresql start

Configure PostgreSQL

su - postgres
createuser -sdrP dba
CREATEROLE bitbucketuser WITHLOGIN PASSWORD'foobar'VALID UNTIL 'infinity';

Create a user for BitBucket

adduser #default values for all but Shell; set bash as the shell.

Install BitBucket

Download bitbucket from Atlassian’s website. Thoose the “TAR.GZ Archive” version.
tar xzf atlassian-bitbucket-5.8.1.tar.gz -C /usr/local
cd /usr/local
mv atlassian-bitbucket-5.8.1/ bitbucket
chown -R bitbucket:bitbucket bitbucket
cd /usr/local/etc
mkdir bitbucket
chown -R bitbucket:bitbucket bitbucket
su - bitbucket
Edit bitbucket’s .profile file:
  • Add and export JAVA_HOME.
  • Append JAVA_HOME/bin to PATH (uncomment PATH if commented out)
  • Add BITBUCKET_HOME=/usr/local/etc/bitbucket; export BITBUCKET_HOME 

Start BitBucket

cd /usr/local/bitbucket/bin