Unifi controller in ubuntu 18.04 fix

To my disappointment Unifi Controller install on Ubuntu 18.04 fails big time. Their packages … Error message is somehow cryptic enough :

[2018-06-22 16:18:14,046]  INFO  db     - waiting for db connection...
[2018-06-22 16:18:14,546]  INFO  db     - Connecting to mongodb://127.0.0.1:27117
[2018-06-22 16:18:15,164]  ERROR system - [exec] error, rc=2
[2018-06-22 16:18:15,164]  INFO  db     - DbServer stopped
[2018-06-22 16:18:19,209]  ERROR system - [exec] error, rc=2
[2018-06-22 16:18:19,211]  INFO  db     - DbServer stopped
[2018-06-22 16:18:23,247]  ERROR system - [exec] error, rc=2

However i needed Unifi controller in order to control / setup an UniFi AP-AC-Pro ( we have one testing for one of our clients ). After some searching and tweaking around here how we fixed it:

cd /usr/bin
sudo mv mongod mongod.bin

And replace mongod with:

#!/bin/bash
cleaned_args=$(echo $* | sed -e 's/--nohttpinterface//')
exec /usr/bin/mongod.bin ${cleaned_args}

then

chmod +x mongod

Restart unifi service and point your browser to: http://localhost:8843/ and enjoy.

Leave a Reply

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