Upgrade UniFi Controller Running as a Service

Ubiquiti provides instructions here for running the UniFi Controller as a service. What they don’t tell you is that when you try to upgrade the controller, you can’t, because the service is still running. Here are the instructions for that:

1. Back up your config from Settings > Maintenance > Download Backup. If you get the message, “There was an error generating a new backup file,” check %UserProfile%\Ubiquiti UniFi\logs\server.log for details. If it indicates that it could not create a file in a TEMP folder, try stopping and restarting the UniFi Controller service from Windows Services. That should recreate the folder(s) in TEMP and allow you do Download Backup.

Another alternative, if you haven’t made recent changes, is to go to Settings > Auto Backup and download the most recent backup.

2. On the server running the controller, open an administrative Command Prompt.  Stop the UniFi Java service:

cd "%UserProfile%\Ubiquiti UniFi\"
java -jar lib\ace.jar stopsvc

3. Overinstall the new controller (run UniFi-installer.exe).  On the last page of the install wizard, check “Start UniFi Controller after installation”.

4. In the small window that opens, wait until it says “UniFi Controller (x.xx.xx) started”:

Upgrade UniFi Controller

Close the window (do not launch browser).

5. Back at the administrative Command Prompt, install and start the service:

java -jar lib\ace.jar installsvc
java -jar lib\ace.jar startsvc

6. Test access from a browser.

Additional Commands and Troubleshooting

To view other commands available, run java –jar lib\ace.jar without parameters. You’ll see:

Upgrade UniFi Controller 2

Once the service is installed, you can check its status in the list of Windows Services. For example, here the service is present but it’s not running:

Upgrade UniFi Controller 3

After upgrading the controller at one site to version 5.8.24, I could no longer access the controller inside the LAN on port 8443, although cloud access was working. Also, all devices showed as offline. When I logged in directly to the USG, it told me that the Controller was unreachable, even though it is on the same LAN, indicating that it could not “inform” to the controller on port 8080:

Upgrade UniFi Controller 4

UniFi had already added TCP and UDP firewall exceptions on the server for mongod.exe, but apparently that is not enough. I added explicit exceptions on ports 8080 and 8443. After that, I was able to access the controller across the network on 8443, and the devices once again showed as connected.

Update August 29, 2020

With controller 5.14.23, and probably before, the service is no longer appearing in the list of services (services.msc). You can check for the service definition in the registry (HKLM\SYSTEM\CurrentControlSet\Services\UniFi). You can also manage the service from an administrative command prompt:

sc query UniFi
net stop UniFi
net start UniFi

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.

This site uses Akismet to reduce spam. Learn how your comment data is processed.