A few weeks ago, i completely moved to using systemd on my machine (it runs Arch). And since then i was facing a really weird issue when i closed my laptop lid. My laptop, with Gnome3, suspends itself when i close. And when i open my laptop lid, i was prompted with the familiar gnome-screensaver password dialog, as expected. But right after i could see the password dialog, the system went back to suspend state again. Looking through the system logs, i saw that the suspend was being called twice in succession. And i didn’t have the problem, if I ran pm-suspend from the command-line. It was clear that suspend was being done twice, but i wasn’t sure what was actually triggering it.
After a quick web search and not finding anything useful, i started digging into systemd’s man pages and found the logind.conf(5) man page. Voila, there it was:
HandlePowerKey=
, HandleSuspendKey=
, HandleHibernateKey=
, HandleLidSwitch=
Controls whether logind shall handle the system power and sleep keys and the lid switch to trigger actions such as system power-off or suspend. Can be one ofignore
, poweroff
, reboot
, halt
, kexec
and hibernate
. If ignore
logind will never handle these keys. Otherwise the specified action will be taken in the respective event. Only input devices with the power-switch
udev tag will be watched for key/lid switch events. HandlePowerKey=
defaults to poweroff
. HandleSuspendKey=
andHandleLidSwitch=
default to suspend
. HandleHibernateKey=
defaults to hibernate
.
The Arch Wiki has a good explanation of the settings in the power management section of the systemd wiki page.
I realised that gnome does its own power management and with systemd running, it does its job of suspended as well. So i had this happening twice. My first instinct was to disable suspend settings in Gnome, but that didn’t seem possible, even with the gnome-tweak-tool installed. So I just put the following lines in my /etc/systemd/logind.conf:
HandlePowerKey=ignore
HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitch=ignore
This essentially will make sure that systemd doesn’t handle the system lid and suspend functions.
This is the first issue that i encountered after i moved to using systemd. (A non-issue actually). I am very happy with how systemd works. I should admit i was quite skeptical before i started using it, but now I’m very used to the whole idea. And whats more, i do notice the faster boot and shutdown times. I haven’t actually measured it, but I’m quite sure that if i did, i would notice a difference. But, thats for later!