4 June, 2023

UniFi 7.4 Raspberry Pi Setup

TL;DR: UniFi 7.4 cannot run on 32-bit Raspbian. But it works fine, if you use 64-bit and a couple tricks.

In the release notes of UniFi 7.4.156, you'll see the following note burried halfway down the page: "Require MongoDB 2.6 as lowest version."

If you try to install/upgrade on 32-bit Raspbian using the old MongoDB 2.4 package from Raspbian stretch, you'll get the following error in /usr/lib/unifi/logs/server.log: Got error while connecting to db: Server at localhost:27117 reports wire version 0, but this version of the driver requires at least 2 (MongoDB 2.6).

But, we can get UniFi 7.4 running with 64-bit Raspbian, with OpenJDK 11 and MongoDB 3.6.

To get MongoDB 3.6 working, we'll also need an older copy of libssl, to resolve the mongodb-org-server depends on libssl1.0.0 (>= 1.0.2~beta3) error.

Installing UniFi 7.4 on Raspbian 11 (Bullseye)

  1. (If you already have a now-broken installation) Downgrade to 7.3.38 using wget https://dl.ui.com/unifi/7.3.83/unifi_sysvinit_all.deb && sudo dpkg -i unifi_sysvinit_all.deb in order to get a backup.
  2. Download the latest 64-bit Lite version of Raspbian, and flash it to a SD card.
  3. Follow the Raspberry Pi instructions for a headless pi, with a userconf.txt file and empty ssh file.
  4. Boot the pi, and run raspi-config to set timezone, hostname, etc., and reboot
  5. Based vaguely on the UniFi install instructions, run the below:
sudo apt update && sudo apt upgrade -y

echo 'deb [arch=amd64] 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

# libssl for MongoDB 3.6
wget -O /tmp/libssl1.0.0_1.0.2n-1ubuntu5.13_arm64.deb http://ports.ubuntu.com/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5.13_arm64.deb
sudo dpkg -i /tmp/libssl1.0.0_1.0.2n-1ubuntu5.13_arm64.deb

# Install MongoDB 3.6
wget -O /tmp/mongodb-org-server_3.6.23_arm64.deb https://repo.mongodb.org/apt/ubuntu/dists/xenial/mongodb-org/3.6/multiverse/binary-arm64/mongodb-org-server_3.6.23_arm64.deb
sudo dpkg -i /tmp/mongodb-org-server_3.6.23_arm64.deb

# Maybe one day, when UniFi updates...
# curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/mongodb-server-4.4.gpg > /dev/null
# echo 'deb [arch=amd64 signed_by=/etc/apt/trusted.gpg.d/mongodb-server-4.4.gpg] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse' | sudo tee /etc/apt/sources.list.d/mongodb.list

# Finally, install UniFi!
sudo apt update
sudo apt install openjdk-11-jre-headless unifi