Bug 475006
| Summary: | shutdown ignores requested halt action | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 5 | Reporter: | Vadym Chepkov <vchepkov> | ||||||
| Component: | initscripts | Assignee: | initscripts Maintenance Team <initscripts-maint-list> | ||||||
| Status: | CLOSED ERRATA | QA Contact: | BaseOS QE <qe-baseos-auto> | ||||||
| Severity: | medium | Docs Contact: | |||||||
| Priority: | low | ||||||||
| Version: | 5.3 | CC: | ajb, harald, jturner, notting | ||||||
| Target Milestone: | rc | Keywords: | Regression, Reopened | ||||||
| Target Release: | --- | ||||||||
| Hardware: | All | ||||||||
| OS: | Linux | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | |||||||||
| : | 501487 (view as bug list) | Environment: | |||||||
| Last Closed: | 2009-09-02 11:14:22 UTC | Type: | --- | ||||||
| Regression: | --- | Mount Type: | --- | ||||||
| Documentation: | --- | CRM: | |||||||
| Verified Versions: | Category: | --- | |||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||
| Embargoed: | |||||||||
| Bug Depends On: | 475609 | ||||||||
| Bug Blocks: | 501487 | ||||||||
| Attachments: |
|
||||||||
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 I'm cloning this bug for our development stream, to be considered for the next major Red Hat Enterprise Linux release. As this change would change behavior that's been in all prior versions of Red Hat Enterprise Linux releases, this isn't really something suitable for fixing in an update to RHEL 5, where we try and maintain as stable a base as possible. Ergo, closing as WONTFIX for RHEL 5. I think, I was misunderstood. I didn't ask to change the behavior.
The subject of the bug report stands.
man shutdown says:
-h Halt or poweroff after shutdown.
-H Halt action is to halt or drop into boot monitor on systems that
support it.
# /sbin/shutdown -? shows:
-h: halt after shutdown.
-P: halt action is to turn off power.
-H: halt action is to just halt.
and command
shutdown -h -H now does not halt the system
Created attachment 326330 [details]
patch
Whoops, misread that as you wanted to change the default for -h to halt w/o poweroff.
Does the attached fix it for you?
It did only for plain kernel, not for kernel-xen and on kernel-xen shutdown coredumps with my patch, so I don't think it's a proper way to handle the situation. Please try the patch I posted, not your patch. Whoops :) After a small correction (space is missing before first closing bracket) The patch halts normal kernel, but not kernel-xen. Does a manual invocation of 'halt -f' also poweroff? Poweroff the xen kernel, that is. /sbin/halt -f halts system with normal kernel and poweroffs kernel-xen OK. Can you open a separate bug against kernel-xen for that? This patch fixes the general case, and once kernel-xen is fixed, it should work there too. Bug 475609 has been submitted, I am not sure if we should link them together or not. Do I need to submit duplicates for Fedora? It has the same issue. http://git.fedorahosted.org/git/?p=initscripts.git;a=commitdiff;h=b7b6cb4ce32ba749f5f7b786ddc3bafd37442a89 was committed to the Fedora upstream; it hasn't been built yet, though. Please test the erratum candidate: http://people.redhat.com/harald/downloads/initscripts/initscripts-8.45.26.1.el5/ I only can see people.redhat.com Logo works for me from outside connections Hmm, must have been temporary issue. Anyway, /etc/init.d/halt has a syntax error in line 220, unmatching ] -[ "$INIT_HALT" != "HALT"] && HALTARGS="$HALTARGS -p" +[ "$INIT_HALT" != "HALT" ] && HALTARGS="$HALTARGS -p" After I fixed the error above the system did halt as requested. I should have double checked the patch from comment #14 Thank you! I'm kicking this back to assigned to pick up the typo identified in comment 20. Fix confirmed with initscripts-8.45.28-1.el5. Looks like the advisory has been updated as well so moving this to Verified. [root@dyno /etc/rc.d/rc0.d]# rpm -q initscripts initscripts-8.45.28-1.el5.x86_64 [root@dyno /etc/rc.d/rc0.d]# diff -Nru S01halt.orig S01halt --- S01halt.orig 2009-05-13 07:18:11.000000000 -0400 +++ S01halt 2009-05-14 13:57:05.000000000 -0400 @@ -217,6 +217,6 @@ [ -n "$kexec_command" ] && $kexec_command -e -x >& /dev/null HALTARGS="-d" -[ "$INIT_HALT" != "HALT"] && HALTARGS="$HALTARGS -p" +[ "$INIT_HALT" != "HALT" ] && HALTARGS="$HALTARGS -p" exec $command $HALTARGS An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2009-1344.html |
Created attachment 326004 [details] 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