Skip site navigation (1)Skip section navigation (2)
Date:      Tue,  9 May 2006 17:59:08 +0800 (CST)
From:      Cheng-Lung Sung <clsung@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   conf/97024: [patch] rc.d/jail start ignore failed jail but still put jid under /var/run 
Message-ID:  <20060509095908.12AEE28471@going04.iis.sinica.edu.tw>
Resent-Message-ID: <200605091000.k49A0dvJ099086@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         97024
>Category:       conf
>Synopsis:       [patch] rc.d/jail start ignore failed jail but still put jid under /var/run
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 09 10:00:39 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Cheng-Lung Sung
>Release:        FreeBSD 6.1-STABLE i386
>Organization:
FreeBSD @ Taiwan
>Environment:
System: FreeBSD going04.iis.sinica.edu.tw 6.1-STABLE FreeBSD 6.1-STABLE #9: Mon May 8 09:53:48 CST 2006 root@going04.iis.sinica.edu.tw:/usr/obj/usr/src/sys/GOING04 i386

>Description:

	'rc.d/jail start' echoes successful jail's name, however it
	still put failing jail's id to /var/run/. It should be able
	to tell user what's going on instead of just ignoring it.
>How-To-Repeat:

	establish two jail, choose one and remove /bin, then try to 
	start two jail via rc.d/jail start, you should only one jail's
	name was echoed, but rc.d/jail stop can stop these two jail.

>Fix:


--- rc.d/jail.orig	Tue May  9 17:20:29 2006
+++ rc.d/jail	Tue May  9 17:42:02 2006
@@ -210,11 +210,16 @@
 		_tmp_jail=${_tmp_dir}/jail.$$
 		eval jail ${jail_flags} -i ${jail_rootdir} ${jail_hostname} \
 			${jail_ip} ${jail_exec_start} > ${_tmp_jail} 2>&1
-		[ "$?" -eq 0 ] && echo -n " $jail_hostname"
-		_jail_id=$(head -1 ${_tmp_jail})
-		tail +2 ${_tmp_jail} >${jail_rootdir}/var/log/console.log
+		if [ "$?" -eq 0 ] ; then
+			echo -n " $jail_hostname"
+			_jail_id=$(head -1 ${_tmp_jail})
+			tail +2 ${_tmp_jail} >${jail_rootdir}/var/log/console.log
+			echo ${_jail_id} > /var/run/jail_${_jail}.id
+		else 
+			echo " cannot start jail ${_jail}. message: "
+			tail +2 ${_tmp_jail}
+		fi
 		rm -f ${_tmp_jail}
-		echo ${_jail_id} > /var/run/jail_${_jail}.id
 	done
 	rmdir ${_tmp_dir}
 	echo '.'
@@ -244,7 +249,7 @@
 			fi
 			rm /var/run/jail_${_jail}.id
 		else
-			echo "cannot stop jail ${_jail}. No jail id in /var/run"
+			echo " cannot stop jail ${_jail}. No jail id in /var/run"
 		fi
 	done
 	echo '.'

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060509095908.12AEE28471>