Description of problem: Configuring logind to execute a system suspend when the power button/key is pushed does nothing, other than report in the system journal that the PowerKey was pushed. I've configured my system to perform a hybrid-sleep upon the suspend operation in /etc/systemd/sleep.conf. I expected that a suspend operation in logind for the PowerKey would then cause the hybrid-sleep operation to occur. There is a 'hybrid-sleep' option for a logind action which I've tried, which works, and achieves what I wanted to achieve. However, it is a bit surprising that the HandlePowerKey=suspend doesn't do anything, while HandlePowerKey=hybrid-sleep does something. I'd have preferred the HandlePowerKey=suspend option to do what ever actions I've configured in sleep.conf as the suspend actions, as it would keep definition of the 'suspend' operation on my system all in one place i.e., in /etc/systemd/sleep.conf Version-Release number of selected component (if applicable): Up to date Fedora 21, systemd release 20.fc21, version 216 How reproducible: Every time. Steps to Reproduce: 1. Configure logind PowerKey to execute a suspend operation, and restart systemd-logind service. [mark@opy systemd]$ sudo grep -v "^#" logind.conf [Login] HandlePowerKey=suspend PowerKeyIgnoreInhibited=yes [mark@opy systemd]$ 2. Push Power button Actual results: Nothing, other than a journal entry saying the PowerKey had been pushed.: Feb 21 12:36:02 opy.infinter.net systemd-logind[12215]: Power key pressed. Feb 21 12:36:08 opy.infinter.net systemd-logind[12215]: Power key pressed. Feb 21 12:36:09 opy.infinter.net systemd-logind[12215]: Power key pressed. Expected results: logind executes suspend action, according to what is defined in /etc/systemd/sleep.conf Additional info: Here's my sleep.conf contents: [mark@opy systemd]$ cat sleep.conf # Configure system to use hybrid suspend/hibernate upon Suspend operation # i.e., write hibernate image to disk, then suspend # # https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=62c552ccc3eda1198632a4f344aa32623d226bab # [Sleep] # 'platform' seems to be default, use as fallback if 'suspend' fails SuspendMode=suspend platform SuspendState=disk [mark@opy systemd]$
Sorry about initially nominating this as a kernel component. It seems that the new bug component window isn't matching on everything, as trying to list 'systemd' didn't find matches.
Most likely your DE takes possession of the keys and inhibits logind's low-level hookup. Try "systemd-inhibit --list" to see which keys are inhibited by what.
Hi Lennart, Thanks very much for getting back to me. Here's the output of 'systemd-inhibit --list' on the system I care about it working on : -- [mark@opy ~]$ systemd-inhibit --list Who: xfce4-power-manager (UID 1000/mark, PID 2016/xfce4-power-man) What: handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch Why: xfce4-power-manager handles these events Mode: block Who: NetworkManager (UID 0/root, PID 1119/NetworkManager) What: sleep Why: NetworkManager needs to turn off networks Mode: delay 2 inhibitors listed. [mark@opy ~]$ -- So it looks like XFCE power manager is handling the Power key, preventing this from working. That sort of issue occurred to me, and it seemed from the description of the logind that the PowerKeyIgnoreInhibited=yes option would ensure that logind still handled the event. Around the time I was configuring this on my Desktop (the one I most want to use this functionality on) I also configured it on a couple of laptops I have, and they seemed to work for a while, although then they stopped too. All of them are running XFCE. Perhaps a bug has crept into the PowerKeyIgnoreInhibited option? It was a bit surprising that logind was reporting receiving PowerKey events but then not seeming to perform any actions related to them. If I recall correctly, I think I might have tried to use the logind method because the XFCE suspend/hibernate didn't work at the time, and doing at a lower systemd level was more intuitive, because it made it independent of any DE etc. that might be running. I've just tried enabling the XFCE Powermanager to process Power button events on one of my laptops, and it has seemed to work. I'll try the same method on this Desktop after I've posted this message.
Hi, I've just confirmed that setting the Power button in XFCE PowerManager to the suspend action also works on my desktop. Thinking about it, I'd probably say there is also functionality bug in XFCE PowerManager. If there is not an event/action assigned to a button, then it probably shouldn't be inhibiting that button. Thanks, Mark.
Just realised some of my terminology is wrong, s/inibit/handle/ where appropriate.
As a minor note, I've remembered another reason why I wanted to use logind for this instead of XFCE power manager. When the screen saver is running, it seems to catch the push of the power button, and therefore doesn't pass it to XFCE power manager, so my system doesn't suspend. The problem I'm trying to solve is to be able to just walk it my study because, for example I'm leaving to go out, and push the Power button to suspend my desktop, without having to switch the screen(s) on, unlock the screen etc.
I lodged a bug about this against xfce4-power-manager: https://bugzilla.xfce.org/show_bug.cgi?id=11992 From that bug, there is a way to stop xfce4-power-manager from handling the Power button, xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/logind-handle-power-key -n -t bool -s true and then stop/start xfce4-power-manager (xfce4-power-manager -q; xfce4-power-manager) logind then hybrid suspends my system, even with the screen saver operating. xfce4-power-manager still seems to receive the power button event, so the Power button event should be set to none. I've also suggested an xfce4-power-manager option of 'Ignore' for buttons, which would cause xfce4-power-manager to not handle the corresponding button (i.e., a GUI equivalent of the above xfconf-query command), where as 'Do Nothing' would still have xfce4-power-manager handle the button but do nothing with it.
"so the Power button event should be set to none." make that "Do Nothing".
I'm closing this because I don't think logind is doing anything incorrectly anymore. I think I misunderstood what ignore inhibit locks did, and xfce4-power-managers behaviour of handling PowerKey events even with the "Do Nothing" action assigned confused me further. The xfce4-power-manager people are working making improvements in button handling, and I think possibly exposing via the UI what logind's actions for the buttons are. Thanks very much for the help.