NUT shutdowns down UPS on reboot (includes fix)

Asked by Stefan Smietanowski

I have NUT connected via USB to a UPS, and when I reboot the computer, the UPS will shut down.

The reason is that /lib/systemd/system-shutdown/nutshutdown has the following:

/sbin/upsdrvctl shutdown

Since the script is called with one of the following options: poweroff, halt, reboot, kexec, I have made it conditional:

Replace line 13, which just contains the shutdown command, with:

case "${1} in
  poweroff|halt|kexec)
    /sbin/upsdrvctl shutdown
    ;;
  reboot)
    /sbin/upsdrvctl stop
    ;;
esac

The result is that if you are rebooting, it will not shutdown the UPS, only the service, but in all other cases it will.

Maybe kexec would want the same treatment?

My logic behind this is that if I am rebooting the server, I am unconditionally stating I wish to continue running, and shutting down the UPS makes no sense then, and does invariably lead to a shutdown while the server is starting up.

// Stefan

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu nut Edit question
Assignee:
No assignee Edit question
Solved by:
Stefan Smietanowski
Solved:
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

There is a discussion with the same topic in the Debian bug tracker, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=799849

The version numbers of nut in Ubuntu do not contain the string "ubuntu". This means that the packages are copied from Debian without Ubuntu-specific modification. So it might make more sense to discuss this with Debian, and if Debian change their packages, Ubuntu will follow suit.

Revision history for this message
Stefan Smietanowski (stesmi) said :
#2

Thank you, I will continue it there

// Stefan