Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 27795 (checkfs/checkroot) - /etc/init.d/checkfs and checkroot in the base layout do not handle the return value of 2 from fsck correctly
Summary: /etc/init.d/checkfs and checkroot in the base layout do not handle the return...
Status: RESOLVED FIXED
Alias: checkfs/checkroot
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-02 13:36 UTC by Hal Brodigan
Modified: 2003-10-13 15:14 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hal Brodigan 2003-09-02 13:36:35 UTC
/etc/init.d/checkfs and checkroot do not handle the return value of 32 from fsck
correctly. That is when fsck scans some partitions, finds errors and corrects
them and the system should reboot after the scan. In the script it does not,
instead the user is given a single user prompt. This harms automation of gentoo
linux and is just plain wrong.

Reproducible: Always
Steps to Reproduce:
1. run checkfs or checkroot from /etc/init.d
2. some how get fsck to return 32 within the scripts
3. and behold the single user prompt.

Actual Results:  
Got a single user prompt and not a rebooting system.

Expected Results:  
reboot the system.

I made a couple patches the corrected this problem.

--- checkfs	2003-09-02 20:11:53.000000000 +0000
+++ /etc/init.d/checkfs	2003-08-24 14:51:57.000000000 +0000
@@ -134,6 +134,14 @@
 			ewend 1 "Filesystem errors corrected."
 			#everything should be ok, so return a pass
 			return 0
+                elif [ "${retval}" -eq 2 ]
+                then
+                        einfo "Rebooting"
+		        /sbin/reboot -f
+		elif [ "${retval}" -eq 32 ]
+		then
+			einfo "Fsck Canceled by user"
+			eend 0
 		else
 			eend 2 "Fsck could not correct all errors, manual repair needed"
 			/sbin/sulogin ${CONSOLE}

--- checkroot	2003-09-02 20:11:59.000000000 +0000
+++ /etc/init.d/checkroot	2003-08-24 14:57:09.000000000 +0000
@@ -34,6 +34,14 @@
 		elif [ "${retval}" -eq 1 ]
 		then
 			ewend 1 "Filesystem repaired"
+		elif [ "${retval}" -eq 1 ]
+		then
+			einfo "Rebooting"
+			/sbin/reboot -f
+                elif [ "${retval}" -eq 32 ]
+                then
+                        einfo "Fsck Canceled by user"
+                        eend 0
 		else
 			eend 2 "Filesystem couldn't be fixed :("
 			/sbin/sulogin ${CONSOLE}
Comment 1 Hal Brodigan 2003-09-02 16:40:17 UTC
I terribly sorry. I ment return value 2 not 32. Also these patches shown do not work correctly. Please use the following patches instead.

--- /etc/init.d/checkfs	2003-09-02 16:28:44.000000000 +0000
+++ checkfs	2003-09-02 20:11:53.000000000 +0000
@@ -134,13 +134,6 @@
 			ewend 1 "Filesystem errors corrected."
 			#everything should be ok, so return a pass
 			return 0
-		elif [ "${retval}" -eq 2 ]
-		then
-			einfo "Reboot needed."
-                        einfo "Unmounting filesystems"
-			/bin/mount -a -o remount,ro &>/dev/null
-			einfo "Rebooting"
-			/sbin/reboot -f
 		else
 			eend 2 "Fsck could not correct all errors, manual repair needed"
 			/sbin/sulogin ${CONSOLE}

--- /etc/init.d/checkroot	2003-09-02 16:05:33.000000000 +0000
+++ checkroot	2003-09-02 20:11:59.000000000 +0000
@@ -35,11 +35,8 @@
 		then
 			ewend 1 "Filesystem repaired"
 		else
-			if [ "${retval}" -gt 2 ]
-			then
-				eend 2 "Filesystem couldn't be fixed :("
-				/sbin/sulogin ${CONSOLE}
-			fi
+			eend 2 "Filesystem couldn't be fixed :("
+			/sbin/sulogin ${CONSOLE}
 			einfo "Unmounting filesystems"
 			/bin/mount -a -o remount,ro &>/dev/null
 			einfo "Rebooting"
Comment 2 Martin Schlemmer (RETIRED) gentoo-dev 2003-09-03 14:44:39 UTC
Hi, update to .10 of baselayout which have this already fixed.
Comment 3 Martin Schlemmer (RETIRED) gentoo-dev 2003-10-13 15:14:42 UTC
Already fixed.