Little over my head. Hoping to get Unifi Controller installed in FreeNAS.

Status
Not open for further replies.

-RYknow

Explorer
Joined
Sep 9, 2014
Messages
60
Hey all, so I'm still pretty new to FreeNAS. Ultimately what I want to do is run my Unifi controller from FreeNAS. I've never created or used a jail before, so I'm not exactly sure what I need to do.

When I try to create a jail I don't have any options for templates? Not sure that I need them. I did end up going through with it, and the jail appeared to be running (I could ping it). I was able to modify the rc.conf file to enable ssh, however I was never able to ssh to the jail.

If someone could just post a decent guide to creating jails and then getting the unifi controller installed within that jail, that would be great.

Thanks,
-RYknow
 
Last edited by a moderator:

Huib

Explorer
Joined
Oct 11, 2016
Messages
96
Hi -RYknow.
I'm afraid I'm quite new to FreeNAS also.
I can't help you with Unifi (don't know what it is) but I can give you a few tips.
I just treated it as a fresh minimal linux (sorry for the foul language guys) installation and used pkg to install what I needed.
You don't need to ssh into the jail. You can ssh into your main box and then change into the jail from there, OR you can just select the jail you made in the GUI and then select terminal at the bottom.

If you realy want to ssh directly into your jail change:
sshd_enable="NO" to "YES" in /etc/rc.conf and start ssh by executing:
service sshd start in the terminal from within the jail.

good luck!
 
Last edited by a moderator:

-RYknow

Explorer
Joined
Sep 9, 2014
Messages
60
If you realy want to ssh directly into your jail change:
sshd_enable="NO" to "YES" in /etc/rc.conf and start ssh by executing:
service sshd start in the terminal from within the jail.

