Page 1 of 1

First time jail creation

Posted: 21 Dec 2012 19:00
by mrjrussell
I followed the how to create a jail.

http://wiki.nas4free.org/doku.php?id=do ... owto:jails

when i type jls the responce i get is

Code: Select all

# JID  IP Address      Hostname                      Path
No jails are listed.

I am stuck, where should I start looking ?

also the FETCH

Code: Select all

 fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/`uname -m`/`uname -m`/`uname -r | cut -d- -f1-2`/base.txz
I got a error for CUT wrong so I typed out the address after verifying it online and was able to fetch the files.

Re: First time jail creation

Posted: 21 Dec 2012 19:14
by raulfg3
mrjrussell wrote:lso the FETCH

Code: Select all

 fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/`uname -m`/`uname -m`/`uname -r | cut -d- -f1-2`/base.txz
I got a error for CUT wrong so I typed out the address after verifying it online and was able to fetch the files.
This works fine in the latest Nas4free 9.1.0.1.573 because is based on BSD 9.1 release and do not work in previos 9.1RC

Please upgrade first to latest N4F:

Code: Select all

login as: root
root@192.168.1.17's password:
Last login: Fri Dec 21 18:51:48 2012
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
        The Regents of the University of California.  All rights reserved.

Welcome to NAS4Free!
rnas:~# cd /tmp
rnas:/tmp# ls
config.cache                            sess_13e805b8df25d69b412f175bb9388232   sess_bb6cc5a23b714ecf2e9598a902abc006
jail.iOw1q4gY                           sess_82b00933041c954ad290f7adc4a6ed1f   sess_feb139a4cf94530023c3b329b37256fb
sess_0294a01cb38f339793800a6a74ecc204   sess_85aa67f3178d0330bc1cd235de3ce885
sess_0fdbc28475065bae7052550b7184f54b   sess_877865f0c3c2d3b517a4c6c51f0a731b
rnas:/tmp# fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/`uname -m`/`uname -m`/`uname -r | cut -d- -f1-2`/base.txz
base.txz                                      100% of   57 MB  262 kBps 00m00s
rnas:/tmp# ls -l
total 58564
-rw-r--r--  1 root  wheel  59854248 Dec  4 11:09 base.txz
-rw-------  1 root  wheel     29045 Dec 21 18:49 config.cache
drwx------  2 root  wheel       512 Nov 24 21:31 jail.iOw1q4gY
-rw-------  1 www   wheel       119 Dec 20 14:45 sess_0294a01cb38f339793800a6a74ecc204
-rw-------  1 www   wheel      2648 Dec 20 13:26 sess_0fdbc28475065bae7052550b7184f54b
-rw-------  1 www   wheel       119 Dec 20 20:48 sess_13e805b8df25d69b412f175bb9388232
-rw-------  1 root  wheel        88 Dec 18 21:38 sess_82b00933041c954ad290f7adc4a6ed1f
-rw-------  1 root  wheel        88 Dec 20 20:35 sess_85aa67f3178d0330bc1cd235de3ce885
-rw-------  1 root  wheel        88 Dec 19 21:42 sess_877865f0c3c2d3b517a4c6c51f0a731b
-rw-------  1 www   wheel      1050 Dec 20 15:22 sess_bb6cc5a23b714ecf2e9598a902abc006
-rw-------  1 root  wheel        88 Dec 20 15:40 sess_feb139a4cf94530023c3b329b37256fb
rnas:/tmp#


PD: If you do not want to upgrade: viewtopic.php?f=72&t=1732&p=8404

Re: First time jail creation

Posted: 21 Dec 2012 19:25
by mrjrussell
I was able to fetch and tar the files though so im not sure thats the issue .

Re: First time jail creation

Posted: 21 Dec 2012 19:32
by raulfg3
sorry , in this case I do not understad your question, I figure that fetch command failed for you.


At this moment I am creating a new jail to test my "howto install minidlna into a jail" I actually use N4F 9.1.0.1.573, so I test the wiki procedure in a few minutes.

In the middle revise config files and result of comand jail start

Re: First time jail creation

Posted: 21 Dec 2012 19:45
by mrjrussell
raulfg3 wrote:sorry , in this case I do not understad your question, I figure that fetch command failed for you.


At this moment I am creating a new jail to test my "howto install minidlna into a jail" I actually use N4F 9.1.0.1.573, so I test the wiki procedure in a few minutes.

In the middle revise config files and result of comand jail start

I was able to fetch the files from teh correct location and tar then as the instructions said to do

I got no errors, except the unexpected output of # jls

Re: First time jail creation

Posted: 21 Dec 2012 20:06
by raulfg3
but jls is at the end of jail creation and start of it, please provide your IP, and con/rc.conf.local to revise that is correct.

mine if you want to compare is (for 3 jails, named proto, upnp and minidlna):

Code: Select all

