aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/etc/systemd/logind.conf.d
Commit message (Collapse)AuthorAgeFilesLines
* refactor(suspend): gate suspend on AC, drop bespoke zellij inhibitLibravatar sommerfeld3 days1-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New, simpler suspend policy: AC plugged in -> never auto-suspends (lid close ignored, idle no-op) On battery only -> lid close suspends, swayidle suspends at 30 min idle This replaces the SSH/zellij-aware inhibit machinery with a rule that matches the user's mental model: if you don't want the machine to sleep, plug it in. Long-running tasks (builds, downloads, SSH sessions, headless services) just need AC. Changes: * etc/systemd/logind.conf.d/20-lid-ac.conf: set HandleLidSwitchExternalPower=ignore so logind itself handles the AC case at the source. No userspace daemon, no race, no rate-limit risk. * dot_local/bin/on-battery-suspend: tiny POSIX wrapper that exits 0 when any /sys/class/power_supply/{AC,ADP}*/online == 1, else execs `systemctl suspend`. * dot_config/systemd/user/swayidle.service: add `timeout 1800 on-battery-suspend`. Idle suspend now exists, but only when on battery. * Delete zellij-inhibit-suspend.{path,service} + watcher script and remove the entry from systemd-units/user.txt. The .path re-trigger storm bug is moot because the whole mechanism is gone. Manual suspends (sway XF86Sleep keybind, sway power submode `s`, `systemctl suspend` over SSH) still always work regardless of AC -- explicit user intent wins. Also drop /migrate-podman-to-btrfs.sh from .gitignore; the one-off migration script has been deleted now that the user has switched their podman storage to the btrfs driver. On-host steps to apply: chezmoi apply -v systemctl --user daemon-reload systemctl --user reset-failed zellij-inhibit-suspend.service zellij-inhibit-suspend.path || true systemctl --user stop zellij-inhibit-suspend.path zellij-inhibit-suspend.service || true systemctl --user disable zellij-inhibit-suspend.path || true systemctl --user restart swayidle.service # logind drop-in is reloaded automatically by the etc deploy script. Verify: systemctl status systemd-logind | grep -i lid loginctl show-session $XDG_SESSION_ID | grep -i lid # Unplug AC -> close lid -> should suspend. # Plug AC -> close lid -> nothing happens.
* feat(suspend): re-enable suspend on s2idle, drop diagnostic scaffoldingLibravatar sommerfeld3 days1-17/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Confirmed root cause: this hardware's S3 (deep) firmware path triggers a fatal wake-from-suspend hang only on linux-hardened. INIT_ON_FREE + slab hardening + tighter locking turn a latent driver race that stock linux gets away with into an unrecoverable panic so early the journal isn't even flushed. mem_sleep_default=s2idle bypasses the BIOS S3 path entirely (s0ix is a pure-kernel low-power state) and suspends/resumes reliably under hardened. This is a widespread Lenovo S3 firmware issue across post-2018 ThinkPads (see Ubuntu T560, X1C9/10/11 reports). Lenovo themselves moved newer firmwares to s2idle-only. Not a linux-hardened bug per se; just hardened being a strict enough kernel to make the bug fatal. Keep: * mem_sleep_default=s2idle in etc/kernel/cmdline-linux-hardened.tmpl (only the hardened UKI; stock linux keeps unchanged shared cmdline) Revert (all the diagnostic / speculative scaffolding from the last few commits): * MODULES=(intel_lpss_pci) → MODULES=() — Arch wiki touchpad fix was not the cause here * nmi_watchdog=panic softlockup_panic=1 panic=10 — only needed to auto-reboot during diagnosis * no_console_suspend — diagnostic-only * etc/systemd/logind.conf.d/20-no-suspend.conf — masking workaround * sleep-target masking block in run_onchange_after_deploy-etc.sh.tmpl, replaced with a one-shot cleanup that removes any leftover /dev/null symlinks from systems that ran the previous version * systemd-pstore.service from systemd-units/system.txt — added only to catch the diagnostic panic * diagnose-suspend.sh helper (and its .gitignore/.chezmoiignore entries) * sway suspend → lock-session keybind workaround * power-menu.sh Suspend entry restoration * KEYBINDS.md docs
* feat(suspend): disable system suspend until hardened kernel resume issue is ↵Libravatar sommerfeld3 days1-0/+17
| | | | | | | | | | | | | | | | | | | | | | | fixed linux-hardened wedges on resume from S3 (NVMe/i915/iwlwifi driver UAF exposed by INIT_ON_FREE + slab hardening). Until root-caused, take suspend off the table while keeping lock + DPMS intact. - etc/systemd/logind.conf.d/20-no-suspend.conf: lid close, suspend key, hibernate key all map to 'lock'; IdleAction=ignore (swayidle drives DPMS+swaylock independently). - run_onchange_after_deploy-etc.sh.tmpl: mask sleep.target, suspend.target, hibernate.target, hybrid-sleep.target, suspend-then-hibernate.target via /etc/systemd/system -> /dev/null symlinks. Catches 'systemctl suspend' from any source. - dot_config/sway/config: XF86Sleep and system-mode 's' now run loginctl lock-session instead of systemctl suspend. - dot_config/sway/executable_power-menu.sh: drop Suspend entry. - KEYBINDS.md: reflect new behaviour. To re-enable later: remove the logind drop-in + symlink loop, then sudo systemctl daemon-reload.
* fix(logind): ignore KEY_POWER long-press tooLibravatar sommerfeld2026-05-131-6/+12
| | | | | | | | | | | | 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.
* refactor(logind): drop device-specific rationale from power-key drop-inLibravatar sommerfeld2026-05-131-8/+5
| | | | | | The drop-in is generic policy, not tied to one device. Reword the comment to reflect that any USB device emitting spurious KEY_POWER (headsets, KVM switches, cheap keyboards) is covered.
* fix(logind): ignore KEY_POWER short-press to stop Shokz dongle shutdownsLibravatar sommerfeld2026-05-131-0/+11
The Shokz OpenMeet dongle (3511:2EF2) emits KEY_POWER on USB enumeration and on headset power transitions, which logind handles with HandlePowerKey=poweroff and immediately shuts the host down. The previous attempt — an hwdb scancode remap of c0030 to reserved — sets the udev property correctly but the kernel does not honor EVIOCSKEYCODE for this device's HID consumer-page mapping (verified: KEY_POWER 116 still appears in the evdev keymap after udevadm trigger and libinput still reports it). Drop the hwdb file and the systemd-hwdb hooks from the etc deploy script. Replace with a logind drop-in that sets HandlePowerKey=ignore and HandlePowerKeyLongPress=poweroff. Single-tap power events from any source become no-ops; a 5s hold still shuts the machine down, so the real hardware-power-button safety net is preserved. Add a HUP to systemd-logind in the deploy script so the change takes effect without restarting the daemon.