From owner-freebsd-questions@FreeBSD.ORG Fri Feb 14 15:51:23 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CABB66D0 for ; Fri, 14 Feb 2014 15:51:23 +0000 (UTC) Received: from webmail.dweimer.net (24-240-198-187.static.stls.mo.charter.com [24.240.198.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7D2D9171A for ; Fri, 14 Feb 2014 15:51:23 +0000 (UTC) Received: from www.dweimer.net (webmail [192.168.5.2]) by webmail.dweimer.net (8.14.7/8.14.7) with ESMTP id s1EFpMjc001468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 14 Feb 2014 09:51:22 -0600 (CST) (envelope-from dweimer@dweimer.net) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 14 Feb 2014 09:51:22 -0600 From: dweimer To: FreeBSD Questions Subject: jail -r & jail -R Organization: dweimer.net Mail-Reply-To: dweimer@dweimer.net Message-ID: X-Sender: dweimer@dweimer.net User-Agent: Roundcube Webmail/1.0-rc X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: dweimer@dweimer.net List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Feb 2014 15:51:23 -0000 I think I may have discovered a bug in the jail management system, if you look at the man page for jail. -r Remove the jail specified by jid or name. All jailed processes are killed, and all children of this jail are also removed. -R A variation of the -r option that removes an existing jail with- out using the configuration file. No removal-related parameters for this jail will be used - the jail will simply be removed. However I have discovered, even though -r says it can take either the jail name or jail id, if you use the id it appears to function as if you used the -R option instead, whereas using the -r option with the name correctly stops the jail with the configuration parameters from the jail.conf. I discovered this trying to figure out why the jails devfs system was not dismounting, and my exec.poststop script was not running. I discovered that if I used the name instead of id, I didn't run into this issue. Can anyone else verify that this is a bug or invalid information in man if its not, or do I have something wrong in my configuration, below is a sample configuration and steps that can be used to reproduce the issue. Example /etc/jail.conf: apache { jid = 1; host.hostname = apache.mydomainname.com; ip4.addr = 192.168.1.2; interface = em0; path = /jails/apache/10.0-r260787-2014.02.12; allow.mount.devfs; mount.devfs; allow.sysvipc; exec.start = "/bin/sh /etc/rc"; exec.stop = "/bin/sh /etc/rc.shutdown"; exec.prestart = "/jails/apache/prestart.sh"; exec.poststop = "/jails/apache/poststop.sh"; exec.consolelog = "/jails/apache/console.log"; } repeatable test scenario: jail -c apache all looks good jail -r apache all is right, jail devfs is gone, /jails/apache/proststop.sh ran. jail -c apache all looks good jail -r 1 something is wrong /jails/apache/10.0-r260787-2014.02.12/dev is still mounted /jails/apache/proststop.sh hasn't run jail is gone do manually cleanup umount /jails/apache/10.0-r260787-2014.02.12/dev execute /jails/apache/proststop.sh script jail -c apache all looks good jail -R apache As expected /jails/apache/10.0-r260787-2014.02.12/dev is still mounted /jails/apache/proststop.sh hasn't run jail is gone. -- Thanks, Dean E. Weimer http://www.dweimer.net/