Skip fingerprint auth when the laptop lid is closed (fprintd) on Fedora
Published 19 July 2026
- date
- env
- linux Fedora 44 (authselect-managed PAM) — Framework Laptop 16; mechanism is distro-neutral macos N/A
- tags
When a laptop runs docked with the lid closed (external monitor, keyboard, mouse), the fingerprint reader is physically unreachable — but PAM does not know that. Every sudo, su, chroot-into-su or polkit prompt still offers fingerprint first, so you sit waiting on a sensor you cannot touch. This guide adds a lid check in front of pam_fprintd so PAM falls straight through to the password prompt when the lid is shut, and behaves exactly as before when it is open. It installs no daemon and reuses your existing fprintd-enrolled prints.
The ready-to-run scripts live in mylinuxtips/fingerprint/fprintd-skip-when-lid-closed; this is the long-form walkthrough.
Symptom
You are docked with the lid closed, and any authentication prompt hangs:
sudo,su, polkit dialogs and the GNOME lock screen all wait on the fingerprint reader before offering a password.- The reader is closed inside the docked laptop, so nothing you do satisfies it.
- Sometimes
Ctrl-Cdrops you to the password prompt, sometimes it just kills the command.
There is no built-in fprintd option for “don’t offer fingerprint when the reader isn’t usable” — the upstream request (libfprint#403) has been open for years.
Root cause
pam_fprintd.so sits early in the PAM auth stack and unconditionally tries the reader. It has no awareness of lid state, dock state, or whether the sensor is reachable — so a closed-lid dock still gets the full fingerprint timeout before password auth is offered.
The laptop does know the lid is shut: the kernel exposes it at /proc/acpi/button/lid/*/state. The fix is to consult that at the moment of authentication and skip pam_fprintd when the lid is closed — no polling, no background service.
Diagnosis
Confirm the lid state is readable (most laptops expose it):
cat /proc/acpi/button/lid/*/stateIt should print open or closed. Confirm fingerprint auth is fprintd-based and that PAM is authselect-managed (the Fedora default):
fprintd-list "$USER" | head -1 # enrolled prints existreadlink -f /etc/pam.d/system-auth # -> /etc/authselect/system-authgrep -n pam_fprintd.so /etc/pam.d/system-auth /etc/pam.d/fingerprint-authIf /etc/pam.d/system-auth resolves under /etc/authselect/ and the pam_fprintd.so lines are present, you are in the supported setup.
Solution
Prerequisites / warnings
- Fingerprint auth already working via fprintd (Fedora:
authselect enable-feature with-fingerprint, prints enrolled withfprintd-enroll). pam_exec.so(ships withpam, at/usr/lib64/security/pam_exec.so).- Editing PAM auth can lock you out. Before running the installer, open a second terminal and keep a root shell alive (
sudo -i). Ifsudomisbehaves afterward, restore the backup files from that shell.
Steps
1. Fetch the scripts.
base=https://raw.githubusercontent.com/eloudsa/mylinuxtips/main/fingerprint/fprintd-skip-when-lid-closedmkdir -p ~/fprintd-lid && cd ~/fprintd-lidcurl -fsSL -O "$base/install-lid-fprint.sh"curl -fsSL -O "$base/status-lid-fprint.sh"2. Run the installer.
sudo bash install-lid-fprint.shThe installer:
-
Writes
/usr/local/bin/fprint-lid-check.sh(root-owned,0755) — a one-liner that exits failure when the lid is closed:Terminal window grep -qw closed /proc/acpi/button/lid/*/state 2>/dev/null && exit 1exit 0 -
Backs up
/etc/authselect/system-authand/etc/authselect/fingerprint-authto timestamped.bak-<stamp>files. -
Inserts, idempotently, this line immediately before
pam_fprintd.soin each file:auth [success=ignore default=1] pam_exec.so quiet /usr/local/bin/fprint-lid-check.sh -
Sanity-checks that the line landed and password auth (
pam_unix) is still present; if not, it auto-restores the backup and aborts.
system-auth covers sudo, su, chroot’s su, polkit and console login; fingerprint-auth covers the GNOME (GDM) fingerprint prompt, so the lock screen also goes straight to password when docked.
How the control word works — the [success=ignore default=1] guard turns the lid check into a conditional skip:
| Lid state | fprint-lid-check.sh | PAM control does | Result |
|---|---|---|---|
| open | exit 0 (success) | success=ignore → continue | pam_fprintd runs → fingerprint offered |
| closed | exit 1 (failure) | default=1 → skip next module | pam_fprintd skipped → password prompt |
Verify
sudo -k clears the cached credential so you actually hit the auth stack:
# Lid CLOSED -> jumps straight to a password prompt, no fingerprint waitsudo -k; sudo true
# Lid OPEN -> offers fingerprint as beforesudo -k; sudo trueA no-root status check confirms the fix is in place (and is worth re-running after any GNOME fingerprint-toggle or pam/authselect update — see Notes):
bash status-lid-fprint.shfprintd lid-skip status [ok] helper /usr/local/bin/fprint-lid-check.sh (executable) [ok] system-auth lid-check before pam_fprintd (lines 8 < 9) [ok] fingerprint-auth lid-check before pam_fprintd (lines 7 < 8) lid state: closed
Result: INSTALLED — nothing to do.It exits 0 when installed, 1 when anything is missing.
Notes and good practices
- authselect can wipe the edit. These PAM files are marked “Generated by authselect — user changes will be overwritten.” Toggling the fingerprint switch in GNOME Settings, or a
pam/authselect update that re-renders them, removes the line. Runbash status-lid-fprint.shany time to check; if it reports missing, just re-runsudo bash install-lid-fprint.sh— it’s idempotent. For a permanent setup,authselect opt-out(then manage PAM by hand) or bake the change into a custom authselect profile. - Lid node name varies. Some machines use
LID, othersLID0; the glob/proc/acpi/button/lid/*/statehandles both. If your laptop has no such node, the script exits 0 (fingerprint stays enabled) — swap the check for an external-display probe (e.g./sys/class/drm/*/statusreadingconnected). - The reader still exists when docked — it’s just unreachable. This only changes when PAM offers it; it does not touch fprintd, libfprint or your enrolled prints.
- A daemon is the alternative. andypiper/fw-lid-fprint-daemon polls the lid and stops the
fprintdservice instead. Thepam_execapproach here decides at authentication time, so it adds no latency and no service masking. - Non-authselect distros (Debian/Ubuntu/Arch): the same idea works — add the
auth [success=ignore default=1] pam_exec.so quiet /usr/local/bin/fprint-lid-check.shline just beforepam_fprintd.soin/etc/pam.d/common-auth(Debian) or the relevant/etc/pam.d/*file. Only the location and thepam_exec.sopath differ (e.g./usr/lib/x86_64-linux-gnu/security/).
Quick reference
# Install (Fedora / authselect)base=https://raw.githubusercontent.com/eloudsa/mylinuxtips/main/fingerprint/fprintd-skip-when-lid-closedcurl -fsSL -O "$base/install-lid-fprint.sh"sudo bash install-lid-fprint.sh
# Check it is still active (no root)curl -fsSL -O "$base/status-lid-fprint.sh"bash status-lid-fprint.sh
# Testsudo -k; sudo true # lid closed -> password prompt; lid open -> fingerprint
# Uninstall (restore the backups the installer reported)sudo cp /etc/authselect/system-auth.bak-<stamp> /etc/authselect/system-authsudo cp /etc/authselect/fingerprint-auth.bak-<stamp> /etc/authselect/fingerprint-authsudo rm /usr/local/bin/fprint-lid-check.shSource: https://github.com/eloudsa/mylinuxtips/tree/main/fingerprint/fprintd-skip-when-lid-closed