Reply
New Member
Posts: 7
Registered: ‎07-01-2013
Kudos: 8

when running apt dist-upgrade on my ubuntu 16.04 lts server, unif stopped working.

Hello,

 

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[1265]: * Starting Ubiquiti UniFi Controller unifi

   Apr 11 14:06:43 workhorse unifi.init[1265]: ...done.
   Apr 11 14:06:43 workhorse systemd[1]: 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?

--jason

New Member
Posts: 7
Registered: ‎07-01-2013
Kudos: 8

Re: when running apt dist-upgrade on my ubuntu 16.04 lts server, unif stopped working.

Hello,

 

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!

 

--jason

New Member
Posts: 1
Registered: ‎02-12-2017

Re: when running apt dist-upgrade on my ubuntu 16.04 lts server, unif stopped working.

Thanks for the valuable solution, jason!

 

Anyone manually copying the ROOT directory from a recent .deb-package may find this helpful,

https://blog.packagecloud.io/eng/2015/10/13/inspect-extract-contents-debian-packages/

Emerging Member
Posts: 44
Registered: ‎06-23-2018
Kudos: 9

Re: when running apt dist-upgrade on my ubuntu 16.04 lts server, unif stopped working.

@jason0 you saved my weekend, sir. Thank you!

New Member
Posts: 14
Registered: ‎04-13-2018

Re: when running apt dist-upgrade on my ubuntu 16.04 lts server, unif stopped working.

you saved me hours of fixing!
Reply