systemd shutdown script missing, causing UPS killpower processing to be skipped
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
nut (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Network UPS tools (NUT) on Ubuntu Server 16.04 LTS (x86_64) does not process loss of UPS battery power and forced system shutdown events due to lack of systemd-specific UPS shutdown script.
NUT uses initscripts for controlling its services. Ubuntu 16.04 uses systemd instead but has SysV initscripts compatibility packages installed by default. This works fine for normal system levels but not for level 0 (shutdown) which does NOT use /etc/init.d/halt script at all. However, NUT relies on this script for processing forced shutdown (FSD) events, e.g. the ones caused by the loss of mains power followed by UPS battery charge exhaustion: on a SysV initscripts system /etc/init.d/halt runs /etc/init.
Followed the instructions on this blog:
https:/
Created file /lib/systemd/
#!/bin/sh
/sbin/upsmon -K >/dev/null 2>&1 && /sbin/upsdrvctl shutdown
After that, NUT server would correctly process power loss events (both real and simulated) by cutting UPS power down after a system shutdown and restarting UPS after a short delay when/if the power is back.
$ uname -a
Linux xxx 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ dpkg -l nut
ii nut 2.7.2-4ubuntu1 all network UPS tools - metapackage
Status changed to 'Confirmed' because the bug affects multiple users.