Keeping Ubuntu Server awake on a Laptop when closing the lid
April 18, 2021
So recently I've reinstalled Ubuntu on my home server. This was due to me originally using Ubuntu Desktop then converting it to Server by uninstalling the Desktop Environment. Epic conversion, I know. Due to performance issues with it I needed to do a full reinstall and properly replace it with Ubuntu Server.
After installing I noticed closing the lid meant it would go to sleep and everything on the system would stop running. If you're here you probably, like me, want to keep it awake. Maybe it's so it's not lighting up the room or you want to tuck the laptop away. So let's do it.
If you're using Ubuntu Server I assume you're comfortable with the command line. So to begin with open the logind.conf file located at:
You can use either Nano or Vim so the command for Nano would be:
sudo nano /etc/systemd/logind.conf
Then find these two lines, which should be commented out: