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
Support further development by purchasing the PDF version of the book.
Other online resources include the Data Science Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 1995-2020 Togaware Pty Ltd. . Creative Commons ShareAlike V4.