Public bug reported:

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.d/ups-monitor command which, in turn,
checks for the presence of killpower flag and runs "nut-server poweroff"
command in order to force programmed UPS load power cycling, if that
flag was found.

Followed the instructions on this blog:

https://www.kepstin.ca/blog/networkupstoolsnutandsystemd/

Created file /lib/systemd/system-shutdown/nutshutdown with the following
commands in it:

#!/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

** Affects: nut (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1603609

Title:
  systemd shutdown script missing, causing UPS killpower processing to
  be skipped

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/nut/+bug/1603609/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to