From nobody@FreeBSD.org  Tue Jan 31 19:29:22 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id B173F16A420
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 31 Jan 2006 19:29:22 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7E31D43D46
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 31 Jan 2006 19:29:22 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k0VJTMPR043377
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 31 Jan 2006 19:29:22 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k0VJTM5g043376;
	Tue, 31 Jan 2006 19:29:22 GMT
	(envelope-from nobody)
Message-Id: <200601311929.k0VJTM5g043376@www.freebsd.org>
Date: Tue, 31 Jan 2006 19:29:22 GMT
From: Bruce Becker <hostmaster@whois.gts.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: /usr/local/etc/rc.d scripts with dependencies don't run inside jail
X-Send-Pr-Version: www-2.3

>Number:         92636
>Category:       conf
>Synopsis:       [patch] /usr/local/etc/rc.d scripts with dependencies don't run inside jail
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    dougb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 31 19:30:04 GMT 2006
>Closed-Date:    Sat Feb 25 01:31:29 GMT 2006
>Last-Modified:  Sat Feb 25 01:31:29 GMT 2006
>Originator:     Bruce Becker
>Release:        6.0
>Organization:
G.T.S.
>Environment:
FreeBSD tarantula.web.ca 6.0-STABLE FreeBSD 6.0-STABLE #0: Sun Jan 22 23:25:49 EST 2006     root@tarantula:/usr/obj/usr/src/sys/TARANTULA  amd64

>Description:
conf files with dependencies such as "# BEFORE: LOGIN" don't get run from /usr/local/etc/rc.d/
>How-To-Repeat:
create conf file /usr/local/etc/rc.d/test in the jail -


#!/bin/sh

# BEFORE: LOGIN
# PROVIDE: test

echo "`date` - test" >/tmp/testit


check to see if it gets run at jail startup


>Fix:
this isn't elegant, but it works -


--- mountcritlocal.orig Thu Jan 26 14:05:17 2006
+++ mountcritlocal      Tue Jan 31 14:05:00 2006
@@ -6,7 +6,8 @@
 
 # PROVIDE: mountcritlocal
 # REQUIRE: root
-# KEYWORD: nojail
+
+if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; them exit 0; fi
 
 . /etc/rc.subr
 


>Release-Note:
>Audit-Trail:

From: hotlips Internet admin <hostmaster@GTS.NET>
To: FreeBSD-gnats-submit@FreeBSD.org
Cc: bug-followup@FreeBSD.org, freebsd-bugs@FreeBSD.org
Subject: Re: conf/92636: /usr/local/etc/rc.d scripts with dependencies don't run inside jail
Date: Wed, 1 Feb 2006 00:15:38 -0500 (EST)

 Thus saith FreeBSD-gnats-submit@FreeBSD.org:
 | 
 | Thank you very much for your problem report.
 | It has the internal identification `conf/92636'.
 | The individual assigned to look at your
 | report is: freebsd-bugs. 
 | 
 | You can access the state of your problem report at any time
 | via this link:
 | 
 | http://www.freebsd.org/cgi/query-pr.cgi?pr=92636
 | 
 | >Category:       conf
 | >Responsible:    freebsd-bugs
 | >Synopsis:       /usr/local/etc/rc.d scripts with dependencies don't run inside jail
 | >Arrival-Date:   Tue Jan 31 19:30:04 GMT 2006
 
 
 	Hmm, a silly typo - try this fix instead:
 
 --- mountcritlocal.orig Thu Jan 26 14:05:17 2006
 +++ mountcritlocal      Tue Jan 31 14:05:00 2006
 @@ -6,7 +6,8 @@
  
  # PROVIDE: mountcritlocal
  # REQUIRE: root
 -# KEYWORD: nojail
 +
 +if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then exit 0; fi
  
  . /etc/rc.subr
 
 
 ... It might be better to replace the mountcritlocal target
 with a dummy for the "early_late_divider" function.
 
 
 Also, below is a better test - a diff to hack /etc/rc to show
 what is (& isn't) happening ...
 
 
 -- 
 Bruce Becker			+1 416 410 0879
 GTS Network Administration	Toronto, Ont.
 Email:	hostmaster@gts.net
 
  --------- 8< --------- 8< --------- 8< --------- 8< --------- 8< ---------
 
 --- /etc/rc	Thu Jan 26 14:05:17 2006
 +++ rc.test	Tue Jan 31 13:35:22 2006
 @@ -43,8 +43,8 @@
  # Set shell to ignore SIGINT (2), but not children;
  # shell catches SIGQUIT (3) and returns to single user.
  #
 -trap : 2
 -trap "echo 'Boot interrupted'; exit 1" 3
 +echo trap : 2
 +echo trap "echo 'Boot interrupted'; exit 1" 3
  
  HOME=/
  PATH=/sbin:/bin:/usr/sbin:/usr/bin
 @@ -61,7 +61,7 @@
  
  dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
  if [ ${dlv:=0} -ne 0 -o -f /etc/diskless ]; then
 -	sh /etc/rc.initdiskless
 +	echo sh /etc/rc.initdiskless
  fi
  
  # Run these after determining whether we are booting diskless in order
 @@ -80,8 +80,10 @@
  #
  files=`rcorder ${skip} /etc/rc.d/* 2>/dev/null`
  
 +echo "files=\"$files\""
 +
  for _rc_elem in ${files}; do
 -	run_rc_script ${_rc_elem} ${_boot}
 +	echo run_rc_script ${_rc_elem} ${_boot}
  
  	case "$_rc_elem" in
  	*/${early_late_divider})	break ;;
 @@ -98,7 +100,11 @@
  *)	find_local_scripts_new ;;
  esac
  
 +echo "local_rc=\"${local_rc}\""
 +
  files=`rcorder ${skip} /etc/rc.d/* ${local_rc} 2>/dev/null`
 +echo "files=\"$files\""
 +
  _skip_early=1
  for _rc_elem in ${files}; do
  	case "$_skip_early" in
 @@ -109,7 +115,7 @@
  		;;
  	esac
  
 -	run_rc_script ${_rc_elem} ${_boot}
 +	echo run_rc_script ${_rc_elem} ${_boot}
  done
  
  echo ''
 

From: hotlips Internet admin <hostmaster@GTS.NET>
To: FreeBSD-gnats-submit@FreeBSD.org
Cc: bug-followup@FreeBSD.org, freebsd-bugs@FreeBSD.org
Subject: Re: conf/92636: /usr/local/etc/rc.d scripts with dependencies don't run inside jail
Date: Wed, 1 Feb 2006 00:15:38 -0500 (EST)

 Thus saith FreeBSD-gnats-submit@FreeBSD.org:
 | 
 | Thank you very much for your problem report.
 | It has the internal identification `conf/92636'.
 | The individual assigned to look at your
 | report is: freebsd-bugs. 
 | 
 | You can access the state of your problem report at any time
 | via this link:
 | 
 | http://www.freebsd.org/cgi/query-pr.cgi?pr=92636
 | 
 | >Category:       conf
 | >Responsible:    freebsd-bugs
 | >Synopsis:       /usr/local/etc/rc.d scripts with dependencies don't run inside jail
 | >Arrival-Date:   Tue Jan 31 19:30:04 GMT 2006
 
 
 	Hmm, a silly typo - try this fix instead:
 
 --- mountcritlocal.orig Thu Jan 26 14:05:17 2006
 +++ mountcritlocal      Tue Jan 31 14:05:00 2006
 @@ -6,7 +6,8 @@
  
  # PROVIDE: mountcritlocal
  # REQUIRE: root
 -# KEYWORD: nojail
 +
 +if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then exit 0; fi
  
  . /etc/rc.subr
 
 
 ... It might be better to replace the mountcritlocal target
 with a dummy for the "early_late_divider" function.
 
 
 Also, below is a better test - a diff to hack /etc/rc to show
 what is (& isn't) happening ...
 
 
 -- 
 Bruce Becker			+1 416 410 0879
 GTS Network Administration	Toronto, Ont.
 Email:	hostmaster@gts.net
 
  --------- 8< --------- 8< --------- 8< --------- 8< --------- 8< ---------
 
 --- /etc/rc	Thu Jan 26 14:05:17 2006
 +++ rc.test	Tue Jan 31 13:35:22 2006
 @@ -43,8 +43,8 @@
  # Set shell to ignore SIGINT (2), but not children;
  # shell catches SIGQUIT (3) and returns to single user.
  #
 -trap : 2
 -trap "echo 'Boot interrupted'; exit 1" 3
 +echo trap : 2
 +echo trap "echo 'Boot interrupted'; exit 1" 3
  
  HOME=/
  PATH=/sbin:/bin:/usr/sbin:/usr/bin
 @@ -61,7 +61,7 @@
  
  dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
  if [ ${dlv:=0} -ne 0 -o -f /etc/diskless ]; then
 -	sh /etc/rc.initdiskless
 +	echo sh /etc/rc.initdiskless
  fi
  
  # Run these after determining whether we are booting diskless in order
 @@ -80,8 +80,10 @@
  #
  files=`rcorder ${skip} /etc/rc.d/* 2>/dev/null`
  
 +echo "files=\"$files\""
 +
  for _rc_elem in ${files}; do
 -	run_rc_script ${_rc_elem} ${_boot}
 +	echo run_rc_script ${_rc_elem} ${_boot}
  
  	case "$_rc_elem" in
  	*/${early_late_divider})	break ;;
 @@ -98,7 +100,11 @@
  *)	find_local_scripts_new ;;
  esac
  
 +echo "local_rc=\"${local_rc}\""
 +
  files=`rcorder ${skip} /etc/rc.d/* ${local_rc} 2>/dev/null`
 +echo "files=\"$files\""
 +
  _skip_early=1
  for _rc_elem in ${files}; do
  	case "$_skip_early" in
 @@ -109,7 +115,7 @@
  		;;
  	esac
  
 -	run_rc_script ${_rc_elem} ${_boot}
 +	echo run_rc_script ${_rc_elem} ${_boot}
  done
  
  echo ''
 
State-Changed-From-To: open->feedback 
State-Changed-By: dougb 
State-Changed-When: Wed Feb 22 02:08:53 UTC 2006 
State-Changed-Why:  

The canonical fix for this is to change the value of 
early_late_divider. Can you please try the /etc/rc 
from -current and see if that fixes it for you 
"automatically?" 


Responsible-Changed-From-To: freebsd-bugs->dougb 
Responsible-Changed-By: dougb 
Responsible-Changed-When: Wed Feb 22 02:08:53 UTC 2006 
Responsible-Changed-Why:  

I'll watch the feedback on this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=92636 
State-Changed-From-To: feedback->closed 
State-Changed-By: dougb 
State-Changed-When: Sat Feb 25 01:30:18 UTC 2006 
State-Changed-Why:  

I've just MFC'ed a different fix for this problem. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=92636 
>Unformatted:
