nut icon indicating copy to clipboard operation
nut copied to clipboard

Who suppose to run `ups-monitor poweroff` on modern debian dists?

Open zapadinsky opened this issue 8 years ago • 4 comments

The call to init.d/halt was removed from sysvinit scripts before 2005 (see the shutdown.c file in repo). The recent Ubuntu 17.10 dist doesn't have init.d/halt at all. The ups-monitor poweroff (i.e. nut-client poweroff and nut-server poweroff) was called from init.d/halt, so it is not called during shutdown procedure now. As the result upsdrvctl shutdown is not executed and UPS doesn't power off after shutdown.

zapadinsky avatar Apr 25 '18 09:04 zapadinsky

I believe (heard it stated a few times) that currently the debian-like systems (as many others) generally package NUT as they desire with integration scripts they provide. So the routine may be called, just not from NUT codebase. Or it can be provided by NUT and not called by the ultimate package in the distro ;)

In NUT sources, you are probably looking for scripts/systemd/nutshutdown(.in) which got some attention recently (past several months) in Git HEAD, to take care of UPS poweroff (upsdrvctl shutdown) and power-race avoidance by sleep+reboot, in a context of systemd shutdown scripts that are not killed off like other daemons and userland processes would.

jimklimov avatar Apr 26 '18 06:04 jimklimov

Why isn't scripts/systemd/nutshutdown just call nut-server poweroffand has a separate branch of code doing the same thing instead. scripts/systemd/nutshutdown was created by @aquette in 2011 but not included in any deb packages older than the very recent 2.7.4-5.1. The UPS poweroff functionality is broken for years despite open bugs in dists bugtrackers and may only be fixed in very recent not yet released Debian 10 and Ubuntu 18.

The bug may damage hardware. UPS should be turned off after system shutdown and not discharge battery further. It is shortening battery lifetime.

zapadinsky avatar Apr 26 '18 13:04 zapadinsky

To make it clear, are you asking NUT community about why did the Debian and Ubuntu communities choose to do something in a particular way?

No idea, can only make some guesses ;)

Probably stems from linux migration from init scripts to systemd, for starters...

jimklimov avatar Apr 26 '18 19:04 jimklimov

The integration with systemd is a part of system tool development, just like drivers etc. The deb package maintainer and the author of nutshutdown script @aquette is also the most active committer here. I don't know how this bug remained unnoticed for so long.

zapadinsky avatar Apr 26 '18 20:04 zapadinsky