Avoid ubuntu server in laptop from going into sleep mode when lid is closed
March 22, 2023
kapilnakhwa
If you are running your old laptops as servers in your homelab like me.
You do not want to keep those lids up all the time. And avoid laptops from going into sleep when you close the lid. Let's change that config.
You do not want to keep those lids up all the time. And avoid laptops from going into sleep when you close the lid. Let's change that config.
sudo vi /etc/systemd/logind.conf
[Login] #NAutoVTs=6 #ReserveVT=6 #KillUserProcesses=no #KillOnlyUsers= #KillExcludeUsers=root #InhibitDelayMaxSec=5 #UserStopDelaySec=10 #HandlePowerKey=poweroff #HandleSuspendKey=suspend #HandleHibernateKey=hibernate #HandleLidSwitch=suspend #HandleLidSwitchExternalPower=suspend #HandleLidSwitchDocked=suspend #HandleRebootKey=reboot #PowerKeyIgnoreInhibited=no #SuspendKeyIgnoreInhibited=no #HibernateKeyIgnoreInhibited=no #LidSwitchIgnoreInhibited=yes
Notice the line HandleLidSwitch .Let's uncomment and change the values to following.
HandleLidSwitch=ignore HandleLidSwitchExternalPower=ignore HandleLidSwitchDocked=ignore
After the values are changed. Restart this service
sudo systemctl restart systemd-logind.service