Red Hat Bugzilla – Bug 475227
shutdown ignores requested halt action
Last modified: 2014-03-16 23:16:45 EDT
+++ This bug was initially created as a clone of Bug #475006 +++
Created an attachment (id=326004)
create /halt file if halt action was requested
When you request a halt action
/sbin/shutdown -h -H now
instead of halting system gets powered down
The problem comes from SysVinit-2.86-14
/etc/init.d/halt from initscripts-220.127.116.11.EL-1 has this line of code
[ -f /poweroff -o ! -f /halt ] && HALTARGS="$HALTARGS -p"
Which makes poweroff a default action in absence of /halt file. In my opinion this assumption is questionable for servers. Usually, after a power failure if a system BIOS has "Power recovery: LAST" setting, system can start automatically after power returns. If the action during shutdown was poweroff it would never happen, somebody would have to go to the server and press the power button.
But back to shutdown problem.
when /sbin/halt is called it properly creates /halt file if -p switch (power off) was not passed, so for /sbin/halt halt is default action, proper behavior, in my opinion. But when /sbin/shutdown called with -H switch it doesn't create /halt file, which it should.
Proposed patch is attached. I removed "usage" comment because it is not in sync with the actual source code
--- Additional comment from email@example.com on 2008-12-06 17:10:41 EDT ---
Unfortunately, the approach doesn't work on kernel-xen.
First, strcmp(halttype,HALT) code causes segmentation fault, because halttype
is uninitialized. But even after I fixed that, still kernel-xen powers down.
so, to reiterate the problem
/sbin/shutdown -h -H now doesn't halt the system
if on plain kernel you do touch /halt first, system halts as expected. No
workaround for kernel-xen
shutdown lives in upstart these days.
What release was this reported against that sysvinit got blamed?
I'll look at an upstart equivalent for this.
What release? RHEL 4. :)
This is a 'sometime before F11' bug. It might not even need done in upstart; will do some more testing.
In fact, upstart's doing the right thing, we're just not handling it right in /etc/init.d/halt.
*** Bug 346261 has been marked as a duplicate of this bug. ***
initscripts-8.86.1-1 has been submitted as an update for Fedora 10.
initscripts-8.86.2-1 has been submitted as an update for Fedora 10.
initscripts-8.86.3-1 has been pushed to the Fedora 10 stable repository. If problems still persist, please make note of it in this bug report.