Bug 475227 - shutdown ignores requested halt action
Summary: shutdown ignores requested halt action
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: initscripts
Version: rawhide
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 346261 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-12-08 15:45 UTC by Bill Nottingham
Modified: 2014-03-17 03:16 UTC (History)
4 users (show)

Fixed In Version: 8.86.3-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-12-09 15:28:28 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Bill Nottingham 2008-12-08 15:45:33 UTC
+++ 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 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 20:45:51 UTC
shutdown lives in upstart these days.

Comment 2 Casey Dahlin 2008-12-08 22:44:06 UTC
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 15:02:24 UTC
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 15:25:03 UTC
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 17:10:19 UTC
*** Bug 346261 has been marked as a duplicate of this bug. ***

Comment 7 Fedora Update System 2009-04-02 18:04:49 UTC
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 04:16:31 UTC
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 20:23:00 UTC
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.