Skip to content

Instantly share code, notes, and snippets.

@EinPinsel
Created April 28, 2018 17:15
Show Gist options
  • Save EinPinsel/cb3925d621a502c3b97e990b37e5cc9a to your computer and use it in GitHub Desktop.
Save EinPinsel/cb3925d621a502c3b97e990b37e5cc9a to your computer and use it in GitHub Desktop.
1) Check logs in /var/log/unifi/ for clear errors
2) stop unifi service (systemctl stop unifi)
3) Potentially recover the crashed mongodb database (was crashed in my case) by starting it once from cmdline with a custom data directory (mongod --dbpath /var/lib/unifi/data/db). Then check the output of it to see if the DB was recovered. If it was, continue. If there was no problem, continue.
4) Connect to the database (mongo mongodb://127.0.0.1:27017( and run the following command:
db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )
That should give you the output
{ "ok" : 1 }
5) Stop the mongodb database
6) Remove the file /usr/lib/unifi/bin/unifi (rm /usr/lib/unifi/bin/unifi)
7) Create the text file /usr/lib/unifi/bin/unifi with the following content
#!/bin/bash
exec /usr/bin/mongod ${*//--nohttpinterface/}
7) Change owner:group and permissions of /usr/lib/unifi/bin/unifi to root:root and 755
8) Change owner:group of /var/lib/unifi/ to unifi:unifi
9) start unifi again (systemctl start unifi)
10) Check unifi daemon logs in /var/log/unifi/server.log for errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment