20 - 11 - 2017

How to enable power button under GDM

I was struggiling with this for almost whole day, I wanted to have Power Button under GDM to hibernate the machine, but the settings applied under gconf / dconf did't work. I'm used as my Window Manager Cinnamon and for Display Manager GDM with opensuse branding.

dconf database seems to be not full/ I could find power management options, probably it's to gconf. But gconf was configured with some action even for gdm user.

 I've tried many options with acpid including (powerbtn.sh) but with no results. So I've decied to switch to systemd native powerbutton support.

cat /etc/systemd/logind.conf

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# See logind.conf(5) for details


[Login]
#NAutoVTs=6
#ReserveVT=6
KillUserProcesses=yes
KillOnlyUsers=gdm
#KillExcludeUsers=root
InhibitDelayMaxSec=10
HandlePowerKey=hibernate
HandleSuspendKey=hibernate
HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
PowerKeyIgnoreInhibited=yes
#SuspendKeyIgnoreInhibited=yes
HibernateKeyIgnoreInhibited=yes
#LidSwitchIgnoreInhibited=yes
IdleAction=suspend
IdleActionSec=10min
 
But it doesn't work either for GDM... It seemed that something else is listening for Power Button input. But systemd reported:
systemd logind delay lock is active but inhibitor timeout is reached
And after looking at systemd-inhibit I could see:
 
+--> ~ $ >> systemd-inhibit --list
     Who: gdm (UID 482/gdm, PID 5390/gnome-settings-)
    What: handle-power-key:handle-suspend-key:handle-hibernate-key
     Why: GNOME handling keypresses
    Mode: block

     Who: gdm (UID 482/gdm, PID 5390/gnome-settings-)
    What: sleep
     Why: GNOME needs to lock the screen
    Mode: delay

     Who: GNOME Shell (UID 482/gdm, PID 5439/gnome-shell)
    What: sleep
     Why: GNOME needs to lock the screen
    Mode: delay

     Who: Telepathy (UID 482/gdm, PID 5520/mission-control)
    What: shutdown:sleep
     Why: Disconnecting IM accounts before suspend/shutdown...
    Mode: delay
 
To fix this just remove media-keys.gnome-settings-plugin:
rm -f /usr/lib64/gnome-settings-daemon-3.0/media-keys.gnome-settings-plugin
 
This will recover the fucntion of the power button under GDM.
Login Form