Rebooting Rocky Linux 9 is very fast until I enable user linger:
loginctl enable-linger foo
I haven't added any new services to run under the foo
user.
After this change, reboot
, shutdown
, poweroff
commands cause the system to mostly shut down, but then the process hangs. If I forcibly shut down the VM via the hypervisor, the system reboots right away. In the logs from the previous boot, I often see something like:
...
Jan 31 03:28:41 rockylinux-s-1vcpu-1gb-nyc3-01 systemd-logind[696]: Power key pressed short.
Jan 31 03:28:41 rockylinux-s-1vcpu-1gb-nyc3-01 systemd-logind[696]: Powering Off...
Jan 31 03:28:41 rockylinux-s-1vcpu-1gb-nyc3-01 systemd-logind[696]: System is powering down.
...
Once those messages appear, the shutdown or reboot finishes quickly. Running the following command:
loginctl disable-linger foo
makes rebooting fast again. Is there a way around this behavior, or is this a bug?
Edit: I tested this on Ubuntu 22.10, and it's not a problem there, so it may be a bug, or specific to a particular version of Systemd. Both OSes have similar Systemd package versions: 251.4-1ubuntu7 and 250-12.el9_1.1.