Running Proxmox 9 on a laptop in clamshell mode with display off
Proxmox 9 is out and I wanted to repurpose my dusty, disappointment of an XPS 15 once again with the new release. I wanted to configure it such that the display turns off after a while to conserve power and I can put it in clamshell mode (aka lid closed). Turns out this is more straightforward than I imagined it’d be. The following should also work on other Debian based systems, I think.
To prevent the laptop from going to sleep on pressing the power button or when closing the lid, edit the /etc/systemd/logind.conf file and make the following self-explanatory changes after uncommenting the relevant lines1:
HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
Make the following changes in /etc/systemd/sleep.conf:
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
To turn the display off, we need to modify the consoleblank kernel parameter that sets the number of seconds after which the display turns off. Modify the /etc/default/grub file and append consoleblank=300 to GRUB_CMDLINE_LINUX to turn the screen off after 5 minutes of inactivity. Don’t worry, the screen will activate on key-press so that you can access the console whenever you need it. In my case, GRUB_CMDLINE_LINUX was empty so the change I made was:
GRUB_CMDLINE_LINUX="consoleblank=300"
Run update-grub to persist these changes and restart the system with reboot.