Systemd-logind eats cpu when closing laptop lid

I recently noticed that systemd-logind starts using about 75% cpu when I close my laptop’s lid. This high cpu usage starts a couple of seconds after closing the lid, and stops when the lid is opened again. I monitor this using ssh over the network and I hear the fans spinning up after having closed the lid for some time. Does anyone have a suggestions why this is happening and how to stop it?
Note that I have set my laptop not to suspend when closing the lid, because it never recovers from that.

EDIT: I have disabled suspend via systemctl mask sleep.target systemctl mask suspend.target

1 Like

Can you show some logs
https://docs.fedoraproject.org/en-US/quick-docs/viewing-logs/

1 Like

sure:
dmesg gets awefully busy:

[21555.025744] Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7
[21555.027289] Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7
[21555.028871] Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7

and many many more of exactly the same entries.

Similarly, journalctl is flooded with

 4 07 15:06:27 laptop systemd-logind[1590]: Failed to execute suspend operation: Permission denied
 4 07 15:06:27 laptop systemd-logind[1590]: Failed to execute suspend operation: Permission denied
 4 07 15:06:27 laptop kernel: Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7
 4 07 15:06:27 laptop kernel: Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7

Maybe I need to find a different method to disable sleep?

I think the suspend might be getting triggered by the lid switch. You may want to set HandleLidSwitch=ignore in /etc/systemd/logind.conf (see man logind.conf for more information.)

2 Likes

Also in tweaks → general you might turn off “suspend when laptop lid is closed”