Updating Unifi Controller on Raspberry Pi

It’s important to keep your network product up-to-date. Most new firmware releases contain bug fixes, performance improvements and may contain support new technology/protocols. The Unifi Controller software is one of the most important parts of the Unifi network, so check regularly if there is a new firmware release. Or even better, signup for the newsletter, I will drop you an email with a download link and instructions 😉

We installed the Unifi Controller on a Raspberry Pi, so updating might be a little different then you are used to on a Windows machine. This guide will help you getting through the few steps to update every part of you Unifi Network.

Checking the currently running version

First, let’s check which version we have running at our Unifi Controller. This is really simple, just log in to your controller, click on More Options (the 3 dots, right in the top bar) and click on About.

If you have an older version running ( < 5.8.xx) you will see the version info in the top left the corner.

Unifi Controller Rasberry Pi Update

If we take a look at the Ubiquiti Download page, we see that the latest version is 5.10.12 at the moment of writing.

Make a backup of the Configuration

Before you update any device, always make sure you have a backup of the configuration. There are many reasons why things can break and create a backup is just a few clicks. Go to the settings page in the Unifi Controller (lower-left corner), select Backup, and download the last backup in the list.

In case the upgrade goes wrong, we can re-install the Unifi Controller and simply load the configuration back into the controller. Saving us a lot of time figuring out all the (optimized) settings that we made before.

Login to the Unifi Controller with SSH

Just like when we installed the Unifi Controller on the Raspberry Pi, we need Putty to log in over SSH to update the controller.

Connecting to the Pi with SSH

