Upgrading Ubuntu Host for Unifi Controller

My unifi controller was installed on an Ubuntu server back on 16.04 LTS. This server finally reached end of life and I needed to run an upgrade to Ubuntu 20.04 LTS. I decided to first try to just release upgrade it two steps. I’d tried this in the past and failed which is why it stayed out of date for so long, but maybe the upgrade process was fixed for things to work automagically. I was a bit wrong on that, however I also found out that rebuilding from scratch is pretty easy.

So I downloaded a backup from the working system before doing anything to it, and I also took a snapshot of the VM from Proxmox so I could rollback if needed (I also have monthly full backups of all my VMs, one can never be too careful). One does not simply upgrade OS versions and not have a back-out plan. I then did what I have done a few times, ran a do-release-upgrade from 16.04 to 18.04 and got the following

18.04 LTS Upgrade “Success”

The upgrade worked perfectly for the base OS, but not so well for the unifi controller. I wasn’t able to get to the controller webui, I just got a 404 page. Looking into the logs, it looked like the controller was working though.

I tried to follow some posts on the forums like this one to no success. So since all of that failed, I shutdown the VM, and created a new one. Time to try installing it from scratch to see if I can get it working that way. I had downloaded a backup from the system before I tried upgrading it. It’ll be a good thing to do anyway, keep it a bit more cattle-like.

I ended up using the unifi controller install process from this gist on github.

# Install Ubiquiti Unifi Controller on Ubuntu 20.04.
# As tested on a fresh install of ubuntu-20.04.1-live-server, August 22nd 2020.
# Thanks to https://gist.github.com/tmuncks for posting the updated install steps.

sudo apt update
sudo apt install --yes apt-transport-https

echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list
sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg

sudo apt update
sudo apt install --yes openjdk-8-jre-headless unifi
sudo apt clean

sudo systemctl status --no-pager --full mongodb.service unifi.service

With all that done, I navigated to the unifi webui and got the first install page from the unifi controller, success. I used the options to restore from backup, and navigated to the backup I downloaded at the start.

Restore from the Backup

I was a bit nervous as the backup was being restored, but I knew I could always restore my old controller from a previous backup.

Restoration in Process

Once it was done, everything was fully functional as before, all my devices were found, all settings picked up, and my network was fully operational with the controller running on Ubuntu 20.04 LTS.

Resources:

Leave a Reply