HandlePowerKey Setting for logind Not Working

Pressing my power key instantly initiates a systemd shutdown. I have tried to change this behavior by using a logind conf file (https://www.freedesktop.org/software/systemd/man/latest/logind.conf.html#:~:text=in%20version%20240.-,HandlePowerKey%3D,-%2C%20HandlePowerKeyLongPress%3D):

/etc/systemd/logind.conf.d/80-power-button.conf

# Suspend on power key
HandlePowerKey=suspend

I’ve tried setting it to suspend and ignore, but no matter what, the instant shutdown behavior won’t change. I’m not really sure what else to do because documentation about the ACPI event handling doesn’t really go much deeper than the man page. It’s quite a pain to test and debug because it involves my laptop shutting down every time I press the power key. :confused:

For the record, using systemctl suspend does work.

Thanks in advance for any advice.

You need to specify the [Login] section in your drop-in (even though it’s the only section in that file).

[Login]
# Suspend on power key
HandlePowerKey=suspend
1 Like

Ohhhh my gosh. That’s silly haha.

So you’re telling me my other drop in configs (50-idle-action.conf, 55-handle-lid-switch.conf) have not been working as expected and each one needs that section specifier in the file?

I do not think the drop-ins will work without that, if that is what you are asking.

1 Like

Seems to work now. Thanks a lot!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.