Disable Suspend on Linux

Posted on Jul 30, 2021

Disable / Mask services using systemctl

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Edit “/etc/systemd/logind.conf” to avoid errors and high CPU usage

HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore

Restart systemd-logind

sudo systemctl restart systemd-logind

Check for errors

journalctl -xe

That’s it!