Bug 348701 - apcupsd control script does not invoke shutdown properly
apcupsd control script does not invoke shutdown properly
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: apcupsd (Show other bugs)
7
All Linux
low Severity low
: ---
: ---
Assigned To: Tomas Smetana
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-10-23 08:31 EDT by David Shaw
Modified: 2008-02-14 09:20 EST (History)
1 user (show)

See Also:
Fixed In Version: 3.14.2-2.fc8
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-02-14 09:16:37 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)
A patch for apccontrol to fix Fedora shutdown (415 bytes, patch)
2007-10-23 08:31 EDT, David Shaw
no flags Details | Diff
/sbin/halt.local (480 bytes, text/plain)
2008-02-14 08:42 EST, Vadym Chepkov
no flags Details

  None (edit)
Description David Shaw 2007-10-23 08:31:21 EDT
Description of problem:

When shutting down, the apcupsd control script needs to call shutdown in such a
way that the machine halts rather than powers off.  On Fedora, "shutdown -h"
does a poweroff by default.  This should be "shutdown -h -H" for the proper halt
behavior.

Version-Release number of selected component (if applicable):

apcupsd-3.14.2-1.fc7

Steps to Reproduce:
1. Cause a power failure when using apcupsd
2. See that the machine powers off

Additional info:

See also bug 346261 and bug 346271.

I've attached a patch.
Comment 1 David Shaw 2007-10-23 08:31:21 EDT
Created attachment 235031 [details]
A patch for apccontrol to fix Fedora shutdown
Comment 2 Tomas Smetana 2008-01-16 08:03:09 EST
When there is a power outage and apcupsd decides to shutdown the machine, what
is the reason not to power it off?  The machine can automatically power on again
when the outage is over or whatever an user sets it up.  I don't understand what
is the benefit of halting the machine when there is no power.

Maybe you can explain the reason.
Comment 3 David Shaw 2008-01-16 09:50:39 EST
The problem is that there are some systems that try and restore the last
known power state after a power failure, so if the machine was powered on, it
comes back on, and if the machine was powered off, it stays off.   For a UPS to
be be meaningful, the machine must come back on again when the power is restored.

The patch forces the machine to be in halt state (but still powered on) when the
UPS cuts the power, so when the system returns to the last known power state, that
state is "on".
Comment 4 Tomas Smetana 2008-01-30 06:32:09 EST
This makes sense.  Thanks.  Your patch will be present in the next release.
Comment 5 Fedora Update System 2008-01-30 08:32:39 EST
apcupsd-3.14.2-2.fc8 has been submitted as an update for Fedora 8
Comment 6 Fedora Update System 2008-01-30 08:40:55 EST
apcupsd-3.14.2-2.fc7 has been submitted as an update for Fedora 7
Comment 7 Fedora Update System 2008-02-02 03:58:25 EST
apcupsd-3.14.2-2.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update apcupsd'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F7/FEDORA-2008-1233
Comment 8 Fedora Update System 2008-02-13 00:06:09 EST
apcupsd-3.14.2-2.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 9 Fedora Update System 2008-02-13 00:09:49 EST
apcupsd-3.14.2-2.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 10 Vadym Chepkov 2008-02-14 08:42:41 EST
Created attachment 294910 [details]
/sbin/halt.local
Comment 11 Vadym Chepkov 2008-02-14 08:44:46 EST
There is another scenario that is not handled properly. In case power returns 
after system halted but before UPS ran out of battery system will be never 
restarted. UPS should be powered off during shutdown. /etc/init.d/halt does 
that for nut package but not for apcupsd. I attached my /sbin/halt.local to fix 
the issue, maybe somebody can insert it into a main tree
Comment 12 Tomas Smetana 2008-02-14 08:57:45 EST
Thank you Vadym.  Maybe it would be better to try to shutdown the UPS from the
halt init script (not the halt.local) as we do with nut -- we'd avoid the
remounting of /usr for instance and we won't have to workaround already existing
halt.local, etc.

Reopening.
Comment 13 David Shaw 2008-02-14 09:04:53 EST
I believe Vadym's issue is already open as bug 346271.
Comment 14 Tomas Smetana 2008-02-14 09:16:37 EST
(In reply to comment #13)
> I believe Vadym's issue is already open as bug 346271.

There's no fun in being a package maintainer when users do all the work for
me... I've added myself to cc: of the bug you filled and I'm closing this one
again.  Thank you.
Comment 15 David Shaw 2008-02-14 09:20:40 EST
To be clearer, UPS shutdown situation using apcupsd needs three bugs to be
fixed before it works: bug 348701 (this one, now fixed), bug 346271 (an issue
with the halt initscript, as noted by Yaydm), and finally bug 346261 (another
halt initscript issue, where the script powers off rather than halting.

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