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
Change the suspend beahviour to freeze, that works in mosts machines!
$ sudo vi /etc/systemd/sleep.conf
[Sleep]
SuspendState=freeze
To check available states in the kernel, use cat /sys/power/state
Use lsusb to get the list of USB devices:
# lsusb
Bus 001 Device 006: ID 062a:4c01 MosArt Semiconductor Corp. 2,4Ghz Wireless Transceiver [for Delux M618 Plus Wireless Vertical Mouse]
Create /etc/udev/rules.d/90-usb-wakeup.rules and add:
ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="062a", ATTRS{idProduct}=="4c01", ATTR{power/wakeup}="disabled"
Reload Rules and unplug/plug
sudo udevadm control --reload-rules
linux