jail_enable="YES"                       # enable jails YES|NO
jail_list="proto upnp minidlna"                 # name of the jails to start "proto www..."
jail_proto_rootdir="/jail/proto"        # path to our jail
jail_proto_hostname="proto"             # hostname
jail_proto_ip="192.168.1.201"           # ip of the jail
jail_proto_interface="em0"              # Network Interface to use,replace on your NAS interface name
jail_proto_devfs_enable="YES"           # use devfs
jail_proto_mount_enable="YES"           # mount YES|NO
jail_proto_fstab="/jail/conf/fstab.proto"       # File with Filesystems to mount
jail_upnp_rootdir="/jail/upnp"
jail_upnp_hostname="upnp"
jail_upnp_ip="192.168.1.202"
jail_upnp_interface="em0"
jail_upnp_devfs_enable="YES"
jail_upnp_mount_enable="YES"
jail_upnp_fstab="/jail/conf/fstab.upnp"
jail_minidlna_rootdir="/jail/minidlna"           # path to our jail
jail_minidlna_hostname="minidlna"       # hostname
jail_minidlna_ip="192.168.1.203"                # ip of the jail
jail_minidlna_interface="em0"           # Network Interface to use, replace on your NAS interface name
jail_minidlna_devfs_enable="YES"                # use devfs
jail_minidlna_mount_enable="YES"                # mount YES|NO
jail_minidlna_fstab="/jail/conf/fstab.minidlna" # File with Filesystems to mount

PD. what happend when you type:

Code: Select all

/jail/conf/jail_start
<- this is the command that autostart jails when you reboot yor nas, but you can execute first time to start jail to test that works fine.


Edit: confirmed, jail works if you use wiki:

Code: Select all

rnas:/jail/minidlna/mnt# jls
   JID  IP Address      Hostname                      Path
     5  192.168.1.201   proto                         /jail/proto
     6  192.168.1.202   upnp                          /jail/upnp
     7  192.168.1.203   minidlna                      /jail/minidlna
rnas:/jail/minidlna/mnt#

Re: First time jail creation

Posted: 23 Dec 2012 00:24
by misterredman
Seems that in the the jail howto the command to start the jail after creation is "missing". So you add the script to postinit but nowhere is mentioned you must run jail_start manually or reboot (although adding the script could be seen as a hint to reboot).

After

Code: Select all

# chmod 755 /jail/conf/jail_start
we should add

Code: Select all

# /jail/conf/jail_start
to actually start the jail (or ask for a reboot).

Re: First time jail creation

Posted: 23 Dec 2012 01:48
by mrjrussell
/jail/conf/rc.conf.local

Code: Select all

### EXAMPLE - MODIFY TO FIT YOUR NEEDS ###
jail_enable="YES"	# enable jails YES|NO
jail_list="proto"	# name of the jails to start "proto www..."
jail_proto_rootdir="/mnt/data/jail/proto"		# path to our jail
jail_proto_hostname="proto.domain.local"	# hostname 
jail_proto_ip="192.168.1.201"		# ip of the jail 
jail_proto_interface="em0"		# Network Interface to use, replace on your NAS interface name
jail_proto_devfs_enable="YES"		# use devfs 
jail_proto_mount_enable="YES"		# mount YES|NO 
jail_proto_fstab="mnt/data/jail/conf/fstab.proto"	# File with Filesystems to mount
attached is the image of
# jail_start
# jls

I am using 9.0.0.1 - Sandstorm (revision 249)
and used files from ftp://ftp.freebsd.org/pub/FreeBSD/relea ... 0-RELEASE/

Re: First time jail creation

Posted: 23 Dec 2012 08:48
by raulfg3
first question: do you have a pool named data?
remember that you need to sustitute data by your pool name: line

Code: Select all

mount_nullfs /mnt/data/jail /jail
fails because probably your mount have other name, in my case :

Code: Select all

mount_nullfs /mnt/NAS-A/jail /jail


second ; this line jail_proto_rootdir="/mnt/data/jail/proto" must be jail_proto_rootdir="/jail/proto" because you mount /jail in your root to easy access

PD: better that a jpg of your shell output use copy&Paste

Re: First time jail creation

Posted: 25 Dec 2012 00:14
by mrjrussell
I tried every variant and could not get it to work with 9.0 .

I installed (on a vbox) 9.1.0.1 - Sandstorm (revision 457) And was able to get it to work

also I could not get the howto file instructions :
# fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/`uname -m`/`uname -m`/`uname -r | cut -d- -f1-2`/base.txz:

I fetched the files manually from here.
ftp://ftp.freebsd.org/pub/FreeBSD/relea ... 1-RELEASE/

I like to test to make sure everything works.. so i installed subsonic first. the installer could not locate the files so I modified the script adding the same above source. I had a bit of a problem installing subsonic on the vbox

Re: First time jail creation

Posted: 25 Dec 2012 09:02
by raulfg3
Sorry to take a long time to understand your problem, Jls, jexec, and other Jail commands are added by daoyama on 9.1 branch, so Jls can't work on 9.0.

You need to update your current 9.0 to latest 9.1 to use jails.