Personal and Small Business Technology

Problems Restoring UniFi Controller

I recently had to rebuild the Raspberry Pi that runs my UniFi controller, and had a much more difficult time than I expected. I would love to say that this is a complete log of the steps that I took, but alas, it probably is not. In any case, the problem appears to be that the default “new” user interface will not restore a backup, so all of the steps that I took prior to figuring that out probably were not necessary.

Once I changed to the “classic” user interface, my backups restored without incident.

Java 8, Not Java 9

The default Java installation on Raspian was Java 9, with a $JAVA_HOME of /usr/lib/jvm/java-9-openjdk-armhf. UniFi doesn't work on Java 9. Make sure to install and Java 8 and set $JAVA_HOME to /usr/lib/jvm/java-8-openjdk-armhf. Since this is the only thing that uses Java on this machine, I just created a file java_home.sh in /etc/profile.d:

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-armhf export PATH=$JAVA_HOME/bin:$PATH

UniFi 6.4.54 Would Not Restore Backup During Install

I placed the old backups in both /usr/lib/unifi/data/backup/autobackup where all of the documentation said that they should go, and in /var/lib/unifi/backup/autobackup where I actually found them on the old server. The newly-installed UniFi controller would not find them during initial login. It would not do anything when I tried the upload option.

Next, I tried created a new controller login and then tried to restore from a backup, but it still would not find them. Only when I changed permissions to 644 would it find the old backups, which is a big security problem. It would churn on a backup for a while, but would not restore it.

I then reverted to the old user interface in hopes of getting more diagnostic info, and my backup then restored on the first try. I won't be trying the new interface for a while.