Discussion:
[systemd-devel] Inhibitor Locks and PrepareForShutdown signal
Stefan Betermieux
2021-05-10 12:24:36 UTC
Permalink
Hi,

I am trying to use an inhibitor lock on shutdown (kubernetes kubelet daemon to drain node on reboot of Fedora CoreOS 33), but while it registered successfully, a PrepareForShutdown signal is never sent and the machine is rebooted without notifying the service.

systemd-inhibit --list
WHO UID USER PID COMM WHAT WHY MODE
Inhibitor Test 0 root 51742 inhibit shutdown Testing systemd inhibitors from Go delay
NetworkManager 0 root 713 NetworkManager sleep NetworkManager needs to turn off networks delay
kubelet 0 root 32385 kubelet shutdown Kubelet needs time to handle node shutdown delay

To reduce the possible causes I have used a proof of concept inhibitor written in go (https://trstringer.com/systemd-inhibitor-locks/) and tried it on different systems. Ubuntu Server 21.04 produces the correct logs:

May 07 18:53:45 osboxes inhibit[3001]: Starting dbus example
May 07 18:53:45 osboxes inhibit[3001]: Inhibitor file descriptor: 7
May 07 18:53:45 osboxes inhibit[3001]: Waiting for shutdown signal
May 07 18:57:01 osboxes inhibit[3001]: Signal: &{:1.7 /org/freedesktop/login1 org.freedesktop.login1.Manager.PrepareForShutdown [true] 5}
May 07 18:57:01 osboxes inhibit[3001]: Closing file descriptor
May 07 18:57:01 osboxes systemd[1]: Stopping Inhibitor test...
May 07 18:57:01 osboxes systemd[1]: inhibit.service: Succeeded.
May 07 18:57:01 osboxes systemd[1]: Stopped Inhibitor test.

Fedora CoreOS 33, Fedora Server 33 and openSUSE Server 15.2 don't receive the PrepareForShutdown signal:

May 10 02:12:58 localhost.localdomain inhibit[795]: Starting dbus example
May 10 02:12:58 localhost.localdomain inhibit[795]: Inhibitor file descriptor: 7
May 10 02:12:58 localhost.localdomain inhibit[795]: Waiting for shutdown signal
May 10 02:13:08 localhost.localdomain systemd[1]: Stopping Inhibitor test...
May 10 02:13:08 localhost.localdomain systemd[1]: inhibit.service: Succeeded.
May 10 02:13:08 localhost.localdomain systemd[1]: Stopped Inhibitor test.

The configuration file /etc/systemd/logind.conf is empty. Any pointers where to look?

Regards,
Stefan

Loading...