Red Hat Bugzilla – Bug 348701
apcupsd control script does not invoke shutdown properly
Last modified: 2008-02-14 09:20:40 EST
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
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Cause a power failure when using apcupsd
2. See that the machine powers off
See also bug 346261 and bug 346271.
I've attached a patch.
Created attachment 235031 [details]
A patch for apccontrol to fix Fedora shutdown
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.
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".
This makes sense. Thanks. Your patch will be present in the next release.
apcupsd-3.14.2-2.fc8 has been submitted as an update for Fedora 8
apcupsd-3.14.2-2.fc7 has been submitted as an update for Fedora 7
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
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.
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.
Created attachment 294910 [details]
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
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
I believe Vadym's issue is already open as bug 346271.
(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.
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.