[Pkg-sysvinit-devel] Please test patch for checkroot.sh

Petter Reinholdtsen pere at hungry.com
Sat Sep 9 16:28:08 UTC 2006


I'm not sure why checkroot.sh failed for you, as the code work when I
drytest it on my machine.  But in case there is something with fsck
not liking the relative device path, I propose this change to drop the
lazy mount, and instead just mount tmpfs on /tmp, and umount it at the
end.  Can you test and let me know if it work or not?  I need to make
a new upload of sysvinit in a few hours, so it would be great if you
managed to test it before that.

Index: debian/initscripts/etc/init.d/checkroot.sh
===================================================================
--- debian/initscripts/etc/init.d/checkroot.sh	(revisjon 859)
+++ debian/initscripts/etc/init.d/checkroot.sh	(arbeidskopi)
@@ -133,7 +133,7 @@
 	#
 	# Does the root device in /etc/fstab match with the actual device ?
 	# If not we try to use the /dev/root alias device, and if that
-	# fails we create a temporary node in /dev/shm.
+	# fails we create a temporary node in /tmp.
 	#
 	if [ "$rootcheck" = yes ]
 	then
@@ -145,17 +145,13 @@
 			then
 				rootdev=/dev/root
 			else
-				# Using lazy umount, only available
-				# from kernel 2.4.11, to create a
-				# private tmpfs for the device node.
+				# create a tmpfs for the device node.
 				if \
 				        domount tmpfs shmfs /tmp \
-					&& cd /tmp \
-					&& umount -l /tmp \
-					&& mknod -m 600 rootdev b ${rdev%:*} ${rdev#*:} \
-					&& [ -e rootdev ]
+					&& mknod -m 600 /tmp/rootdev b ${rdev%:*} ${rdev#*:} \
+					&& [ -e /tmp/rootdev ]
 				then
-					rootdev=rootdev
+					rootdev=/tmp/rootdev
 				else
 					rootfatal=yes
 				fi
@@ -168,10 +164,9 @@
 	#
 	if [ "$rootfatal" = yes ]
 	then
-		cd / # Release the private tmpfs system if we moved in there
 		log_failure_msg "The device node $rootdev for the root filesystem is missing or incorrect 
 or there is no entry for the root filesystem listed in /etc/fstab. 
-The system is also unable to create a temporary node in /dev/shm. 
+The system is also unable to create a temporary node in /tmp. 
 This means you have to fix the problem manually."
 		log_warning_msg "A maintenance shell will now be started. 
 CONTROL-D will terminate this shell and restart the system."
@@ -282,7 +277,6 @@
 			log_end_msg $FSCKCODE
 		fi
 	fi
-	cd / # Release the private tmpfs system if we moved in there
 
 	#
 	# If there was a failure, drop into single-user mode.
@@ -374,9 +368,11 @@
 	fi
 
 	#
-	# Remove /dev/shm/root if we created it.
+	# Remove the tmpfs mounted on /tmp if it is mounted
 	#
-	rm -f /dev/shm/root
+	if [ /tmp/rootdev = "$rootdev" ] ; then
+	    grep umount /tmp
+	fi
 }
 
 case "$1" in



More information about the Pkg-sysvinit-devel mailing list