Part 3: Make it a real server
13. Keep a laptop running with the lid closed#
Laptops only. Skip this chapter for desktop PCs. What you'll do: stop the laptop from going to sleep when you close the lid. Time: 10 minutes.
Step 1: Create a settings file#
Type on: the server
sudo mkdir -p /etc/systemd/logind.conf.d
sudo nano /etc/systemd/logind.conf.d/lid.conf
Paste:
File: /etc/systemd/logind.conf.d/lid.conf
[Login]
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
Save and exit.
Step 2: Restart and test#
Type on: the server
sudo reboot
Wait 2 minutes. Then:
- With the lid open, check
ssh homeserverworks. - Close the lid and wait 1 minute.
- Open a new connection:
ssh homeserver. It should work.
Safety for a laptop that's always on#
Heat
- Put it on a hard, flat surface, never on fabric. Leave the vents clear.
- Check the temperature now and then:
Type on: the server
sudo apt install lm-sensors
sensors
At rest, 35–55 °C is normal. Above about 85 °C under load is too hot.
Battery
Look at the laptop every month. If the case bulges, or the trackpad or keyboard lifts, the battery is swelling. Unplug it and have the battery replaced. A worn battery also won't keep the server on during a power cut.
Undo
sudo rm /etc/systemd/logind.conf.d/lid.conf and then sudo reboot.
Done when: a new SSH connection works with the lid closed.