GNU/Linux Desktop Survival Guide
by Graham Williams |
|||||
Always On Power Management |
20190812 Laptops generally aim to reduce their power consumption through sleep and suspend modes. However, sometimes we want to treat a laptop as a server that should never shut down. For example, a retired or superseded laptop can work as a powerful server. The trick here is to ensure the laptop can boot, connect to the network, and remain on without having to log in to any user account. Particularly to also stop the laptop from sleeping when the lid is closed.
$ grep HandleLidSwitch= /etc/systemd/logind.conf #HandleLidSwitch=suspend $ sudo perl -pi.bak -e 's|#HandleLidSwitch=suspend|HandleLidSwitch=ignore|' /etc/systemd/logind.conf $ grep HandleLidSwitch= /etc/systemd/logind.conf HandleLidSwitch=ignore $ wajig restart systemd-logind |
Another suggestion not tried:
# Disable suspend $ sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target # Re-enable suspend $ sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target |