04-11-2017 02:33 PM
I am running ubuntu 16.04 LTS with the following repository installed:
deb http://www.ubnt.com/downloads/unifi/debian unifi5 ubiquiti
When I ran "apt update" followed by "apt dist-upgrade" not more than 20 minutes ago, the unifi package update asked if i had a backup: I said no, it cancelled the unifi update, and completed the rest of the package updates.
BUT: unifi no longer appears to run.
I show unifi starting up in syslog:
Apr 11 14:06:42 workhorse unifi.init: * Starting Ubiquiti UniFi Controller unifi
Apr 11 14:06:43 workhorse unifi.init: ...done.
Apr 11 14:06:43 workhorse systemd: Started unifi.
looking in /var/log/unifi/server.log, I see:
[2017-04-11 14:18:48,110] <launcher> INFO system - ====================================================================== [2017-04-11 14:18:48,111] <launcher> INFO system - UniFi 5.4.11 (build atag_5.4.11_9184 - release) is started [2017-04-11 14:18:48,112] <launcher> INFO system - ====================================================================== [2017-04-11 14:18:48,115] <launcher> INFO system - BASE dir:/usr/lib/unifi [2017-04-11 14:18:48,148] <launcher> INFO system - Current System IP: 10.37.50.20 [2017-04-11 14:18:48,148] <launcher> INFO system - Hostname: workhorse [2017-04-11 14:18:48,258] <launcher> INFO db - waiting for db connection... [2017-04-11 14:18:48,758] <launcher> INFO db - Connecting to mongodb://127.0.0.1:27117 [2017-04-11 14:18:49,639] <db-server> ERROR system - unable to exec java.io.IOException: Cannot run program "bin/mongod" (in directory "/usr/lib/unifi"): error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at com.ubnt.ace.F.Object(Unknown Source) at com.ubnt.ace.F.o00000(Unknown Source) at com.ubnt.service.B.O.<C3><B4>O0000(Unknown Source) at com.ubnt.service.B.O.super(Unknown Source) at com.ubnt.service.B.O$1.run(Unknown Source) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.IOException: error=2, No such file or directory at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.<init>(UNIXProcess.java:247) at java.lang.ProcessImpl.start(ProcessImpl.java:134) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ... 6 more [2017-04-11 14:18:49,668] <db-server> INFO db - DbServer stopped
The section between [2017-04-11 14:18:49,639] and [2017-04-11 14:18:49,668] just keeps repeating every four seconds.
There certainly is no /usr/lib/unifi/bin/mongod, so the error makes sense.
Now, in addition to all of this, the ubuntu version of mongodb is running. I would have a problem with this but it's not listening on the same port.
So what went wrong? Did the package manager delete /usr/lib/unifi/bin/mongod before it asked me if it could upgrade? How do I fix this?
I have it within my power to force an upgrade, but I need a backup first to be certain. anyone know how to get a backup of mongo w/o having the mongod executable present?
04-11-2017 03:19 PM
I may have this resolved:
I dug through the contents of /var/log/unifi/mongod.log, and noticed the version of mongod is the same as that installed in the OS. I created a symlink: ln -s /usr/bin/mongod /usr/lib/unifi/bin/mongod, and restarted the unifi service.
The mongod error went away, but I had another problem:
java.lang.IllegalArgumentException: Document base /usr/lib/unifi/webapps/ROOT does not exist or is not a readable directory
As it happens, there was NO /usr/lib/unifi/webapps/ROOT directory.
I extracted an old version of the debian package manually and rsynced the webapps/ROOT directory into place and restarted unifi again with success.
Looking back, I see the following lines in /var/log/dpkg.log:
2017-04-11 13:48:55 upgrade unifi:all 5.4.11-9184 5.4.14-9202 2017-04-11 13:48:55 status half-configured unifi:all 5.4.11-9184 2017-04-11 13:49:01 status unpacked unifi:all 5.4.11-9184 2017-04-11 13:49:01 status half-installed unifi:all 5.4.11-9184
So, it appears that webapps/ROOT is removed, and the symlink to /usr/bin/mongod is deleted before the user is asked if a backup has been generated. This is a bug!
10-09-2017 10:12 AM
Thanks for the valuable solution, jason!
Anyone manually copying the ROOT directory from a recent .deb-package may find this helpful,