- Package:
- initscripts
- Source:
- sysvinit
- Submitter:
- "Fabien C."
- Date:
- 2025-02-11 13:03:02 UTC
- Severity:
- normal
- Tags:
Dear Maintainer, please launch "/etc/init.d/ups-monitor poweroff" everytime /etc/init.d/halt is called, not only when INIT_HALT=POWEROFF. This is necessary because the user can customize the nut/upsmon shutdown command, which default to "shutdown -h +0", to something like "shutdown -Hh +0" (see /etc/nut/upsmon.conf). This could be done so that the machine does poweroff the disks and stop the system, but does *not* cut the power off, waiting for the UPS to do so. This is nice when your BIOS is configured to restore the last power state before the power went down: "On/Off state: Last state". The current script forbids that behavior because if INIT_HALT is not equal to POWEROFF, which is "unfortunately" the case with "shutdown -Hh", then /etc/init.d/ups-monitor is *never* called. Thank you.
tags 717488 patch thanks Here is a patch to describe my bug report. Thanks.
While this change sounds reasonable, I'm not personally aware of the reason for the current logic. Is changing this going to break anything? Why is it currently the way it is? Regards, Roger
[Roger Leigh] I have no idea either. Before my time. :)
Well, I don't know. I guess it just wasn't logic enough to call ups-monitor with the "poweroff" argument when the system INIT_HALT is not set to poweroff itself... Let's ask Arnaud and Laurent (nut maintainers) if they have more information on the matter (cc). Regards, Fabien C.
It is basically not a good idea at all to cut power instead of issuing a hardware shutdown command. Lots of stuff on server boxes get highly pissed off if you just cut power. I would have to put some effort to recall all the trouble we had in the past to access whether we can support this proposed change, though. What is important is that we must not break the sane scenario, where you have the box properly configured to always power up on power restore, and the UPS configured to always cycle the load once the load (i.e. us) signals that it is past the point of no return (i.e. that it will require a power cycle to restart -- in Debian, that pretty much means as soon as we switch to runlevel 0). Also, shutdown -H must NOT issue a UPS power off command [by default], it is documented to not do it.
Hmmm, "shutdown -hH" still shuts down the disks, and halts the CPU. I think the *only* thing it does not is cut the power, but the system is already ready to lose it. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=358696 Well, we could make it an option if you think it is not a good idea to have it as default. I don't think "always power up on power restore" is a "properly configured" box. If a box is off, that is very probably for a good reason, and I *don't* want it to power up based on some random event like power outage... What the "normal" people want is to get back to the state the machines were before the power problem occured, no more, no less. That is restore last power state. Any other configuration could lead to problems (like IP conflicts, too much power consumption, etc.) We make the documentation, don't we? Also, I would add that /etc/init.d/ups-monitor does *not* cut the power off if the UPS is not running on battery. But once again, we could make it an option. Fabien
No, you did not tell the baseboard management controller and friends that you want to shutdown, and they will not only fail to do an ordered shutdown, but also raise alarms that power was lost and an unclean shutdown happened. And since this is x86, the only way to tell the platform that you want a shutdown in the first place is to try to issue a platform "poweroff" command. There is no platform "halt" command. It is impossible to have it as a default. So yes, if we do it, it would _have_ to be an option. Your use case is not the most common, nor the only use case. This is not possible to do sanely on an architecture that cannot differentiate from administrative shutdown and operational shutdown, or that doesn't even have a "halted-but-powered-on" state anyway. You've got to be kidding me. Who knows how many boxes and scripts out there depend on the current, documented, shutdown -H behaviour? Bugs we fix. Functionality working as designed, we don't change like that. You can request a NEW option for shutdown that does what you want, though. Or you can have an optional, non-default way to change -H to do what you want. Those are your two choices. Then, it is broken, unless something else is issuing the proper synchronization commands to the UPS.
Control: retitle -1 Please provide option to launch /etc/init.d/ups-monitor when halting the system Control: severity -1 wishlist Reflecting the consensus here that this could only be a new option, but the default should not be changed. Retitling and changing to wishlist. Mark