Page 1 of 1

Can't install new SW to a full Jail

Posted: 08 Oct 2013 01:12
by spargopolis
Fairly new to nas4free, freeBSD, and very new to Jails.

My host OS has nas4free 9.1 installed and running, I have a single hard drive mapped to /mnt running ZFS.

I installed the "theBrig". All seemed to go well. I have two jails both running nas4free 9.1. One is slim and the other is full. Both run, but I have stopped the slim one. The full jail is mapped to "/mnt/MediaPool0/Jail/gitJailFull" (if I understand correctly, this is where it's virtual "/" is. The full jail runs fine, web interface works, SSH works, SMB works, etc.

I believe that having a full jail will allow me to install addition S/W (since this is what I would like to do), but please correct me if I'm wrong. Specifically I want to install a git server and possibly other apps in the full jail. When I try, I get a similar behaviour to when I tried to install git on the host nas4free image, which is to say lots of errors. i.e.

Code: Select all

nas4free: git_pkgs # pkg_add -r git
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.1-release/Latest/git.tbz... Done.
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.1-release/All/perl-5.14.2_2.tbz...
/var: write failed, filesystem is full
lib/perl5/5.14.2/pod/perldiag.pod: Write failed
lib/perl5/5.14.2/pod/perldsc.pod: Write failed
lib/perl5/5.14.2/pod/perlebcdic.pod: Write to restore size failed
lib/perl5/5.14.2/pod/perlembed.pod: Write to restore size failed
lib/perl5/5.14.2/pod/perlepoc.pod: Write to restore size failed
... lots of these
What I don't understand are these "filesystem full" errors, when the entire jailed nas is supposedly mounted on "mnt/MediaPool0/Jail/gitJailFull", which should map to my physical hard drive, not the embedded USB stick? Note the hard drive reports 366 GB free.

Thanks for your interest. Any help would be appreciated.

Re: Can't install new SW to a full Jail

Posted: 08 Oct 2013 01:21
by spargopolis
A bit more info... which confirms the physical location of the full jail.

Code: Select all

hostnas: ~ # jls
   JID  IP Address      Hostname                      Path
     7  192.168.1.202   gitJailFull.local             /mnt/MediaPool0/Jail/gitJailFull

Re: Can't install new SW to a full Jail

Posted: 08 Oct 2013 07:46
by raulfg3
do you log inside your jail?

eg: jexec 7 csh in your example?

Re: Can't install new SW to a full Jail

Posted: 08 Oct 2013 08:26
by alexey123
This line

Code: Select all

nas4free: git_pkgs # pkg_add -r git
say: You tried install software from main host. This way not correct. For install software into jail, you need type commands inside a jail
As Raul says - enter into jail

Code: Select all

jexec gitJailFull csh
and install software

Code: Select all

pkg_add -r git

Re: Can't install new SW to a full Jail

Posted: 12 Oct 2013 02:41
by spargopolis
Hi Guys,

Sorry for the slow reply; my Internet has been down.

Thanks for the suggestions. Earlier I thought by SSH'ing in the Jail IP address I would already be running inside the Jail. But apparently not.

I typed:

Code: Select all

spargonas: ~ # jls
   JID  IP Address      Hostname                      Path
     7  192.168.1.202   gitJailFull.local             /mnt/MediaPool0/Jail/gitJailFull
spargonas: ~ # jexec 7 csh
root@gitJailFull:/ # pwd
/
root@gitJailFull:/ # pkg_add -r git
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.1-release/Latest/git.tbz... Done.
...
Removing stale symlinks from /usr/bin...
    Skipping /usr/bin/perl
    Skipping /usr/bin/perl5
Done.
...
root@gitJailFull:/ # git --version
git version 1.8.0
So cool git is installed.

Which brings up the next question :-). The data I want to place under git source control physically resides on my hard disk here: "/mnt/media/...". Since my Jail is mounted/rooted at "/mnt/MediaPool0/Jail/gitJailFull", as far as I know I can't see the data. Is there any way to make the data accessable to this Jail (or another one I create), or does it need copied to under the root of the Jail? Would a symbolic link possibly work? Sorry for the noob question.

Re: Can't install new SW to a full Jail

Posted: 12 Oct 2013 08:59
by raulfg3
spargopolis wrote: Is there any way to make the data accessable to this Jail
yes, configte fstab, see my example: viewtopic.php?f=79&t=3894#p20142

Re: Can't install new SW to a full Jail

Posted: 12 Oct 2013 10:22
by alexey123
Also you can simple copy needed data from nas4free, if it have small size.

Re: Can't install new SW to a full Jail

