Installing Ubiquiti UniFi Controller in a jail

Installing Ubiquiti UniFi Controller in a jail

AVSION

Contributor
Joined
Dec 28, 2016
Messages
128
Hi m0nkey_ just checked unifi5 via pkg version is 5.7.23 vs ports 5.8.24 can i upgrade pkg after install to the latest version or we have to wait when available? also any difference or prones /cones in terms of functionality and features between the pkg and ports except pkg is easy to install?

thank you
 

BoXstA

Cadet
Joined
Oct 18, 2018
Messages
1
Hi, I just recently updated my Unifi controller running in a jail on FreeNAS 11.1-U6, everything went smoothly however I'm stuck on the UniFi SDN - Server Status page with "UniFi Controller is starting up...".

This has been stuck for about an hour and the server was rebooted following the update. Any suggestions?
server.log shows
Code:
<db-server> ERROR system - [exec] error, rc=141, cmdline=[bin/mongod, --dbpath, /usr/local/share/java/unif
i/data/db, --port, 27117, --unixSocketPrefix, /usr/local/share/java/unifi/run, --logappend, --logpath, /usr/local/share/java/unifi/l
ogs/mongod.log, --nohttpinterface, --bind_ip, 127.0.0.1] 
 
Last edited:

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,974
Hi, I just recently updated my Unifi controller running in a jail on FreeNAS 11.1-U6, everything went smoothly however I'm stuck on the UniFi SDN - Server Status page with "UniFi Controller is starting up...".

This has been stuck for about an hour and the server was rebooted following the update. Any suggestions?
server.log shows
Code:
<db-server> ERROR system - [exec] error, rc=141, cmdline=[bin/mongod, --dbpath, /usr/local/share/java/unif
i/data/db, --port, 27117, --unixSocketPrefix, /usr/local/share/java/unifi/run, --logappend, --logpath, /usr/local/share/java/unifi/l
ogs/mongod.log, --nohttpinterface, --bind_ip, 127.0.0.1]
Same here. Just updated and I'm stuck with the same situation.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,974
No I just shut it off for the time being.
 

gt2416

Patron
Joined
Feb 4, 2018
Messages
262
The problem is that MongoDB is compiled for 11.2 and requires libdl.so and libdl.so.1.
You can install 11.2 in a vm and copy the files from the VM's 11.2 /usr/lib to the 11.1 jails /usr/lib. (Or pm me, Ill gladly share it).
You can confirm this is your issue by typing mongod in your jail shell. Mongo will fail to start and tell you those files are missing. I have the latest unifi running on 11.1-U6 with just pkg install unifi5 and those files I mentioned.
Happy Thanksgiving guys :)
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
The problem is that MongoDB is compiled for 11.2 and requires libdl.so and libdl.so.1.
It's amazing how much aggravation 11.1 not being supported is causing. Thanks for the tip, mine is working now.
 

colmconn

Contributor
Joined
Jul 28, 2015
Messages
174
I used the following workarounds to get it to install on a 11.1 jail on 11.1-U6. Hope it helps.

