Mysterious suspend when no user is logged in, Ubuntu 24.04
My Ubuntu 24.04 LTS server strangely suspends itself after 20 min. However, if I log in via Anydesk, then it stays on even if I minimize the Anydesk window and do not touch it for hours (it would enter into screensaver mode). If I log out my user and close Anydesk, it would auto suspend again. I’ve checked the following:
1) Disabled sleep / suspend / hibernation related settings in the Power settings in LxQT.
2) Checked from terminal: gsettings list-recursively org.gnome.settings-daemon.plugins.power output
3) Explicitly set relevant settings to ignore in /etc/systemd/logind.conf logind.conf
4) Nothing out of the ordinary in systemctl list-timers output
5) Nothing unusual when I followed the systemctl log journalctl -f. You can see the message `The system will suspend now! log file
UPDATE With the help of ChatGPT and Gemini, the problem is solved!
1) sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target blocks the suspend operation, even though the underlying cause is not identified.
2) Open an override file for the systemd-logind service: sudo systemctl edit systemd-logind.service and add the following to enable debug logging
[Service] Environment=SYSTEMD_LOG_LEVEL=debug
followed by sudo systemctl restart systemd-logind.service.
Alternatively, use busctl monitor org.freedesktop.login1 to monitor requests for Suspend.
3) (2) will produce a line before “The system will suspend now!” in the log file. journalctl -b -1 | grep 'system will suspend now' -A 10 -B 10 gives
Aug 04 17:44:25 MACHINE systemd-logind[1004]: Got message type=method_call sender=:1.67 destination=:1.1 path=/org/freedesktop/login1 interface=org.freedesktop.login1.Manager member=Suspend cookie=99 reply_cookie=0 signature=b error-name=n/a error-message=n/a
4) busctl --system list | grep ':1.67' or busctl --user list | grep ':1.67' reveals that it’s /usr/lib/unity-settings-daemon/unity-settings-daemon that have been calling org.freedesktop.login1.Manager.Suspend(). Uninstalling unity-settings-daemon eliminated the problem!
5) (1) is important because otherwise I will have to do (4) after a reboot. By that time, the D-Bus sender addresses (e.g., :1.67) will point to a different process.
Comments
Comments powered by Disqus