From owner-freebsd-jail@freebsd.org Mon Aug 29 08:52:11 2016 Return-Path: Delivered-To: freebsd-jail@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29EBABC77AA for ; Mon, 29 Aug 2016 08:52:11 +0000 (UTC) (envelope-from list1@gjunka.com) Received: from msa1.earth.yoonka.com (yoonka.com [185.24.122.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "msa1.earth.yoonka.com", Issuer "msa1.earth.yoonka.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id DAA25EAE; Mon, 29 Aug 2016 08:52:09 +0000 (UTC) (envelope-from list1@gjunka.com) Received: from ultrabook.yoonka.com ([10.70.1.2]) (authenticated bits=0) by msa1.earth.yoonka.com (8.15.2/8.15.2) with ESMTPSA id u7T8q7HI094504 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Mon, 29 Aug 2016 08:52:07 GMT (envelope-from list1@gjunka.com) X-Authentication-Warning: msa1.earth.yoonka.com: Host [10.70.1.2] claimed to be ultrabook.yoonka.com Subject: Re: jail not found error? To: James Gritton , freebsd-jail@freebsd.org References: <4c2fb0fd-051c-5b80-018d-e3cbf91bd56d@gjunka.com> From: Grzegorz Junka Message-ID: <5148296a-10ef-7fb1-8617-29d1fccf5a89@gjunka.com> Date: Mon, 29 Aug 2016 08:52:07 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Aug 2016 08:52:11 -0000 On 28/08/2016 23:22, James Gritton wrote: > On 2016-08-28 15:42, Grzegorz Junka wrote: >> I am trying to set up a Centos 6 jail. It fails with the following >> error: >> >> root@ultrabook:~ # service jail start centos6 >> Starting jails: centos6jls: jail "centos6" not found >> . >> >> I somehow managed to run it once by changing the start script from: >> >> exec.start = "/bin/sh /etc/rc"; >> >> to >> >> exec.start = "/etc/rc 3"; >> >> It started once but after I shut it down it shows the same error again >> wherever I am trying to start it. This is what I have configured so >> far: >> >> root@ultrabook:~ # cat /etc/jail.conf >> # Use the rc scripts to start and stop jails. Mount jail's /dev. >> >> #exec.start = "/bin/sh /etc/rc"; >> #exec.stop = "/bin/sh /etc/rc.shutdown"; >> exec.clean; >> >> allow.mount; >> mount.devfs; >> mount.fstab = "/usr/local/etc/fstab/$name"; >> devfs_ruleset = 4; >> >> path = "/j/$name"; >> host.hostname = "$name.ultrabook.yoonka.com"; >> exec.consolelog = "/var/log/jail/$name"; >> >> centos6 { >> exec.start = "/etc/rc 3"; >> ip4.addr = 127.0.2.1; >> interface = lo0; >> } >> >> >> root@ultrabook:~ # cat /usr/local/etc/fstab/centos6 >> linsys /j/centos6/sys linsysfs rw 0 0 >> linproc /j/centos6/proc linprocfs rw 0 0 >> #tmpfs /j/centos6/lib/init/rw tmpfs rw,mode=777 0 0 >> /devfs /j/centos6/dev devfs rw,ruleset=4 0 0 >> >> I was following this example: >> >> https://bluehatrecord.wordpress.com/2015/09/19/the-midnight-oil-jailing-centos6-in-freebsd-10-2/ >> >> >> but wanted to use the new configuration files. My system: >> >> root@ultrabook:~ # uname -a >> FreeBSD ultrabook.yoonka.com 10.3-RELEASE FreeBSD 10.3-RELEASE #0 >> r297264: Fri Mar 25 02:10:02 UTC 2016 >> root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 >> >> How to fix or debug this 'jail "centos6" not found' error and start >> the jail? >> >> Grzegorz > > I wonder if the jail exists as dying - does it show up in "jls -d"? > > Also, for a verbose start, try "jail -v -c centos6". That shows > commands that are run when creating the jail, and may pinpoint where > the trouble is. > > - Jamie No, 'jls -d' doesn't show anything but every time I try to start the jail new mounts from the jail's fstab are made, e.g. just after starting FreeBSD: linsysfs on /j/centos6/sys (linsysfs, local) linprocfs on /j/centos6/proc (linprocfs, local) devfs on /j/centos6/dev (devfs, local, multilabel) devfs on /j/centos6/dev (devfs, local, multilabel) Then after trying to start the jail again: linsysfs on /j/centos6/sys (linsysfs, local) linprocfs on /j/centos6/proc (linprocfs, local) devfs on /j/centos6/dev (devfs, local, multilabel) devfs on /j/centos6/dev (devfs, local, multilabel) linsysfs on /j/centos6/sys (linsysfs, local) linprocfs on /j/centos6/proc (linprocfs, local) devfs on /j/centos6/dev (devfs, local, multilabel) devfs on /j/centos6/dev (devfs, local, multilabel) After unmounting all those and trying again: root@ultrabook:/home/g # jail -v -c centos6 centos6: run command: /sbin/ifconfig lo0 inet 127.0.2.1 netmask 255.255.255.255 alias centos6: run command: /sbin/mount -t linsysfs -o rw linsys /j/centos6/sys centos6: run command: /sbin/mount -t linprocfs -o rw linproc /j/centos6/proc centos6: run command: /sbin/mount -t devfs -oruleset=4 . /j/centos6/dev centos6: jail_set(JAIL_CREATE) persist name=centos6 allow.mount devfs_ruleset=4 path=/j/centos6 host.hostname=centos6.ultrabook.yoonka.com ip4.addr=127.0.2.1 centos6: created centos6: run command in jail: /etc/rc 3 centos6: jail_set(JAIL_UPDATE) jid=3 nopersist root@ultrabook:/home/g # jls JID IP Address Hostname Path root@ultrabook:/home/g # jls -d JID IP Address Hostname Path Grzegorz