After jail creation (fix for installing s/w on 11.1 based on https://forums.freenas.org/index.ph...-with-libdl-so-1-not-found-error.70391/page-2)

  1. Edit /etc/pkg/FreeBSD.conf
    1. Replace quarterly with release_2 (it was the last release without the libdl library
  2. Edit /usr/local/etc/pkg.conf
    1. Add set OSVERSION = 1101001 as the first line
  3. pkg update
  4. Install packages listed here https://github.com/kjake/freenas-iocage-unifi/blob/master/unifi-jail.sh except
    1. Replace mongodb with mongodb34
    2. pkg install -y openjdk8 python mongodb34 bash snappyjava gmake gettext indexinfo zip git dehydrated py27-pip
    3. portsnap fetch extract
    4. env ALLOW_UNSUPPORTED_SYSTEM=YES make -C /usr/ports/net-mgmt/unifi5 clean install BATCH=yes
  5. Start mongodb
    1. sysrc mongod_enable=YES
    2. service mongod start
      1. By default this makes it listen on 127.0.0.1 and any one in the jail can connect to it
    3. Start unifi
      1. sysrc unifi_enable=YES
      2. service unifi start
    4. Connect to unifi in browser at https://${JAIL_IP}:8443/
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,974
The problem is that MongoDB is compiled for 11.2 and requires libdl.so and libdl.so.1.
I have libdl.so.1 but not libdl.so in a fresh FreeBSD 11.2 installation. If you could send them to me that would be great.

EDIT: Disregard. I added just libdl.so.1 and it started up.
 
Last edited:

swil00

Cadet
Joined
Dec 1, 2018
Messages
5
Hi, I'm running FREENAS 11.2-RC1 currently with UniFi 5.8.24 in an iocage jail.

Over the past few days I've been trying to upgrade to the latest 5.9.29, however keep hitting errors, which I think are caused by mongodb versions.

What's the best workaround for this ?

I've trying make package, bit it still fails... see attachment.

Any advise and help would be greatly appreciated.
 

Attachments

  • IMG_01122018_232859_(872_x_600_pixel).jpg
    IMG_01122018_232859_(872_x_600_pixel).jpg
    252.4 KB · Views: 7
Last edited:

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,974
Hi, I'm running FREENAS 11.2-RC1 currently with UniFi 5.8.24 in an iocage jail.

Over the past few days I've been trying to upgrade to the latest 5.9.29, however keep hitting errors, which I think are caused by mongodb versions.

What's the best workaround for this ?

I've trying make package, bit it still fails... see attachment.

Any advise and help would be greatly appreciated.
Did you even read this thread? The answer posted just a few replies before yours.
 

ChrisChros

Patron
Joined
Nov 24, 2018
Messages
218
Hi guys,

one question, how can I install the Unifi Controller in an iocage?

I have installed FreeNAS 11.2 RC2 and I can creat a jail but when I want to execute the following command in the shell "jexec <jailname> csh" I just receive an error message. Of course I changed "<jailname>" with the right name.
Is the "jexec" command the right one for a the iocage?
 

swil00

Cadet
Joined
Dec 1, 2018
Messages
5
Did you even read this thread? The answer posted just a few replies before yours.

Why thanks. Yes, I did read this thread, but it would seem my issue was a little different to others.

I should have pointed out that my iocage was built using 11.2, so in order to resolve my issue, I took a backup of my config, removed mongodb34-3.x.xx package and ran make install again. Worked this time not having the conflict of different mongodb versions.

I'm now running 5.9.29
 
Last edited:

swil00

Cadet
Joined
Dec 1, 2018
Messages
5
Hi guys,

one question, how can I install the Unifi Controller in an iocage?

I have installed FreeNAS 11.2 RC2 and I can creat a jail but when I want to execute the following command in the shell "jexec <jailname> csh" I just receive an error message. Of course I changed "<jailname>" with the right name.
Is the "jexec" command the right one for a the iocage?

If you have already created the jail using iocage, then instead of running "jexec <jailname> csh", try "iocage exec <jailname> csh"

The steps in this guide are the same after this.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,456

ChrisChros

Patron
Joined
Nov 24, 2018
Messages
218
If you have already created the jail using iocage, then instead of running "jexec <jailname> csh", try "iocage exec <jailname> csh"

The steps in this guide are the same after this.
Thanks for the answer, will try it later.

UPDATE:
its working. Thanks for your help.
 
Last edited:

thejamesk

Explorer
Joined
Sep 2, 2018
Messages
71
Hi

Great guide and thanks for providing it @m0nkey_ !

Unfortunately after following the video twice I still get an error when trying to start the service. Can anyone help? :)

1545569279176.png
 

Dayve

Dabbler
Joined
Nov 24, 2018
Messages
21
Hey Guys,

Thanks for the great instructions. Got everything working and transferred my Unifi setup from my Raspberry pie over to FreeNAS :)
The only thing that will not work is starting the jail on boot.

I did the "sysrc unifi_enable=YES" command and also checked the rc.conf file for enable. Not sure what I missed.

ifconfig_epair0b="DHCP"
host_hostname="Unifi Controller"
cron_flags="$cron_flags -J 15"

# Disable Sendmail by default
sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

# Run secure syslog
syslogd_flags="-c -ss"

# Enable IPv6
ipv6_activate_all_interfaces="YES"

# Enable at Boot
unifi_enable="YES"
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
Hey Guys,

Thanks for the great instructions. Got everything working and transferred my Unifi setup from my Raspberry pie over to FreeNAS :)
The only thing that will not work is starting the jail on boot.

I did the "sysrc unifi_enable=YES" command and also checked the rc.conf file for enable. Not sure what I missed.

ifconfig_epair0b="DHCP"
host_hostname="Unifi Controller"
cron_flags="$cron_flags -J 15"

# Disable Sendmail by default
sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

# Run secure syslog
syslogd_flags="-c -ss"

# Enable IPv6
ipv6_activate_all_interfaces="YES"

# Enable at Boot
unifi_enable="YES"
You check the box to start the jail on boot in the freenas UI?
 
Top