jail -- ps: bad namelist - no kernbase

Pierre-Philipp Braun pbraun at nethence.com
Sun Jan 2 19:16:23 PST 2011


> 2.8.2).  Enabling procfs in the guest didn't help.  There's no device
> files appart from log, null and random but guests's dmesg says it's
> mounting devs.  I don't have any /etc/fstab but I don't think that's
Jail guest's dmesg was, of course, not his own, but real system's one. 
And devfs wasn't mounted.  Here are /etc/rc.d/jail and 
/etc/defaults/rc.conf patchs which fixes that (at least here) and allows,
    jail_<jailname>_devfs_enable=yes
to be added into /etc/rc.conf.

The devfs issue was also experienced before 
(http://leaf.dragonflybsd.org/mailarchive/users/2009-10/msg00168.html)

Thanks:-)
//Pierre-Philipp
--- jail.dist	2011-01-03 02:41:39 +0100
+++ jail	2011-01-03 02:50:53 +0100
@@ -30,6 +30,7 @@
 	eval _rootdir=\"\$jail_${_j}_rootdir\"
 	_fdescdir="${_rootdir}/dev/fd"
 	_procdir="${_rootdir}/proc"
+	_devdir="${_rootdir}/dev"
 	eval _hostname=\"\$jail_${_j}_hostname\"
 	eval _ip=\"\$jail_${_j}_ip\"
 	eval _interface=\"\${jail_${_j}_interface:-${jail_interface}}\"
@@ -54,6 +55,9 @@
 	[ -z "${_fdesc}" ] && _fdesc="NO"
 	eval _procfs=\"\${jail_${_j}_procfs_enable:-${jail_procfs_enable}}\"
 	[ -z "${_procfs}" ] && _procfs="NO"
+        eval _devfs=\"\${jail_${_j}_devfs_enable:-${jail_devfs_enable}}\"
+        [ -z "${_devfs}" ] && _devfs="NO"
+
 
 	eval _mount=\"\${jail_${_j}_mount_enable:-${jail_mount_enable}}\"
 	[ -z "${_mount}" ] && _mount="NO"
@@ -69,6 +73,7 @@
 	#
 	debug "$_j fdesc enable: $_fdesc"
 	debug "$_j procfs enable: $_procfs"
+	debug "$_j devfs enable: $_devfs"
 	debug "$_j mount enable: $_mount"
 	debug "$_j hostname: $_hostname"
 	debug "$_j ip: $_ip"
@@ -76,6 +81,7 @@
 	debug "$_j root: $_rootdir"
 	debug "$_j fdescdir: $_fdescdir"
 	debug "$_j procdir: $_procdir"
+	debug "$_j devdir: $_devdir"
 	debug "$_j fstab: $_fstab"
 	debug "$_j exec start: $_exec_start"
 	debug "$_j exec stop: $_exec_stop"
@@ -190,6 +196,11 @@
 			secure_umount ${_procdir}
 		fi
 	fi
+	if checkyesno _devfs; then
+		if [ -d "${_devdir}" ] ; then
+			secure_umount ${_devdir}
+		fi
+	fi
 	if checkyesno _mount; then
 		[ -f "${_fstab}" ] || warn "${_fstab} does not exist"
 		tail -r ${_fstab} | while read _device _mountpt _rest; do
@@ -281,6 +292,16 @@
 				fi
 			fi
 		fi
+		if checkyesno _devfs; then
+			if is_symlinked_mountpoint ${_devdir}; then
+				warn "${_devdir} has symlink as parent, not mounting"
+			else
+				info "Mounting devfs onto ${_devdir}"
+				if [ -d "${_devdir}" ] ; then
+					mount -t devfs devfs "${_devdir}"
+				fi
+			fi
+		fi
 		_tmp_jail=${_tmp_dir}/jail.$$
 		eval jail ${_flags} -i ${_rootdir} ${_hostname} \
 			${_ip} ${_exec_start} > ${_tmp_jail} 2>&1
--- rc.conf.dist	2011-01-03 02:52:40 +0100
+++ rc.conf	2011-01-03 02:54:56 +0100
@@ -447,6 +447,7 @@
 #jail_example_exec_stop="/bin/sh /etc/rc.shutdown"	# command to execute in jail for stopping
 #jail_example_fdesc_enable="NO"			# mount fdesc in the jail
 #jail_example_procfs_enable="NO"		# mount procfs in jail
+#jail_example_devfs_enable="YES"		# mount devfs in jail
 #jail_example_mount_enable="NO"			# mount/umount jail's fs
 #jail_example_fstab=""				# fstab(5) for mount/umount
 #jail_example_flags="-l -U root"		# flags for jail(8)




More information about the Users mailing list