Thanks for the quick response. Yeah, I had modified the rc.conf file within the jail directory (ssh'ed into my FreeNAS box), but I still wasn't able to ssh to the IP I had set for the jail. Just kept giving me an error saying it couldn't connect.
 
Last edited by a moderator:

HardDrv00

Dabbler
Joined
Dec 2, 2016
Messages
13
When I try to create a jail I don't have any options for templates?

To create a standard jail, the default Template option, "----" will create a standard jail. I don't know why it is labeled as such but it is. This creates a FreeBSD based environment.

...
I was able to modify the rc.conf file to enable ssh, however I was never able to ssh to the jail.

If someone could just post a decent guide to creating jails and then getting the unifi controller installed within that jail, that would be great.

This thread, https://forums.freenas.org/index.ph...nd-or-unifi-software-in-a-freenas-jail.40233/ is a good guide. It can be found by Googling, "FreeNAS unifi", first link.

As far as accessing the jails, I SSH (with Putty) into FreeNAS and then use jls and jexec commands. The web UI "Shell" is not good for serious work. If you haven't already, the SSH service for FreeNAS must be enabled and configured. Someone else can chime in but I don't think editing rc.conf for the host is needed for this task. AFAIK, everything for SSH setup is in GUI.
 

Huib

Explorer
Joined
Oct 11, 2016
Messages
96
I agree with HardDrv00 regarding jls and jexec, but direct ssh access should be possible according to the manual so for what it's worth.....

https://doc.freenas.org/9.3/freenas_jails.html (or the included guide from the gui) did you see point 13.2.1.1 regarding ssh and jails in the documentation?
You might have to add some rights.
 
Last edited:

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
It's easy. Create a new jail, call it 'unifi' or something and open the jail console.

Code:
portsnap fetch extract
cd /usr/ports/net-mgmt/unifi5
make config-recursive	 ## select all defaults
make install			  ## go get a beer (or two), this will take a while.
sysrc unifi_enable=YES
service unifi start
 

Huib

Explorer
Joined
Oct 11, 2016
Messages
96
And that's why m0nkey is a guru and I am a n00b:D
 

-RYknow

Explorer
Joined
Sep 9, 2014
Messages
60
It's easy. Create a new jail, call it 'unifi' or something and open the jail console.

Code:
portsnap fetch extract
cd /usr/ports/net-mgmt/unifi5
make config-recursive	 ## select all defaults
make install			  ## go get a beer (or two), this will take a while.
sysrc unifi_enable=YES
service unifi start

Slowly but surely I'm making progress! I appreciate your post! I'm excited to get this setup hopefully! Google led me to believe I needed SSH access to the jail. I was stumbling to make that happen. Then when you said "and open the jail console" I remembered seeing some icons at the bottom of the jails screen. Sure enough, there was the shell icon. Currently downloading a bunch of patches. I'll report back in a bit.

I do appreciate the community here. I love freenas and want to dig much deeper into it. The community is large and quick to respond! Thank you all!

-RYknow
 

-RYknow

Explorer
Joined
Sep 9, 2014
Messages
60
So you weren't kidding about it taking awhile. I just ate dinner, got the kids to bed and it's still plugging away. I did however just see this during the install.

Code:
===>  Configuring for maven3-3.0.5																								 
===>  Staging for maven3-3.0.5																									 
===>   maven3-3.0.5 depends on executable: mvn - not found																		 
===>   NOTICE:																													 
																																	
The maven-wrapper port currently does not have a maintainer. As a result, it is													 
more likely to have unresolved issues, not be up-to-date, or even be removed in													 
the future. To volunteer to maintain this port, please create an issue at:


Wonder if this is something I should be worried about?

-RYknow
 

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
Hmm, odd. I just tried building that port and it worked without any trouble. When it was compiling, did it finish or did the compile die?
 

HardDrv00

Dabbler
Joined
Dec 2, 2016
Messages
13
Hmm, odd. I just tried building that port and it worked without any trouble. When it was compiling, did it finish or did the compile die?

After @m0nkey_ posted the ports method, I tried it in a test jail. After an hour or so, mine failed during compilation from what I gather:

Code:
...
Creating trace.make ...
Creating sa.make ...
Creating dtrace.make ...
gmake[11]: Leaving directory '/usr/ports/java/openjdk8/work/openjdk/build/bsd-x86_64-normal-server-release/hotspot/bsd_amd64_compiler2/product'
gmake[10]: Leaving directory '/usr/ports/java/openjdk8/work/openjdk/build/bsd-x86_64-normal-server-release/hotspot'
gmake[10]: Entering directory '/usr/ports/java/openjdk8/work/openjdk/build/bsd-x86_64-normal-server-release/hotspot/bsd_amd64_compiler2/product'
gmake[11]: Entering directory '/usr/ports/java/openjdk8/work/openjdk/build/bsd-x86_64-normal-server-release/hotspot/bsd_amd64_compiler2/product'
gmake[11]: *** No rule to make target '/usr/ports/java/openjdk8/work/openjdk/hotspot/src/cpu/amd64/vm/x86_64.ad', needed by '../generated/adfiles/bsd_x86_64.ad'.  Stop.
gmake[11]: *** Waiting for unfinished jobs....
gmake[11]: Leaving directory '/usr/ports/java/openjdk8/work/openjdk/build/bsd-x86_64-normal-server-release/hotspot/bsd_amd64_compiler2/product'
gmake[10]: *** [/usr/ports/java/openjdk8/work/openjdk/hotspot/make/bsd/makefiles/top.make:91: ad_stuff] Error 2
gmake[10]: Leaving directory '/usr/ports/java/openjdk8/work/openjdk/build/bsd-x86_64-normal-server-release/hotspot/bsd_amd64_compiler2/product'
gmake[9]: *** [/usr/ports/java/openjdk8/work/openjdk/hotspot/make/bsd/Makefile:294: product] Error 2
gmake[9]: Leaving directory '/usr/ports/java/openjdk8/work/openjdk/build/bsd-x86_64-normal-server-release/hotspot'
gmake[8]: *** [Makefile:231: generic_build2] Error 2
gmake[8]: Leaving directory '/usr/ports/java/openjdk8/work/openjdk/hotspot/make'
gmake[7]: *** [Makefile:177: product] Error 2
gmake[7]: Leaving directory '/usr/ports/java/openjdk8/work/openjdk/hotspot/make'
gmake[6]: *** [HotspotWrapper.gmk:45: /usr/ports/java/openjdk8/work/openjdk/build/bsd-x86_64-normal-server-release/hotspot/_hotspot.timestamp] Error 2
gmake[6]: Leaving directory '/usr/ports/java/openjdk8/work/openjdk/make'
gmake[5]: *** [/usr/ports/java/openjdk8/work/openjdk//make/Main.gmk:113: hotspot-only] Error 2
gmake[5]: Leaving directory '/usr/ports/java/openjdk8/work/openjdk'
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[4]: stopped in /usr/ports/java/openjdk8
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/java/openjdk8
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/devel/maven3
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/archivers/snappy-java
*** Error code 1

Stop.
make: stopped in /usr/ports/net-mgmt/unifi5


root@test:

After it failed, I found Mongo but did not find a UniFi install. I am currently trying the MAKE_JOBS_UNSAFE=yes option. This of course is taking forever.

I did notice this ports method used 13GiB in a jail versus 2GiB with selective package installs here.

FreeNAS-9.10.1-U4
Supermicro X10SL7-F | Xeon E3-1231 v3 | 32GB DDR3L ECC 1600
(4) 4TB WD Red in Z2
 

-RYknow

Explorer
Joined
Sep 9, 2014
Messages
60
So I just woke up, and the machine apparently still hasn't finished. I'm going to assume it bombed. I have text that continues to scroll through and I see purple, white, and green text. It's scrolling fairly quickly, but I do see the word warning often. I just hit ctrl C to cancel. Here is what I currently see.

Code:
to'size_t' [-Wsign-conversion]:'u2'																								
'intptr_t'(aka 'unsigned short')																								   
[-Wconversion]91   int			   get_general_index(uint aidx)		{ return alias_type(aidx)->general_index(); }(aka 'unsigne
d long')																															
:	 field()->set_name_index(index);	  /usr/ports/java/openjdk7/work/openjdk/hotspot/src/share/vm/oops/cpCacheOop.hppinteger: 46
0: 24																															   
																 ~~~~~~~~~~ ^~~~precision:										 
  [-Wsign-conversion]:																											 
'long'	  _length = m->exception_table_length();																				
			  ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~(aka 'long')																			 
	~~~~~				   ^~~~~																								   
towarning : warning'int'  : [-Wshorten-64-to-32]																					
implicit	if (ZapResourceArea) memset(_hwm, badResourceValue, _max - _hwm);[-Wsign-conversion]									
																																	
conversion						 ~~~~~~						 ~~~~~^~~~~~	int imm8 = target - (address) &disp[1]; implicit   
conversion		~~~~   ~~~~~~~^~~~~~~~~~~~~~~~~~~~																			  
																																	
loses																															   
integer																															
	  precision: 'long' to 'int' [-Wshorten-64-to-32]																			   
loses/usr/ports/java/openjdk7/work/openjdk/hotspot/src/cpu/x86/vm/assembler_x86.inline.hpp	return markOop(mask_bits(value(), ~epo
ch_mask_in_place) | (epoch << epoch_shift));:																					   
50:				   ~~~~~~~~~ ^~~~~~~24 :																						
integerwarning:																													 
	  precision:implicit  'long'conversion  toloses																				 
  int nul_chk_table_size() const				  { return			nul_chk_table_end() -			nul_chk_table_begin(); }	 
																																	
integer'int'													 ~~~~~~			~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~[-Wshorten-64-to-32]																										   
																																	
precision: 'long' to 'int' [-Wshorten-64-to-32]																					 
/usr/ports/java/openjdk7/work/openjdk/hotspot/src/share/vm/oops/fieldStreams.hpp:188	int cpc_index = (e - base());:			 
34		~~~~~~~~~	~~^~~~~~~~:																								 
	 in^Cm gmake[13]: *** [/usr/ports/java/openjdk7/work/openjdk/hotspot/make/bsd/makefiles/rules.make:151: cmsCollectorPolicy.o] In
terrupt																															 
gmake[13]: *** [/usr/ports/java/openjdk7/work/openjdk/hotspot/make/bsd/makefiles/rules.make:151: cmsAdaptiveSizePolicy.o] Interrupt
gmake[13]: *** [/usr/ports/java/openjdk7/work/openjdk/hotspot/make/bsd/makefiles/rules.make:151: classify.o] Interrupt			 
gmake[13]: *** [/usr/ports/java/openjdk7/work/openjdk/hotspot/make/bsd/makefiles/rules.make:151: classes.o] Interrupt			   
gmake[13]: *** [/usr/ports/java/openjdk7/work/openjdk/hotspot/make/bsd/makefiles/rules.make:151: classLoadingService.o] Interrupt   
gmake[13]: *** [/usr/ports/java/openjdk7/work/openjdk/hotspot/make/bsd/makefiles/rules.make:151: classLoader.o] Interrupt		   
gmake[13]: *** [/usr/ports/java/openjdk7/work/openjdk/hotspot/make/bsd/makefiles/rules.make:151: classFileStream.o] Interrupt	   
gmake[13]: *** [/usr/ports/java/openjdk7/work/openjdk/hotspot/make/bsd/makefiles/rules.make:151: classFileParser.o] Interrupt	   
gmake[12]: *** [/usr/ports/java/openjdk7/work/openjdk/hotspot/make/bsd/makefiles/top.make:129: the_vm] Interrupt					
gmake[11]: *** [/usr/ports/java/openjdk7/work/openjdk/hotspot/make/bsd/Makefile:292: product] Interrupt							 
gmake[10]: *** [Makefile:192: generic_build2] Interrupt																			 
gmake[9]: *** [Makefile:151: product] Interrupt																					 
gmake[8]: *** [make/hotspot-rules.gmk:114: hotspot-build] Interrupt																 
gmake[7]: *** [Makefile:251: build_product_image] Interrupt																		 
																																	
root@unifi:/usr/ports/net-mgmt/unifi5 #


Thats what I see without scrolling back. Not sure how to scroll back in this shell?

-RYknow
 

Huib

Explorer
Joined
Oct 11, 2016
Messages
96
RYknow,

You should really consider using ssh to get into your main box (host)
Once you are there you can type jls

This will give you something like this:
Code:
[root@media] ~# jls
   JID  IP Address	  Hostname					  Path
	 1  -			   Plex						  /mnt/D/jails/Plex
	 3  -			   ports						 /mnt/D/jails/ports

If I would like to admin my Plex jail you can see that this is jail number 1 (JID)

Code:
[root@media] ~# jexec 1
root@Plex:/ # ls
.cshrc		  boot			libexec		 rescue		  tmp
.profile		dev			 media		   root			usr
COPYRIGHT	   etc			 mnt			 sbin			var
bin			 lib			 proc			sys

and now your ssh session is connected to your jail (see the changed prompt before the ls command).
This is much more friendly to use then the shell you can open from the jails screen in the GUI.
When using Putty you could even log your session to a text file for later inspection.

use exit to return to your main box when done in your jail.

Regards,
Huib
 

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
So I just woke up, and the machine apparently still hasn't finished. I'm going to assume it bombed. I have text that continues to scroll through and I see purple, white, and green text. It's scrolling fairly quickly, but I do see the word warning often. I just hit ctrl C to cancel. Here is what I currently see.
That's normal output from the openjdk build.
 

-RYknow

Explorer
Joined
Sep 9, 2014
Messages
60
That's normal output from the openjdk build.

OK, that makes me feel little better. At this point should I just proceed with the install and see where I end up? As in;

Code:
sysrc unifi_enable=YES
service unifi start


-RYknow
 

-RYknow

Explorer
Joined
Sep 9, 2014
Messages
60
So I tried to proceed. First with jls, which resulted in;
Code:
  JID  IP Address  Hostname  Path
  2  -  unifi  /mnt/Primary/jails/unifi

Then I tried sudo sysrc unifi_enable=YES
Code:
Password:
unifi_enable:  -> YES

Then sudo service unifi start
Then ended up with;
Code:
unifi does not exist in /etc/rc.d or the local startup
directories (/etc/ix.rc.d /usr/local/etc/rc.d)


Any suggestions?
 
Last edited:

-RYknow

Explorer
Joined
Sep 9, 2014
Messages
60
I ssh'd into the box, and and ran sudo jexec 2, followed by ls -l, and got kinda what I was expecting.
Code:
total 386
-rw-r--r--  2 root  wheel  966 Mar 24  2016 .cshrc
-rw-r--r--  2 root  wheel  254 Mar 24  2016 .profile
-r--r--r--  1 root  wheel  6197 Mar 24  2016 COPYRIGHT
drwxr-xr-x  2 root  wheel  47 Mar 24  2016 bin
drwxr-xr-x  8 root  wheel  50 Mar 24  2016 boot
dr-xr-xr-x  11 root  wheel  512 Jan 22 13:58 dev
drwxr-xr-x  23 root  wheel  107 Jan 22 23:18 etc
drwxr-xr-x  3 root  wheel  52 Mar 24  2016 lib
drwxr-xr-x  3 root  wheel  5 Mar 30  2016 libexec
drwxr-xr-x  2 root  wheel  2 Mar 24  2016 media
drwxr-xr-x  2 root  wheel  2 Mar 24  2016 mnt
dr-xr-xr-x  1 root  wheel  0 Jan 23 17:34 proc
drwxr-xr-x  2 root  wheel  146 Mar 24  2016 rescue
drwxr-xr-x  2 root  wheel  7 Jan 22 14:09 root
drwxr-xr-x  2 root  wheel  132 Mar 24  2016 sbin
lrwxr-xr-x  1 root  wheel  11 Mar 24  2016 sys -> usr/src/sys
drwxrwxrwt  7 root  wheel  7 Jan 23 03:56 tmp
drwxr-xr-x  15 root  wheel  15 Mar 24  2016 usr
drwxr-xr-x  26 root  wheel  26 Jan 22 17:34 var

Then I tried to backtrack a bit and tried so see if the unifi folder was still there from earlier. cd /usr/ports/net-mgmt/unifi5. And I ended up getting;
Code:
/usr/ports/net-mgmt/unifi5: No such file or directory.

I'm not sure if after doing a make install, it is normal for it to no longer be there? Anyway, Just wondering if I am better off wiping this jail, and starting from scratch? Maybe try the method HardDrv00 mentioned earlier?

Any input?
-RYknow
 
Last edited:

KevDog

Patron
Joined
Nov 26, 2016
Messages
462
Possibly

sudo portsnap fetch update

This will update your ports collection.

Then
cd /usr/ports
make search name=unifi5
 

-RYknow

Explorer
Joined
Sep 9, 2014
Messages
60
Possibly

sudo portsnap fetch update

Here is the result;
Code:
sudo portsnap fetch update
sudo: portsnap: command not found


-RYknow
 
Status
Not open for further replies.
Top