I have an old netbook, a Samsung NC-10 to be precise, which i like to use as a server at home.
So i decided to install Debian on it without any desktop or graphical interface – No Problem but it actually started to fall asleep after a while. Not very good for a 24/7 server 🙂
So after googling a bit i found a solution to completely disable all power-management and stop the machine from hibernating, suspend and sleep.
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
So what does this actually do?
Sudo executes it as root because we need root rights to change the settings.
systemctl is the actual command and it says in the man-pages:
systemctl may be used to introspect and control the state of the systemd(1) system and service manager.
So it changes the “systemsettings”.
The mask command does the following according to the man-pages:
Mask one or more unit files, as specified on the command line. This will link these units to /dev/null, making it impossible to start them. This is a stronger version of disable, since it prohibits all kinds of activation of the unit, including manual activation. Use this option with care. This honors the –runtime option to only mask temporarily until the next reboot of the system.
So it disables everything that we define afterwards:
sleep.target suspend.target hibernate.target hybrid-sleep.target
Now the netbook runs through, even if i close the lid. Perfect.
The reason why i chose an old netbook over a raspberry pi or similar is because of the battery. It will work for a few hours even if there is a power cut. So it is kinda like a build in UPS. And i already had the netbook and no other use for it.
To save the battery it is advisable to NOT charge the battery all the time 100%. So it comes in very handy that the NC10 has a BIOS setting to charge the battery only to 80%. Which i checked with:
and it shows me 79%.
If you have any questions or remarks please use the comments.