Skip to content

Instantly share code, notes, and snippets.

@srgpsk
Created January 22, 2023 01:43
Show Gist options
  • Save srgpsk/fe8b77069da226e68e00abb3bc030419 to your computer and use it in GitHub Desktop.
Save srgpsk/fe8b77069da226e68e00abb3bc030419 to your computer and use it in GitHub Desktop.
Settings to keep server running with lid closed
Ubuntu server on a laptop, tested on Ubuntu 22.04
- Switch display off
- Do not suspend on lid close
1. Turn off display
> vim /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet consoleblank=30"
> update-grub
Will turn off display after 30 sec. Another option, works in runtime (timeout in minutes!), see https://unix.stackexchange.com/questions/248033/configure-linux-laptop-to-switch-off-screen-but-otherwise-remain-running-when-li
> /bin/setterm -term linux -blank 1 -powerdown 1
2. On lid close keep running, no suspend
> vim /etc/systemd/logind.conf
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
The second option should be ignored by default, but still.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment