conf/97024: [patch] rc.d/jail start ignore failed jail but still
put jid under /var/run
Cheng-Lung Sung
clsung at FreeBSD.org
Tue May 9 10:00:40 UTC 2006
>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 at 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:
More information about the freebsd-bugs
mailing list