Raspberry PI 4, Debian 12 Bookworm, and Unifi 8.x
I enjoy using Raspberry PI devices as nice little Unifi servers along with my Homebridge setup. They aren’t busy 99% of the time unless you are managing it or have firmware updates running to devices. That said, with UniFi depending on MongoDB, we’ve got problems now…
- MongoDB stopped supporting Raspberry PI 4 and less since 4.4.18 due to the ARM instruction set in the processor being older.
- MongoDB 4.4.x goes end of life in February 2024
Until Unifi decides for other reasons to move off of MongoDB, we’re going to have to harden these devices so they can still run. I’m running Unifi 8.0.26 right now using the following configuration that I did BEFORE I tried installing Unifi. If you have it currently installed, remove it using apt.
# Need this as a dependency
sudo apt-get install openjdk-openjdk-17-jre-headless
# Now we are going to deploy Mongo 4.4
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/sources.list.d/mongodb-org-4.4.list
sudo apt-get update
# Now we install the last supported version that worked with Raspberry PI 4, version 4.4.18
sudo apt-get install mongodb-org-server=4.4.18
# This step is critical or it will upgrade to version 4.4.24 which does not work on a Raspberry PI 4 device.
sudo apt-mark hold mongodb-org-server
From here, you just install Unifi like you normally would.
Now good news, MongoDB runs on 127.0.0.1 by default, so that reduces a lot of risk of running an older version of MongoDB. That said, if something in the web app allows malicious code to pass to MongoDB, you have a problem again. Consider firewalling who can access the Unifi webserver with a firewall rule on port 8443/TCP to further reduce your risk.
For now, that’s what we have to do to make these servers work, I hope you find this helpful!