Bug 475227 - shutdown ignores requested halt action
shutdown ignores requested halt action
Status: CLOSED NEXTRELEASE
Product: Fedora
Classification: Fedora
Component: initscripts (Show other bugs)
rawhide
All Linux
low Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Fedora Extras Quality Assurance
:
: 346261 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-12-08 10:45 EST by Bill Nottingham
Modified: 2014-03-16 23:16 EDT (History)
4 users (show)

See Also:
Fixed In Version: 8.86.3-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-12-09 10:28:28 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Bill Nottingham 2008-12-08 10:45:33 EST
+++ 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-8.45.19.1.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 chepkov@yahoo.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
Comment 1 Bill Nottingham 2008-12-08 15:45:51 EST
shutdown lives in upstart these days.
Comment 2 Casey Dahlin 2008-12-08 17:44:06 EST
What release was this reported against that sysvinit got blamed?

I'll look at an upstart equivalent for this.
Comment 3 Bill Nottingham 2008-12-09 10:02:24 EST
What release? RHEL 4. :)

This is a 'sometime before F11' bug. It might not even need done in upstart; will do some more testing.
Comment 4 Bill Nottingham 2008-12-09 10:25:03 EST
In fact, upstart's doing the right thing, we're just not handling it right in /etc/init.d/halt.
Comment 6 Bill Nottingham 2009-03-16 13:10:19 EDT
*** Bug 346261 has been marked as a duplicate of this bug. ***
Comment 7 Fedora Update System 2009-04-02 14:04:49 EDT
initscripts-8.86.1-1 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/initscripts-8.86.1-1
Comment 8 Fedora Update System 2009-04-03 00:16:31 EDT
initscripts-8.86.2-1 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/initscripts-8.86.2-1
Comment 9 Fedora Update System 2009-04-22 16:23:00 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.