Bug#1040943: systemd-logind: 'HandlePowerKey=ignore' works in logind.conf, not in logind.conf.d/custom.conf

Michael Biebl biebl at debian.org
Mon Jul 17 00:24:43 BST 2023


Am 15.07.23 um 11:55 schrieb Diederik de Haas:
> Control: retitle -1 With HandlePowerKeyLongPress=shutdown configured, a short press is interpreted as long press
> 
> On Thursday, 13 July 2023 20:00:54 CEST Diederik de Haas wrote:
>>>> When I created /etc/systemd/logind.conf.d/custom.conf with
>>>> HandlePowerKey=ignore
>>>
>>> If this is the whole content of /etc/systemd/logind.conf.d/custom.conf,
>>> you are missing a [Login] section at the top of the file
>>
>> It was the whole contents.
>> Adding the "[Login]" header (back) made it work \o/
>>
>> I initially had that header, but in my attempts to get it to work, I removed
>> it again. I must have done something else wrong in my earlier attempts
>> which made it not work then, but I won't be able to recall exactly what.
> 
> It looks like there actually is a bug and not (just) a PEBKAC issue.
> What I (actually) started out with, was the following custom config:
> ```
> [Login]
> HandlePowerKey=suspend
> HandlePowerKeyLongPress=poweroff
> ```
> 
> And when I then pressed the power key *short*, it powered off the system.
> My initial conclusion that logind.conf.d/custom.conf didn't work was incorrect.
> 
> If I remove or disable (via prepending it with '#') the LongPress action, then
> it sees it as a short key press and does the desired thing: suspend.
> If I set the LongPress action to 'ignore', then it also registers a short key
> press as a short press and does the desired thing: suspend.
> But if I set the LongPress action to 'shutdown', then it registers a short key
> press as a *long* press and does the poweroff action.
> 
> Attached you'll find the custom config I used (same as quoted above) and
> also the output from journalctl where all my physical key presses were short.

The journald output shows long and short key presses (with logind 
reacting accordingly)

jul 15 09:17:08 pinetab2 systemd-logind[1742]: Power key pressed short.
jul 15 09:17:08 pinetab2 systemd-logind[1742]: Suspending...

jul 15 09:18:42 pinetab2 systemd-logind[1850]: Power key pressed long.
jul 15 09:18:42 pinetab2 systemd-logind[1850]: Powering off...

That looks all as expected and I don't understand the problem this is 
supposed to show.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20230717/4ddb9fac/attachment.sig>


More information about the Pkg-systemd-maintainers mailing list