Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go

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.

Ignore Lid Closing

To ignore the lid closing event, and so to retain the on-state of the laptop, edit /etc/systemd/logind.conf to set HandleLidSwitch=ignore. The default is usually to suspend. Then restart the service:

$ 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


Subsections


Copyright © 1995-2019 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware and the author of open source software including Rattle and wajig.
Also the author of Data Mining with Rattle and Essentials of Data Science.