From 5b6bfa3904a2013dbcd798488baf4661332880d0 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 13 May 2026 13:43:33 +0100 Subject: fix(logind): ignore KEY_POWER long-press too The Shokz dongle emits KEY_POWER press without a matching release on USB disconnect; logind classified that as a long-press after 5s and fired HandlePowerKeyLongPress=poweroff (confirmed in journal: 'Power key pressed long. Powering off...'). There is no policy that distinguishes 'real 5s hold of power button' from 'misbehaving device that never sends release'. Ignore both. Clean shutdowns now require systemctl poweroff or GUI menus; a very long hold of the physical power button still force-offs via firmware. --- etc/systemd/logind.conf.d/10-ignore-power-key.conf | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'etc/systemd') diff --git a/etc/systemd/logind.conf.d/10-ignore-power-key.conf b/etc/systemd/logind.conf.d/10-ignore-power-key.conf index 6f01dc0..1ca4cc3 100644 --- a/etc/systemd/logind.conf.d/10-ignore-power-key.conf +++ b/etc/systemd/logind.conf.d/10-ignore-power-key.conf @@ -1,8 +1,14 @@ [Login] -# Ignore single-tap KEY_POWER from any source. Misbehaving USB devices -# (cheap keyboards, KVM switches, headset dongles) sometimes emit -# KEY_POWER on enumeration or for unrelated buttons, which would -# otherwise shut the host down. A long-press (>=5s) still triggers -# poweroff, preserving the real hardware-power-button safety net. +# Ignore KEY_POWER from any source. Misbehaving USB devices (cheap +# keyboards, KVM switches, headset dongles) sometimes emit KEY_POWER on +# enumeration, hot-plug, or for unrelated buttons -- and some emit a +# press without a matching release, which logind classifies as a +# long-press and acts on after 5s. Ignoring both short and long press +# is the only reliable policy without per-device evdev filtering. +# +# Real shutdowns: `systemctl poweroff` or GUI menus. The laptop's +# physical power button also emits KEY_POWER and is now a no-op for +# clean shutdowns; a very long hold (~10s) still triggers a firmware +# force-off as a last resort. HandlePowerKey=ignore -HandlePowerKeyLongPress=poweroff +HandlePowerKeyLongPress=ignore -- cgit v1.3.1