Posted: 16 Oct 2013 03:33
by spargopolis
Hi,

My earlier question was a bit premature. It turns out I had added some mount points in the fstab already as per the instructions to install TheBrig... I had just forgotten, i.e.

Code: Select all

spargonas: ~ # ll /etc/fs*
-rw-r--r--  1 root  wheel   50 Oct  7 01:52 /etc/fstab
-rw-r--r--  1 root  wheel  376 Oct  7 05:42 /etc/fstab.gitJail
-rw-r--r--  1 root  wheel  308 Oct  7 05:42 /etc/fstab.gitJailFull
spargonas: ~ # cat /etc/fstab.gitJailFull
/mnt/media/pictures /mnt/media/Jail/gitJailFull/mnt/media/pictures nullfs rw 0 0
/mnt/media/videos /mnt/media/Jail/gitJailFull/mnt/media/videos nullfs rw 0 0 
/mnt/media/music /mnt/media/Jail/gitJailFull/mnt/media/music nullfs rw 0 0 
/mnt/MediaPool0/Jail/conf/ports/ /mnt/MediaPool0/Jail/gitJailFull/usr/ports/ nullfs ro 0 0
Note that I have many subfolders under each of these mount source points.. e.g.

Code: Select all

spargonas: ~ # ll /mnt/media/pictures/
total 17
drwxrwxrwx  45 root  wheel  45 Sep  7 03:42 2010/
drwxrwxrwx  43 root  wheel  43 Sep  7 04:39 2011/
drwxrwxrwx  79 root  wheel  79 Sep  7 08:49 2012/
drwxrwxrwx  58 root  wheel  58 Oct 13 02:51 2013/
drwxrwxrwx   2 root  wheel   2 Sep  4 06:50 2014/
Now when I enter the Jail, I do see the mount point, however I don't have any of the content below this. i.e.

Code: Select all

spargonas: ~ # jls
   JID  IP Address      Hostname                      Path
    1  192.168.1.202   gitJailFull.local             /mnt/MediaPool0/Jail/gitJailFull
spargonas: ~ # jexec 1 tcsh
root@gitJailFull:/ # ll /mnt/media/pictures/
total 0
Is there a way to create a recursive mount point, such that I see all the files/folders below the ? From what I understand of the mount command, this should be the default behaviour.

Re: Can't install new SW to a full Jail

Posted: 16 Oct 2013 07:50
by raulfg3
fstab and jail are not equal:
/mnt/media/pictures /mnt/media/Jail/gitJailFull/mnt/media/pictures nullfs rw 0 0
see: /mnt/media/pictures is where you have your original share folder pictures.
/mnt/media/Jail/gitJailFull/mnt/media/pictures is the folder pictures inside the jail gitJailFull , where you want to mount pictures. (But is incorrect because is not in the correct path of jail)

but you say that do not see in: /mnt/MediaPool0/Jail/gitJailFull ; see MediaPool0


to work your fstab must be:

Code: Select all

/mnt/media /mnt/MediaPool0/Jail/gitJailFull/mnt/media nullfs rw 0 0
And you must create folder media prior to work:

Code: Select all

mkdir: /mnt/MediaPool0/Jail/gitJailFull/mnt/media
from shell outside the jail, once done , stop your jail and re-start.

this time inside the jail if you go to

Code: Select all

cd /mnt/media
and do

Code: Select all

ls- l
you can see your pictures, videos and music folders correctly mounted.

Re: Can't install new SW to a full Jail

Posted: 18 Oct 2013 03:18
by spargopolis
Hi,

Yes that was the problem, thanks very much! Now I can see all the media content inside the Jail, and have git installed.

Hopefully my last issue is this; I want to use git on my LAN to backup data. Therefore I require network access to the Jail. When I try:

Code: Select all

root@gitJailFull:/ # ping 192.168.1.101
ping: socket: Operation not permitted
root@gitJailFull:/ # whoami
root
root@gitJailFull:/ # which ping
/sbin/ping
root@gitJailFull:/ # 
I did do some Googling and I think I need to update my /etc/rc.conf file. It's currently set to:

Code: Select all

root@gitJailFull:/ # cat /etc/rc.conf 
sendmail_enable="NONE"
syslogd_flags="-ss"
rpc_bind="NO"
network_interfaces=""
cron_flags="$cron_flags -J 15"
root@gitJailFull:/ # 
A pointer to a thread on this subject would be great. Thanks very much for your help!

Re: Can't install new SW to a full Jail

Posted: 18 Oct 2013 07:28
by raulfg3
you need to active global atribute: Route only TCP/IP within a jail
in the brig webgui.
jail1.jpg