[Pkg-sysvinit-devel] Bug#608534: fsck exit code 32 should be treated as success

Petter Reinholdtsen pere at hungry.com
Sat Jan 1 09:29:42 UTC 2011


[Ben Hutchings]
> However, check{root,fsck}.sh are interactive and fsck will be and
> should be interruptible.  If fsck checks the filesystem only due to
> a schedule (number of days or number of mounts since last check) and
> not due to a detected error condition then a user interrupt should
> *not* be considered a failure of the init script.  Please squash
> exit code 32 in these init scripts.

Something like this might work.  I have not had time to complete the
patch, nor test it, and I am not sure if it is a good idea to ignore
interrupted fsck runs, so I post the patch here for review and
feedback.

Not tagging the BTS report with 'patch' as this patch is incomplete
(need to also modify checkfsck.sh).

Index: debian/src/initscripts/etc/init.d/checkroot.sh
===================================================================
--- debian/src/initscripts/etc/init.d/checkroot.sh	(revision 1950)
+++ debian/src/initscripts/etc/init.d/checkroot.sh	(working copy)
@@ -280,7 +280,7 @@
 			    FSCKCODE=$?
 			    splash_stop_indefinite
 			fi
-			if [ "$FSCKCODE" = 0 ]
+			if [ "$FSCKCODE" = 0 ] || [ "$FSCKCODE" = 32 ]
 			then
 				log_action_end_msg 0
 			else
@@ -291,7 +291,12 @@
 			log_daemon_msg "Will now check root file system"
 			logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -V -t $roottype $rootdev
 			FSCKCODE=$?
-			log_end_msg $FSCKCODE
+			if [ "$FSCKCODE" = 0 ] || [ "$FSCKCODE" = 32 ]
+			then
+				log_end_msg 0
+			else
+				log_end_msg $FSCKCODE
+			fi
 			splash_stop_indefinite
 		fi
 	fi
@@ -304,7 +309,7 @@
 	# errors were corrected but that the boot may proceed. A return
 	# code of 2 or 3 indicates that the system should immediately reboot.
 	#
-	if [ "$FSCKCODE" -gt 3 ]
+	if [ "$FSCKCODE" -gt 3 ] && [ "$FSCKCODE" != 32 ]
 	then
 		# Surprise! Re-directing from a HERE document (as in "cat << EOF")
 		# does not work because the root is currently read-only.
@@ -325,7 +330,7 @@
 		fi
 		[ "$VERBOSE" = no ] || log_action_msg "Will now restart"
 		reboot -f
-	elif [ "$FSCKCODE" -gt 1 ]
+	elif [ "$FSCKCODE" -gt 1 ] && [ "$FSCKCODE" != 32 ]
 	then
 		log_failure_msg "The file system check corrected errors on the root partition 
 but requested that the system be restarted."

Happy hacking,
-- 
Petter Reinholdtsen





More information about the Pkg-sysvinit-devel mailing list