Suspend on Linux

Disable Suspend

Disable:

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

Check:

$ sudo systemctl status sleep.target suspend.target hibernate.target hybrid-sleep.target

Enable Again:

$ sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target

Disable Buttons, screen close:

$ sudo vim /etc/systemd/logind.conf
[Login] 
HandleLidSwitch=ignore 
HandleLidSwitchDocked=ignore
LidSwitchIgnoreInhibited=no

Alternative

Change the suspend beahviour to freeze, that works in mosts machines!

$ sudo vi /etc/systemd/sleep.conf.d
[Sleep]
SuspendState=freeze

Tags linux command

Back