Reply
New Member
Posts: 6
Registered: ‎03-23-2018

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

Wilco. Thank you again.

New Member
Posts: 3
Registered: ‎01-24-2019

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

[ Edited ]

@hobbes1069 

 

I've installed the package you provide.

However, every time I reboot the server I am unable to get Unifi started again.

 

Do I have to start the mongoDB instance on its own?

CentOS 7 (1810)

Member
Posts: 126
Registered: ‎09-01-2016
Kudos: 59

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages


@Smekke0 wrote:

@hobbes1069 

 

I've installed the package you provide.

However, every time I reboot the server I am unable to get Unifi started again.

 

Do I have to start the mongoDB instance on its own?

CentOS 7 (1810)


How did you enable it?

 

systemctl enable unifi.service?

 

When you boot what is the output of:

 

systemctl status unifi.service

 

systemctl cat unifi.service

 

Unifi runs it's own instance of mongodb so you don't need to start it as a system service.

 

Thanks,

Richard

New Member
Posts: 3
Registered: ‎01-24-2019

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

[ Edited ]

Yea I've enabled it.

After reboot the webpage just doesn't come back.

 

The mongod log looks like it shuts down but never starts again?

 

service status

● unifi.service - Ubiquiti UniFi server
   Loaded: loaded (/usr/lib/systemd/system/unifi.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2019-01-25 19:09:29 CET; 1min 26s ago
 Main PID: 5636 (java)
   CGroup: /system.slice/unifi.service
           └─5636 /usr/bin/java -jar /usr/share/unifi/lib/ace.jar start

Jan 25 19:09:29 unifi.xxxxx.com systemd[1]: Started Ubiquiti UniFi server.

cat service

[xxxx@unifi ~]$ systemctl cat unifi.service
# /usr/lib/systemd/system/unifi.service
[Unit]
Description=Ubiquiti UniFi server
After=local-fs.target remote-fs.target network-online.target
Wants=network-online.target

[Service]
Type=simple
User=unifi
WorkingDirectory=/usr/share/unifi
# Has to be run though bash script due to java issue, see:
# https://bugzilla.redhat.com/show_bug.cgi?id=1358476#c20
#ExecStart=/usr/sbin/unifi start
#ExecStop=/usr/sbin/unifi stop
ExecStart=/usr/bin/java -jar /usr/share/unifi/lib/ace.jar start
ExecStop=/usr/bin/java -jar /usr/share/unifi/lib/ace.jar stop
Restart=on-success

[Install]
WantedBy=multi-user.target

server.log

[2019-01-25 19:09:33,272] <launcher> INFO  system - ======================================================================
[2019-01-25 19:09:33,282] <launcher> INFO  system - UniFi 5.9.29 (build atag_5.9.29_11384 - release) is started
[2019-01-25 19:09:33,282] <launcher> INFO  system - ======================================================================
[2019-01-25 19:09:33,286] <launcher> INFO  system - BASE dir:/usr/share/unifi
[2019-01-25 19:09:33,295] <launcher> INFO  system - Current System IP: 192.168.x.x
[2019-01-25 19:09:33,297] <launcher> INFO  system - Hostname: unifi.xxxx.com

mongod.log

2019-01-25T19:09:08.103+0100 [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
2019-01-25T19:09:08.104+0100 [signalProcessingThread] now exiting
2019-01-25T19:09:08.104+0100 [signalProcessingThread] dbexit:
2019-01-25T19:09:08.104+0100 [signalProcessingThread] shutdown: going to close listening sockets...
2019-01-25T19:09:08.104+0100 [signalProcessingThread] closing listening socket: 8
2019-01-25T19:09:08.104+0100 [signalProcessingThread] closing listening socket: 9
2019-01-25T19:09:08.104+0100 [signalProcessingThread] removing socket file: /usr/share/unifi/run/mongodb-27117.sock
2019-01-25T19:09:08.104+0100 [signalProcessingThread] shutdown: going to flush diaglog...
2019-01-25T19:09:08.104+0100 [signalProcessingThread] shutdown: going to close sockets...
2019-01-25T19:09:08.104+0100 [signalProcessingThread] shutdown: waiting for fs preallocator...
2019-01-25T19:09:08.104+0100 [signalProcessingThread] shutdown: lock for final commit...
2019-01-25T19:09:08.104+0100 [signalProcessingThread] shutdown: final commit...
2019-01-25T19:09:08.104+0100 [signalProcessingThread] shutdown: closing all files...
2019-01-25T19:09:08.104+0100 [signalProcessingThread] closeAllFiles() finished
2019-01-25T19:09:08.104+0100 [signalProcessingThread] journalCleanup...
2019-01-25T19:09:08.104+0100 [signalProcessingThread] removeJournalFiles
2019-01-25T19:09:08.106+0100 [signalProcessingThread] shutdown: removing fs lock...
2019-01-25T19:09:08.106+0100 [signalProcessingThread] dbexit: really exiting now

 

Member
Posts: 126
Registered: ‎09-01-2016
Kudos: 59

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

Might be best to take this offline, but is that the whole mongod.log file? I would say that's where the problem is. You should see it in systemctl status if it starts up...

 

# systemctl status unifi
● unifi.service - Ubiquiti UniFi server
   Loaded: loaded (/usr/lib/systemd/system/unifi.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2019-01-23 20:00:45 CST; 1 day 16h ago
 Main PID: 4258 (java)
    Tasks: 898
   CGroup: /system.slice/unifi.service
           ├─4258 /usr/bin/java -jar /usr/share/unifi/lib/ace.jar start
           └─9186 bin/mongod --dbpath /usr/share/unifi/data/db --port 27117 --unixSocketPrefix /usr/share/unifi/run --logappend --logpath /usr/share/unifi/logs/mongod.log --smallfiles --bind_ip 127.0.0.1

Jan 23 20:00:45 r2d2.localdomain systemd[1]: Started Ubiquiti UniFi server.

Richard

New Member
Posts: 28
Registered: ‎08-14-2013
Kudos: 5

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

lsof -i :8443

 

Run the above. See if port 8443 (web) is listening.

 

New Member
Posts: 3
Registered: ‎01-24-2019

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

[ Edited ]

So I deleted my VM and started from scratch.

Now it does start after a reboot. It however takes about 7-8 minutes for the mongod to kick in.

Not sure if that's normal or to long.

 

However, I've rebooted multiple times now and it keeps starting so I'm all good. Thank you sir!

Member
Posts: 184
Registered: ‎09-02-2012
Kudos: 38

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

I have seen that mongodb can  take a long time to build it's initial database.

 

5 -6 min is a looonngg time, but I will say that mongodb does take a bit on its first start with Unifi.

 

Did you like check the mongodb log file and see what it is doing?

New Member
Posts: 7
Registered: ‎01-22-2019

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

[ Edited ]

Hey @hobbes1069 !  Thanks much for the unifi package for CentOS.  I just went from 5.8.x to your new 5.9.29 release (I did a backup, removed the other one, then installed yours from the Fusion repo).  All worked great!

 

However, when I went to configure LetsEncrypt, I had some issues.  Took a while, but I finally figured out that all of the scripts out there are updating this file:

 

/var/lib/unifi/keystore

 

But your package actually has the file that is used in:

 

/var/lib/unifi/data/keystore

 

I assume this relates to the change of things into /opt/UniFi/ for CentOS.

 

I just wasn't sure of the right way to adjust things for LetsEncrypt under your CentOS package version...

 

It looks like you put things in /opt/UniFi/, but the keystore in /opt/UniFi/data doesn't appear to be the one actually being used by the Unifi server.  It's still using the one from /var/lib/unifi/data/keystore.

 

Do we need a symlink from /var/lib/unifi/data to /opt/UniFi/data/ ?  (Or something else -- because I don't think the keystore in /opt/ is being used at all with your package currently.)

 

Member
Posts: 126
Registered: ‎09-01-2016
Kudos: 59

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

I can't say excatly what you have going on but I can say that:

 

- Thias's package installed into /opt, mine has always attemped a more FHS compliant install and never installed into /opt. In fact that's not allowed by RPM Fusion (or Fedora/EPEL). /opt is for 3rd party packages.

 

- I use the directories provided by or generated by the unifi, which includes "data". All I do is copy the static stuff to /usr/share and the "live" data to /var/lib (again for FHS compliance). I notice it's not packaged so I'll take a look when I can but obviously unifi is finding what it's looking for there...

 

Hopefully that helps out, if not let me know.

 

Thanks,

Richard

New Member
Posts: 7
Registered: ‎01-22-2019

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

Ok. Maybe it was some leftovers from the previous uninstall of his. I'll do more digging and follow up here later. Thanks.

New Member
Posts: 7
Registered: ‎01-22-2019

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

I'm excited to try the new 5.10.12 release -- any chance we'll see that soon, @hobbes1069 ?

 

Thanks!

 

Highlighted
Member
Posts: 126
Registered: ‎09-01-2016
Kudos: 59

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

To be honest I'm kind of scared of the 5.10.x series right now.

 

For one, CentOS 7 doesn't have a new glibc installed and so it won't work. EL7 only supports up to 3.4.19 (internal version, not the package version) and 5.10.x wants 3.4.20.

 

So after I hosed my EL 7 server I tried moving it to my Fedora box and could not find the cause or the solution:

 

Feb 10 12:23:31 systemd[1]: Started Ubiquiti UniFi server.
Feb 10 12:23:32 java[25085]: Feb 10, 2019 12:23:32 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
Feb 10 12:23:32 java[25085]: INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused (Connection refused)
Feb 10 12:23:32 java[25085]: Feb 10, 2019 12:23:32 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
Feb 10 12:23:32 java[25085]: INFO: Retrying request
Feb 10 12:23:32 java[25085]: Feb 10, 2019 12:23:32 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
Feb 10 12:23:32 java[25085]: INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused (Connection refused)
Feb 10 12:23:32 java[25085]: Feb 10, 2019 12:23:32 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
Feb 10 12:23:32 java[25085]: INFO: Retrying request
Feb 10 12:23:32 java[25085]: Feb 10, 2019 12:23:32 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
Feb 10 12:23:32 java[25085]: INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused (Connection refused)
Feb 10 12:23:32 java[25085]: Feb 10, 2019 12:23:32 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
Feb 10 12:23:32 java[25085]: INFO: Retrying request
Feb 10 12:30:41 systemd[1]: Stopping Ubiquiti UniFi server...
Feb 10 12:30:42 systemd[1]: unifi.service: Main process exited, code=exited, status=143/n/a
Feb 10 12:30:42 systemd[1]: unifi.service: Failed with result 'exit-code'.
Feb 10 12:30:42 systemd[1]: Stopped Ubiquiti UniFi server.

There's also a new port that needs to be opened for cloud key access. I'm tempted to put that in a separate firewalld file so users can enable it only if they use that feature instead of forcing it on everyone.

 

I ended up having to roto-rooter my EL 7 box and restore from backup (Thank you auto backup!!!) but it still couldn't properly re-adopt my two access points. No problem, I just ssh'd into them and reset them to factory but I couldn't imagine if I had a serious commercial setup.

 

Thanks,

Richard

Member
Posts: 126
Registered: ‎09-01-2016
Kudos: 59

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

Ok, so I didn't have a lot of success with 5.10.x... First it doesn't install on CentOS 7 due to the version of glibc being linked against...

 

Here's some test packages for the brave... There may be dragons and they might eat babies so BACKUP FIRST

 

https://www.dropbox.com/s/1cx1ywm665vkxmq/unifi-5.10.17-1.fc29.x86_64.rpm
https://www.dropbox.com/s/jcytu1nlgqwaexa/unifi-data-5.10.17-1.fc29.noarch.rpm

 

These should generally work for current releases of Fedora.

 

Thanks,

Richard

New Member
Posts: 11
Registered: ‎11-23-2016
Kudos: 1

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

[ Edited ]

@hobbes1069 thanks for your work, was just going to ask about 5.10.17  and I saw your comments about glibc. Any chance that they could be compiled in statically for CentOS 7?

Member
Posts: 126
Registered: ‎09-01-2016
Kudos: 59

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

Unfortuantely no, since it's a binary package I don't have the ability to build it against the glibc in CentOS. I tried bundling some of the libraries and playing with their environment / rpath to get them picked up but it was an utter failure. 

 

I have built 5.10.x for Fedora but still don't have a work around for CentOS 7... If someone has a bright idea I'm all ears but it may have to wait for CentOS 8 (RHEL 8 is in Beta).

 

Thanks,

Richard

New Member
Posts: 11
Registered: ‎11-23-2016
Kudos: 1

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

@hobbes1069 thanks... I have no experience with this kind of stuff myself.

 

I'm really just disapointed by the whole Ubiquti stance on CentOS/RedHat.... they aren't exactly some smaller player in the Liunux market.

New Member
Posts: 10
Registered: ‎02-11-2018
Kudos: 2

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

Docker/LXC container?  There are additional trust/security concerns with providing them under that model.

 

This may be what drives me to just buy a cloud key.

Member
Posts: 126
Registered: ‎09-01-2016
Kudos: 59

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

It probably wasn't an intentional change but it would have been nice if they would be more careful about changing dependencies.

 

It's ironic though they still want to use MongoDB 3.4 (I'm running 4.x on my Fedora 29 box runn unifi without issue) but then upgrade the base library requirements.

 

Thanks,

Richard

New Member
Posts: 11
Registered: ‎11-23-2016
Kudos: 1

Re: Unofficial RHEL/CentOS UniFi Controller rpm packages

@m0ondoggy the problem with that is it feels like I'm rewarding them (by purchasing the cloud key) when I have a perfectly good home server with more than enough spare CPU cycles to host the controller.

Reply