Disallow entering sleep mode in Ubuntu server
We will introduce how to configure systemd to disallow entering sleep mode in Ubuntu server.
Ref: askubuntu
We can configure systemd to disallow entering sleep mode by creating file /etc/systemd/sleep.conf
and entering in it:
[Sleep]
AllowSuspend=no
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no
A daemon-reload
or system reboot may be required to apply the changes.
We can also mask the appropriate systemd targets:
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target