From Bugzilla Helper: User-Agent: Mozilla/5.0 (compatible; Konqueror/3.1; Linux 2.4.21-0.13mdk; X11; i586; en_US, en) Description of problem: rc.sysinit when checking for filesystem integriry fails miserably on headless machines even when the PROMPT value is set to "no". Any error unexpected return value in the root file system demands user input. Also, the return code from fsck is not interpreted correctly - fsck returns a bitfield - rc.sysinit instead compares the error level as if it were a regular integer. There is much duplicated script code for handling fsck issues. rc.sysinit does not handle an interrupted powerfail shut down. Version-Release number of selected component (if applicable): All versions in all linux distributions How reproducible: Always Steps to Reproduce: 1. Power off running machine without shutdown to simulate sudden loss of power 2. Restart machine 3. Headless servers will hang on any difficulties even if the root filesystem was successfully checked (PASSED/REBOOT return codes) Actual Results: Headless machine hung until user input supplied. Expected Results: Headless machine should have restarted automatically. Additional info: This can cause an inability to restart headless machines after a power failure or severe problem without attaching a monitor and keyboard even if the disk was successfully repaired. I have created a patch that successfully recovers a headless machine EVERY TIME when ever the errors are trivial and does not require user input if /etc/sysconfig/autofsck contains PROMPT="no" Also, if the power failure causes a loss of power before proper shutdown occurrs, the headless machine defaults to a power failure status and does not allow logins until a monitor is attached. My patch also deals with this correctly. Please let me know how to submit this patch. I feel this patch is instrumental in acheiving lowered TOC for server farms as well as user desktop machines since it should be possible to autocorrect for most problems without user intervention.
Feel free to attach the patch. Note that you can set options for fsck in /fsckoptions to have it never prompt.
Actually, on trivial errors on the root filesystem the /fsckoptions (just like the /etc/sysconfig/autofsck options) are ignored.
Created attachment 94129 [details] Corrected fsck behavior - streamlines fsck handling code I did not run diff -bnuR on the old version of rc.sysinit, since I suspect that there will be other minor variations between distros. What you will notice is that there are packaged functions for handling the fsck behavior and that if the prompting is declined, it correctly NEVER EVER stops unless something incredibly serious happens. Also, if you do a diff, you will see references to -gt for return codes from fsck - this is where part of the problem originates. Fsck returns a bitfield. Enjoy. I am attempting to desseminate this fix as far as it will go. P.S. the /etc/nologin is an additional fix that corrects for when a powerfail shutdown is terminated before completion. You have no idea how many times I have had to hook up a monitor and keyboard to my headless firewall even after setting the PROMPT value. Hope this is helpful. :) Can I be listed as a contributor???? :) :) :)
Comment in AskForKey is reversed - returns 0 on no keypress, returns 1 on keypress. :)
Correction - AskForKey comment is correct. Returns 0 if key is pressed within timeout Returns 1 if key is not pressed within timeout Sorry - I got confused for a second - even though I commented it right the first time. When used in if statement, zero return code processes the then portion, and non-zero processes the else portion. :) The return code processing vs the [] evaluation had me mixed up for a moment.
Created attachment 94303 [details] Corrects fsck behavior for headless machines, and streamlines code Modified the Reboot() function slightly so the logic is more obvious.
Created attachment 94304 [details] Corrects fsck behavior for headless machines, and streamlines code Extraneous CTRL-M injection detected in last upload - removed.
Closing bugs on older, no longer supported, releases. Apologies for any lack of response. This code was reworked before FC4. Notably, fsck is now only run once, and the error code for 'reboot now' is properly handled. Please open new issues for further problems with the fsck code - thanks!