Running UniFi Controller on arm64 (or ppc64el)

Sometime last year I decided to switch my home wireless infrastructure over to Ubiquiti UniFi. This isn't just standalone access points, so they rely on controller software - to be run on Someone Else's Computer (just no), or using their UniFi Controller on a machine of your choice. Since the controller is written in Java, it will run pretty much anywhere that can also run its other dependencies. They even provide their own Debian/Ubuntu repository, and a pretty howto on setting it up.

UniFi on armhf

I initially actually ran this on armhf/Stretch, and still have a post in draft state on how to achieve this (since one of the prerequisites is MongoDB, no longer supported on armhf), but probably won't bother publishing it since it is a bit of a dead end.

(Short short version: grab the 2.6.10 sources from Ubuntu Xenial and fix the most awfully broken bits of code until it actually compiles. This includes the parts of the testsuite that try to verify undefined behaviour of the programming languages used. ?!?)

But since I now have always-on arm64 machines in my home network, I decided it was time to move to the architecture that has been my main development target for the past 8 years...

UniFi on arm64

Unsurprisingly, this hit a snag; while the package itself is completely architecture-independent, the Debian repository format is not. With the instructions from the howto, apt expects to find $ARCHIVE_ROOT/dists/$DISTRIBUTION/ubiquiti/binary-$arch/Packages.gz to tell it which packages are available in the repo and what their dependencies are. Which works fine when there is a populated entry for $arch. There is for (at least) i386, amd64 and armhf - but not for arm64 or ppc64el.

The $ARCHIVE_ROOT specified in abovelinked howto is http://www.ubnt.com/downloads/unifi/debian. Not sure why that does not specify https (which also works), but I will use the actually documented variant below.

Workaround

The package itself is fully architecture independent. So what we can do instead is grab the Packages.gz for armhf and have a peek:

$ wget http://dl.ubnt.com/unifi/debian/dists/stable/ubiquiti/binary-armhf/Packages.gz
...
$ zcat Packages.gz
Package: unifi
Version: 5.7.23-10670
Architecture: all
Depends: binutils, coreutils, jsvc (>=1.0.8) , mongodb-server (>=2.4.10) | mongodb-10gen (>=2.4.14) | mongodb-org-server (>=2.6.0), java8-runtime-headless, adduser, libcap2
Conflicts: unifi-controller
Provides: unifi-controller
Replaces: unifi-controller
Installed-Size: 113416
Maintainer: UniFi developers <unifi-dev@ubnt.com>
Priority: optional
Section: java
Filename: pool/ubiquiti/u/unifi/unifi_5.7.23-10670_all.deb
Size: 64571866
SHA256: e7b60814c27d85c13e54fc3041da721cc38ad21bb0a932bdfe810c2ad3855392
SHA1: 49f16c3d0c6334cb2369cd2ac03ef3f0d0dfe9e8
MD5sum: 478b56465bf652993e9870912713fab2
Description: Ubiquiti UniFi server
 Ubiquiti UniFi server is a centralized management system for UniFi suite of devices.
 After the UniFi server is installed, the UniFi controller can be accessed on any
 web browser. The UniFi controller allows the operator to instantly provision thousands
 of UniFi devices, map out network topology, quickly manage system traffic, and further
 provision individual UniFi devices.
Homepage: http://www.ubnt.com/unifi

Download the package

The Filename: field tells us the current unifi packages can be found at pool/ubiquiti/u/unifi/unifi_5.7.23-10670_all.deb - relative to the $ARCHIVE_ROOT, not the binary-$arch - so we can download it with

$ wget http://dl.ubnt.com/unifi/debian/pool/ubiquiti/u/unifi/unifi_5.7.23-10670_all.deb

Verify the integrity of the package by running

$ sha256sum unifi_5.7.23-10670_all.deb

and comparing the output with the value from the SHA256: field.

Install dependencies and UniFi

The Depends: field tells us we need

  • binutils
  • coreutils

(both of these are likely to be installed already, unless you like me had just accidentally tried to install a broken home-built toolchain package in the host instead of a chroot ... oops!)

  • jsvc
  • mongodb-server
  • java8-runtime-headless
  • adduser (also likely to already be installed)
  • libcap2

Resolving this is straightforward enough, with perhaps the single exception of java8-runtime-headless, which is a virtual package. But if you try to install that, apt will let you know, and point out which available packages provide it. So, as a one-liner:

$ sudo apt-get install jsvc mongodb-server openjdk-8-jre-headless libcap2

Then we're ready to:

$ sudo dpkg -i unifi_5.7.23-10670_all.deb

Setup

Nothing architecture-specific about this: go to https://$HOST:8443 to set up. In my case, I just imported my downloaded backup from the armhf server and had everything back up and running quickly without manual intervention.

Final notes

Of course, this will leave you without automatic updates, so you'll need to go periodically have a look at one of the actually enabled architectures for version changes and manually install updates.

And if you have an account on the Ubiquiti forum, consider upvoting my proposal to add the missing architectures to the repository.

social