[Nut-upsuser] NUT with hibernation works only once

Roger Price roger at rogerprice.org
Sun Aug 1 15:45:12 BST 2021


On Sat, 31 Jul 2021, David Kačerek via Nut-upsuser wrote:

> On Saturday, 31 July 2021 10:43:23 CEST, Roger Price wrote:
>> Hello David, Does "systemctl hibernate" work correctly without any NUT
>> function enabled?
>
> Yes, I can run it multiple times subsequently and it always works. When
> checking the status of nut-[driver|server|monitor] services they all keep
> reporting "active (running)" after waking up from hibernation.

A short summary of my understanding:

  * Your NUT installation works correctly with a regular shutdown.

  * Hibernation is hibernate-to-disk: a regular shutdown plus the writing of a 
memory image and a process image to swap, and something in grub to have the 
memory image and the processes restored on start-up.

  * A manual systemctl hibernate preserves the NUT processes.

  * In a NUT induced shutdown, is it the /etc/ups/upsmon.conf directive 
SHUTDOWNCMD "systemctl hibernate" which causes the system shutdown, or is it the 
/opt/upssched-cmd-custom clause

   shutdown-timer)
     echo "Power failure hibernation: Calling upsmon -c fsd, $CHMSG" | wall
     upsmon -c fsd
     ;;

In /opt/upssched-cmd-custom it would be very useful to have calls to logger in 
each clause to show in the journal what is happening.

If you shut down because of this clause, when does "systemctl hibernate" get 
executed?

  * In the journalctl extract, a line reports « čec 31 00:15:06 atronach-opensuse 
systemd-sleep[2596]: service: no such service upsd.service ». Why is systemd 
looking for upsd.service and not nut-server.service ?  Is this just systemd 
wierdness or is it more serious?

>> What does command ls -alF /lib/systemd/system-sleep/ report?
>
> david at atronach-opensuse:~> LANG=c ls -alF /lib/systemd/system-sleep/
> ls: cannot access '/lib/systemd/system-sleep/': No such file or directory
> david at atronach-opensuse:~> LANG=c sudo ls -alF /lib/systemd/system-sleep/
> ls: cannot access '/lib/systemd/system-sleep/': No such file or directory
>
>> Do you have something like nut-delayed-ups-shutdown.service which calls for
>> the UPS to shutdown its outlets after N seconds?  For hibernation to work,
>> you should disable this service.  I'm assuming you want the UPS to go on
>> feeding the machine throughout the hibernation. (And to go on beeping.)
>
> No, I don't have the service created. But I don't mind the UPS killing of
> power - hibernation (=suspend to disk) doesn't require power after all unlike
> suspend to RAM.

I assume that you rely on /lib/systemd/system-shutdown/nutshutdown which 
executes /sbin/upsmon -K >/dev/null 2>&1 && /sbin/upsdrvctl shutdown

It seems to me that systemd's nutshutdown should have a call to logger to record 
an important system decision, but it may be too late in the shutdown process 
for logger to be effective.  That's why I always comment out systemd's 
nutshutdown and use nut-delated-ups-shutdown.service which is executed early 
enough for the logger to work.

> nut-report output:
> https://hastebin.com/hoqabilobu
>
> nut-journal output:
> https://hastebin.com/oluwisonuy

Thanks.

This is beginning to look like a systemd problem rather than a NUT problem. 
Why can't hibernate restore a service such as nut-monitor.service?  Perhaps 
someone else in this list has deeper a systemd understanding, or maybe a 
question in the openSUSE mailing list <users at lists.opensuse.org> might find the 
right systemd expertise.

Roger


More information about the Nut-upsuser mailing list