View Full Version : Read-only Root and Powering Off

13th May 2008, 12:24 PM

I'm having some trouble with powering off a read-only root system (FC8 based). I understand why I have the problem and I have already had to address it for a more specific case (UPS reported power failure).

The /etc/init.d/halt script does not "obviously" support read-only root very well. It expects /sbin/halt to have generated files (such as /halt, /reboot and for my particular case /poweroff) depending on how it was called. Of course since / is mounted RO this fails and therefore /etc/init.d/halt does not get given the correct info and it does not pass the -p option to the final /sbin/halt call.

To handle the UPS powerfail condition, which used a similar mechanism, I resorted to putting the flag file in a RAM disk (as this is not unmounted during the halt sequence) and patching /etc/init.d/halt accordingly.

I could possibly do the same thing for /sbin/halt, but I really don't want to have to modify the code and recompile. Mainly because it will make tracking and maintenance more difficult for others. I guess I could just put a wrapper in place and create the required files my RAM disk within the wrapper.

Anyway I'm wondering if anyone else has had similar problems and what workarounds they have used.