Restoring Unifi Controller
Today I woke up and realized that a power surge a while back had taken down our Unifi controller without me realizing. I went to log in to check on firmware updates for the network only to see that I couldn’t log in at all. I guess that’s the benefit of hosting your controller via a CloudKey Gen 2 with a built-in on-device battery vs. on a Raspberry Pi like I do.
That said, restoring from scratch was actually super easy, given that I had regular backups. Here’s the process and some additional reading that I used.
Assumptions
- You’re running the most recent version of the Ubiquiti Unifi controller on a Raspberry Pi (or other Debian-based Linux-based environment)
- You already have your self-hosted environment set up with a static IP address, and can access it via
sshor through a command line interface - You already added the repo directly to
aptfor managing installing and updatingunifi - You have a recent backup of your controller setup / data
Note: If you don’t have all of this set up already, and are instead looking for a primer on getting it set up from scratch, follow the link in the Further Reading section below on How to Host Unifi Controller on Raspberry Pi
Steps
- Uninstall the Unifi controller:
sudo dpkg -P unifi- Note that in this article here it recommends that you fully delete the
/usr/lib/unifi/datadirectory. I did NOT do this and was totally fine
- Note that in this article here it recommends that you fully delete the
- Update your package references:
sudo apt-get update - Install the most recent Unifi distribution:
sudo apt install unifi - Wait for the installation and the bootstrapping of the webserver
- Navigate to your static IP for the controller, specifically to port 8443
- You’ll need to accept the self-signed certificate
- Click through the wizard to find the “Restore from Backup” button
- Should be pretty early on in the process, if not on the very first screen
- Upload the backup
- Wait for the restoration to finalize
- The page will reload for you automatically and forward you to the login screen that should be familiar
- When you log in, you’ll notice all of your Unifi devices will start adopting
- Waiting for the adoption process to finalize. Note: Your APs will likely stop broadcasting the network momentarily while this adoption process will occur
- My network was unavailable for like 30secs.
- You’re done!
While the above seems like a lot of steps, it was actually super straightforward and just involved some waiting.
Further Reading
- Official Docs on how to Uninstall Unifi Controller
- How to Host Unifi Controller on Raspberry Pi
- Note: The last time that I used this one to set up a new Rpi + Unifi, it failed when installing the Unifi Controller due to some issues with Mondo DB not being able to be installed. However, following the commands listed in the link below actually fixed the issue, so this one might be a little out of date.
- Longer-form Post on How to Install Unifi Controller on Rpi