Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 25002 - /etc/init.d/checkroot return value misinterpretation
Summary: /etc/init.d/checkroot return value misinterpretation
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High minor (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-21 14:49 UTC by Tobias Klausmann (RETIRED)
Modified: 2003-07-22 09:26 UTC (History)
0 users

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 Tobias Klausmann (RETIRED) gentoo-dev 2003-07-21 14:49:34 UTC
In /etc/init.d/checkroot from baselayout-1.8.6.8-r1, there's this code passage:
<pre>
		retval=$?
		if [ "${retval}" -eq 0 ]
		then
			eend 0
		elif [ "${retval}" -eq 1 ]
		then
			ewend 1 "Filesystem repaired"
		else
			eend 2 "Filesystem couldn't be fixed :( (${retval})"
</pre>

This ignores the fact that if fsck detects that the maximum mount count for /
has been reached, the fs is checked and if this check yields no errors, the
return value is 3. The code above interprets this as a failure, which it isn't
and the machine waits there to be rebooted eventually.

With a server being rebooted, this can be very, very bad.

I guess the same problem exists with the maximum-time-since-last-fsck field,
although I don't know what the return value would be.

Same goes for /etc/init.d/checkfs


Reproducible: Always
Steps to Reproduce:
Set the maximum mount count to 1 or the number of mounts very high, reboot the
system.

Actual Results:  
System waiting for root password ord ctrl-d, being rebooted afterwards.

Expected Results:  
Pass of regular fsck. Maybe a nice message, too.

I don't think that emerge info is necessary in this case.
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2003-07-22 07:10:59 UTC
This is the return values of fsck (note that if you had a return of '3',
it means fsck returned codes 1 + 2 (= 3), meaning  there was errors and
they were corrected, and of such a nature that you need to reboot the
machine.

------------------------------------
       The exit code returned by fsck is the sum of the following conditions:
            0    - No errors
            1    - File system errors corrected
            2    - System should be rebooted
            4    - File system errors left uncorrected
            8    - Operational error
            16   - Usage or syntax error
            32   - Fsck canceled by user request
            128  - Shared library error
Comment 2 Tobias Klausmann (RETIRED) gentoo-dev 2003-07-22 09:26:19 UTC
Then this probably is a bug in fsck - I run it with -v in the initscripts and it did not report any repairs - yet still exited with retval 3. Very strange. I'll do some more testing this week.