So we are now ready to remotely manage the Raspberry Pi over SSH. You will need a client for this, I suggest Putty is the best tool for the job.

  1. Download Putty
  2. After installing Putty start it and enter the Ip Address from your Pi in the address bar.
  3. Click on Open, the prompt will ask you to log in (pi and your password (or default raspberry)

Updating the Pi and Unifi Controller

We are logged in to the Pi and with a single command, we can now update the Unifi Controller and the rest of the software on the Raspberry Pi.

Run the following command:

sudo apt-get update && sudo apt-get upgrade -y

All the package that needs to be updated will be processed and updated. You will receive a notice with the question if you have a backup of the Unifi Configuration. Click Yes, because we did that a few steps ago.

During the installation of the update the Pi will reboot. A blue screen with a grey dialog box will appear, asking if you have make a backup file. Click yes, we did that in step 1, and the installation will continue.

Error or warning during the update

With Linux the change you run into an error during an installation or update is pretty high. Below I have listed some of the error I ran into during the update of the Unifi Controller.

Conflicting Distribution

If we are performing an update to the next major version, for example, from 5.8.xx to 5.9.xx, we can get an error like below:

Conflicting distribution: http://dl.ubnt.com/unifi/debian stable InRelease (expected unifi-5.8 but got unifi-5.9)

We can fix this error with the following command:

sudo apt update --allow-releaseinfo-change

Now I got an error running the command above, is not understood in combination with the other options. But we can run the following two commands to fix this:

sudo apt clean
sudo apt update

error: dpkg interrupted

If somehow the update/upgrade gets interrupted and you try it again, you can get an error: dpkg interrupted, you must manually run sudo dpkg --configure -a to correct the problem. The fix for this is in the message, just run the command to correct the problem. When that process is finished you can run the update/upgrade command again.

error: Sub-process /usr/bin/dpkg returned an error code (1)

The above error happened on me last time I updated to the new Unifi Controller version. If you get this error, then one of the packages is broken, the line above the error will tell you which package is causing the error.

So there are a few ways to fix the error, what worked for me was to reconfigure the package database. It got probably corrupted while installing a package. Reconfiguring solves this issue most of the time:

sudo dpkg --configure -a

If that doesn’t work you can try to remove the package and then update the package list.

sudo rm /tmp/apt-dpkg-install-HHVVn9/10-libraspberrypi-doc_1.20180919-1_armhf.deb

#Then update package lists:
sudo apt-get update

#And then install all upgrades including new dependencies:
sudo apt-get dist-upgrade

#Also you can remove some junk packages:
sudo apt-get autoremove

#If the problem persists - clean package cache with
sudo apt-get clean

#and start over.

Conflicting distribution error

While updating to 6.0 I got the following error

Conflicting distribution: https://dl.ubnt.com/unifi/debian stable InRelease (expected unifi-5.13 but got unifi-6.0)

What worked for me and it seems also for other is simply running apt-update first:

sudo apt-get update

# reboot
# and then

sudo apt-get upgrade -y

Without the reboot I got the error “Could not get lock /var/lib/dpkg/lock – open”, but that was solved with a simple reboot of the Pi.

Blank screen after update

If you get a blank screen after updating to 5.10.12 or higher, then your Java version is probably outdated. Rasbian is shipped with an older version of Java, and for 5.10.12 and higher you need atleast Java 1.8.0_201.

You can follow this guide to update your Java version

Updating the AccessPoints

After you updated the controller, you can also update the Unifi devices. After you log back into the controller you probably will see a notice that there is a new firmware version available. Just go to the Devices page and hit the upgrade button on the right side of each device. Or even better, hit the big blue button (top right) with “Start rolling update”

29 thoughts on “Updating Unifi Controller on Raspberry Pi”

  1. I get an error on upgrading not listed above, I assume because stretch is deprecated. any hints on how to manage this when a distribution update is required?

    pi@Uni-Pi:~ $ sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove && sudo apt-get autoclean
    Hit:1 http://archive.raspberrypi.org/debian stretch InRelease
    Ign:2 http://raspbian.raspberrypi.org/raspbian stretch InRelease
    Get:3 http://giteduberger.fr rpimonitor/ InRelease [1,933 B]
    Err:4 http://raspbian.raspberrypi.org/raspbian stretch Release
    404 Not Found [IP: 93.93.128.193 80]
    Hit:5 https://dl.ui.com/unifi/debian stable InRelease
    Reading package lists… Done
    E: The repository ‘http://raspbian.raspberrypi.org/raspbian stretch Release’ does no longer have a Release file.
    N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    N: Skipping acquire of configured file ‘ubiquiti/binary-armhf/Packages’ as repository ‘http://www.ubnt.com/downloads/unifi/debian stable InRelease’ doesn’t support architecture ‘armhf’

  2. Solution to

    N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.”

    sudo apt-get update –allow-releaseinfo-change
    sudo apt-get upgrade -y

  3. upgrading to Unify 6 was not working for me until I followed the steps below

    1. Our first task is to add the UniFi repository to our sources list.

    We can achieve this by running the command below.

    echo ‘deb https://www.ui.com/downloads/unifi/debian stable ubiquiti’ | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list
    2. We now need to add the repositories GPG key by using the following command.

    sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg
    The GPG key is what helps tell the package manager it is downloading the correct package.

    3. As we made changes to the repositories, we need to now update the package list by running the command below.

    sudo apt update
    4. Now finally, we can install the Unifi Controller software to our Raspberry Pi by running the following command.

    sudo apt install unifi
    Installing UniFi through this method will automatically set up a service. This service will automatically start the UniFi software at boot.

  4. Hi, I had a similar issue:
    “E: Repository ‘http://dl.ubnt.com/unifi/debian stable InRelease’ changed its ‘Codename’ value from ‘unifi-5.12’ to ‘unifi-6.0’
    N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.”
    Solved with what suggested at beggining of Error and warning section:
    1. sudo apt update
    2. sudo apt-get upgrade -y
    It works great. Thanks!

  5. Thx for this post.
    I did the apt-get update and the apt-get upgrade -y with a reboot in between. However the controller is stil on version 5.13.
    In the post I read that it should upgrade to version 6.0.
    Any thoughts on why this is not working?

    • For know, the best option is to wait until version 6.x is more stable. Version 6.0.20 had some serious bugs in it. Give it a couple of weeks before you try to update again.

  6. Hi I am trying to upgrade from 5.13 to 6.0 and here is the message I have when doig the update:

    E: Le dépôt « http://dl.ubnt.com/unifi/debian stable InRelease » a modifié sa valeur « Codename » de « unifi-5.13 » à « unifi-6.0 »
    N: this need to be fully accepted before updates are applied. please refer to « apt-secure(8) » for more details.
    N: the configued file « multiverse/binary-armhf/Packages » won’t be taken in account because « https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 InRelease » does not take « armhf » in charge

    any help for a completely unix dummy ?

  7. sudo apt-get update && sudo apt-get upgrade -y
    Used the command as usual BUT the controller is stuck on the previous version 5.12.72

  8. This is really good stuff and works a treat, but after struggling to get an older AP to show up in the controller I now realise that they need an earlier version of the controller – 5.6.42 Is there a way of specifying that version to downgrade to? Or should I just start again? If so how do I specify that version. Many thanks for the excellent guides

  9. Great article, Ruud! One question: Since this is the Lazy Admin, is there any way automatically see if there is an update and apply it if there is one?

    Regards,
    Karl S

    • Well you should get an notification / popup asking if you want to receive a notification when I publish a new article.

      You can also subscribe to the newsletter, I sent an update once a month with some of the latest articles.

  10. Bummer!
    I have tried all of your recommendations and unfortunately now… My controller will not start.

    pi@UniFi-Pi:~ $ uptime
    05:06:04 up 11 min, 1 user, load average: 0.08, 0.07, 0.01
    pi@UniFi-Pi:~ $
    pi@UniFi-Pi:~ $ java -version
    openjdk version “1.8.0_212”
    OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-2~deb9u1-b03)
    OpenJDK Client VM (build 25.212-b03, mixed mode)
    pi@UniFi-Pi:~ $

    sudo apt-get update && sudo apt-get upgrade -y
    Hit:2 http://archive.raspberrypi.org/debian stretch InRelease
    Hit:3 http://raspbian.raspberrypi.org/raspbian stretch InRelease
    Hit:1 https://dl.ubnt.com/unifi/debian stable InRelease
    Reading package lists… Done
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Calculating upgrade… Done
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    pi@UniFi-Pi:~ $

    Found the Fix before hitting submit… This is what worked for me:
    sudo chmod 777 /etc/default/unifi
    sudo service unifi stop
    sudo apt purge oracle-java8-jdk -y
    sudo sed -i ‘s/^JAVA_HOME/#JAVA_HOME/’ /etc/default/unifi
    sudo echo “JAVA_HOME=”$( readlink -f “$( which java )” | sed “s:bin/.*$::” )”” >> /etc/default/unifi
    sudo chmod 644 /etc/default/unifi
    sudo service unifi start

    Hope this helps someone!

    Cheers,
    DarcWing

  11. Hi Ruud, many thanks for this! I updated the Unifi controller as per your instructions and it seemed to have worked as I did not get any errors. But now the controller won’t start up, and a reboot doesn’t fix this either. How to proceed?

Leave a Comment

0 Shares
Tweet
Pin
Share
Share