Red Hat Bugzilla – Bug 179314
/etc/init.d/halt should call halt.local before remounting read-only
Last modified: 2014-03-16 22:57:56 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:126.96.36.199) Gecko/20060123 Fedora/188.8.131.52rc1-0.tmus.1 Firefox/184.108.40.206
Description of problem:
/etc/init.d/halt calls a halt.local file that allows administrators to handle special stuff during the halt sequence. However, halt.local is called only after all filesystems have been remounted read-only, so it's not possible, from halt.local to make changes to shutdown behaviour (eg. touch /halt). And if really would make sense if that was possible, since the halt.local code is executed before the check for /halt and /poweroff
My particular task here is to check if the halt/poweroff currently in progress has been initiated by my UPS software (apcupsd) and if so, make sure the system halts without powering off.
There are probably a lot of other scenarios, where people would want to do something on the filesystem from a file like this and it should be fairly easy to accomodate, we just have to choose one of to posibilities...
1) simply move the halt.local(perhaps the built-in UPS code too?) code to before the remounting.
2) add an additional halt.local(eg. halt.rwlocal or whatever) call before remounting. This suggestion depends on what is the thought purpose of having the halt.local in the first place, perhaps 1) is the better choice?
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. add touch /halt to /sbin/halt.local and chmod +x it
Actual Results: complaints that it cannot touch the file on a readonly filesystem
Expected Results: It should be able to create the flag files at this point in time
Well, you could argue that you can remount / rw in halt.local, and then remount
it ro when you're done. But that's overkill.
You're absolutely right - but that feels like a nasty hack to me - If we can
come up with a nicer way to make this work for all or at least most of the stuff
that someone would think of putting in a .local mod like this, if would be much
Fixed in 8.22-1.