omarchy
omarchy copied to clipboard
Gate sudo fingerprint behind lid state (clamshell)
Problem
When fingerprint auth is set up, omarchy-setup-security-fingerprint inserts auth sufficient pam_fprintd.so at the top of /etc/pam.d/sudo. Because it is first and sufficient, pam_fprintd grabs stdin with "Place your finger…" and blocks the password prompt until it times out.
In clamshell mode (laptop lid closed, docked to an external display) the reader is physically unreachable, so every sudo forces an awkward wait before you can type your password.
Fix (sudo only)
Run pam_fprintd only when the lid is open. PAM can't read lid state, so a tiny pam_exec helper (/usr/local/bin/omarchy-lid-open) gates it:
auth [success=ignore default=1] pam_exec.so quiet /usr/local/bin/omarchy-lid-open
auth sufficient pam_fprintd.so
auth include system-auth # (unchanged)
- Lid open → helper exits 0 →
success=ignore→ falls through topam_fprintd→ fingerprint as before. - Lid closed → helper exits 1 →
default=1→ jumps over the fprintd line → straight to the password stack. - Helper missing / errors / lid state unknown → non-success →
default=1→ password. Fail-safe: never a lockout.
Scope & safety
- sudo only.
/etc/pam.d/polkit-1is intentionally left as-is — the polkit agent shows a password field in parallel with fingerprint, so it never blocks the way terminalsudodoes. - Desktops / non-laptops untouched.
has_lid()is false when there is no/proc/acpi/button/lid/*/state, so setup inserts only the plainpam_fprintdline (today's behavior), no helper is installed, and the migration no-ops. A laptop with no ACPI lid button is treated like a desktop (fix simply doesn't engage). pam_execships with the basepampackage — no new dependency.- The helper lives in
/usr/local/bin(not repobin/, which is only on the user's$PATH) so PAM as root has a stable absolute path. Installed viasudo tee, mirroring the existing polkit-1 heredoc.
Changes
bin/omarchy-setup-security-fingerprint:has_lid(),install_lid_helper(); on laptops insert the lid guard above the sudopam_fprintdline. polkit untouched.bin/omarchy-remove-security-fingerprint: strip the guard from sudo and remove the helper.migrations/1780152390.sh: upgrade existing laptop installs idempotently; no-op on desktops.
Testing
Verified locally on a ThinkPad X1 Carbon gen 14 (Omarchy 3.8.2):
bash -nclean on all three scripts.- Helper tested against real
/proc(lid open → exit 0), simulated closed lid (exit 1), and no-lid/desktop (exit 0). - Applied the migration on a live
/etc/pam.d/sudo(with backup) and exercisedsudo -k; sudo truein both lid states: lid open prompts for fingerprint as before; lid closed (clamshell on external monitor) goes straight to the password prompt with no fingerprint wait. Toggled back and forth repeatedly with consistent results.
🤖 Generated with Claude Code