Skip to content

Stop the lid gate logging a PAM failure on every open-lid sudo - #7871

Closed
vstoyanov wants to merge 4 commits into
omacom:quattrofrom
vstoyanov:silence-lid-gate-pam-log
Closed

vstoyanov wants to merge 4 commits into
omacom:quattrofrom
vstoyanov:silence-lid-gate-pam-log

Conversation

@vstoyanov

Copy link
Copy Markdown

The clamshell gate in front of pam_fprintd is a predicate, not an action: exit 1 means "lid is open, carry on to pam_fprintd". pam_exec has no notion of that and logs every non-zero exit at LOG_ERR, so an open lid writes this on each sudo and pkexec:

sudo[10740]: pam_exec(sudo:auth): /usr/bin/omarchy-hw-laptop-closed failed: exit code 1

Normal operation, error severity — it makes journalctl -p err useless for finding real errors on any laptop with fingerprint set up.

quiet only suppresses the terminal echo. quiet_log suppresses the log write. Both are stock pam_exec options; quiet_log landed in Linux-PAM 1.5.2 and exists for exactly this case (linux-pam#334).

It does not hide real breakage: quiet_log gates only the "failed: exit code %d" line. The execve(...) failed: %m path is ungated, so a missing or non-executable helper still logs.

Changes

  • bin/omarchy-setup-security-fingerprint — add quiet_log to fprintd_gate, for new setups.
  • migrations/1787422694.sh — retrofit machines that already took the gate from 1784818437 or an older setup script.
  • test/shell.d/polkit-test.sh — the clamshell-gate fixture carried the old literal line.

1784818437.sh is left alone; migrations are marker-file based, so editing an already-run one does nothing.

Testing

Migration run against copies of a real /etc/pam.d/sudo and /etc/pam.d/polkit-1: one line changed per file, idempotent on a second run, no-op when the gate is absent (no fingerprint configured) or when polkit-1 doesn't exist. test/shell polkit suite passes.

Nothing parses the gate line strictly, so the extra token is safe — PolkitModel.js matches pam_fprintd.so with indexOf, and omarchy-remove-security-fingerprint deletes by /omarchy-hw-laptop-closed/d.

🤖 Generated with Claude Code

The clamshell gate in front of pam_fprintd is a predicate, not an action:
exit 1 means "lid is open, carry on to pam_fprintd". pam_exec has no notion
of that and logs every non-zero exit as "failed: exit code 1", so an open lid
writes a NOTICE to the journal on each sudo and pkexec.

quiet only suppresses the terminal echo. quiet_log suppresses the log write.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N3WLvWzgyccPdY6HZhj5po
Copilot AI balanced review requested due to automatic review settings August 23, 2026 09:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Suppresses expected open-lid pam_exec failure logs during fingerprint authentication.

Changes:

  • Adds quiet_log to new fingerprint PAM gates.
  • Migrates existing PAM configurations.
  • Updates the polkit fixture.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
bin/omarchy-setup-security-fingerprint Adds quiet logging to new gates.
migrations/1787422694.sh Updates existing PAM gates.
test/shell.d/polkit-test.sh Updates the PAM fixture.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread migrations/1787422694.sh Resolved
Comment thread migrations/1787422694.sh Resolved
@vstoyanov

Copy link
Copy Markdown
Author

Verified on real hardware since opening this — ThinkPad with a Synaptics reader, lid open, pam 1.7.2-2.

Applied the gate change to a live /etc/pam.d/sudo and /etc/pam.d/polkit-1, then sudo -k; sudo true:

12:41:12  sudo[366682]: pam_exec(sudo:auth): /usr/bin/omarchy-hw-laptop-closed failed: exit code 1   <- last one, pre-change
12:43:08  sudo[368532]: root : COMMAND=/usr/bin/sed -i ... /etc/pam.d/sudo /etc/pam.d/polkit-1
12:44:46  sudo[370246]: v : COMMAND=/usr/bin/true
12:44:46  sudo[370246]: pam_unix(sudo:session): session opened for user root(uid=0) by v(uid=1000)

Fingerprint prompted and authenticated as before, no password fallback — the gate's exit path is unchanged, only the log write is gone. 15 gate lines this boot, all before the change, none after.

vstoyanov and others added 2 commits August 23, 2026 12:50
this is true, not gonna lie

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
The polkit fixture only exercised PAM-config detection, so the substitution
itself, the no-gate and no-file paths, and second-run idempotency were all
untested.

Read the pam.d directory from the environment the way 1786380259 reads
main.conf, so the test can point the migration at a temp dir.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N3WLvWzgyccPdY6HZhj5po
pam_exec writes "failed: exit code N" through pam_syslog at LOG_ERR, which is why it shows up under journalctl -p err. Calling it a NOTICE contradicts the reason quiet_log is there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Sep 28, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed and verified on a disposable Omarchy VM (pam 1.7.2, no lid, so omarchy-hw-laptop-closed exits 1 as it does with a lid open).

Reproduced. With the gate as 1784818437 writes it in /etc/pam.d/sudo, an authenticating sudo logged pam_exec(sudo:auth): /usr/bin/omarchy-hw-laptop-closed failed: exit code 1 at err priority. After running migrations/1787422694.sh the line gained quiet_log, the same sudo logged nothing at err, and auth still succeeded. A second run left the file byte-identical, and putting the old line back brought the error back. Swapping in a helper that exits 0 still skipped the next line and fell through to the password, and a missing helper still logged its execve ... failed line, so the gate's behaviour and the real-breakage signal are unchanged.

Tests. ./test/cli, lid-gate-quiet-log-migration-test.sh (7/7) and polkit-test.sh (8/8) pass on this branch. The full CLI and shell suites on this branch merged into current quattro show the same failures (vscode generated theme… and 9 shell tests) as quattro alone at b18ab49, so none come from this change. No CI has run on the PR.

Pushed c802950: the new comment in bin/omarchy-setup-security-fingerprint said pam_exec writes a NOTICE; it logs at LOG_ERR (Copilot flagged the same wording in the migration, where it was already fixed).

Second opinion from Codex Medium, which may have seen this review, so its agreement is not guaranteed independent. It agreed the problem is real, the change proportionate, and that nothing parsing these lines (setup, remove, PolkitModel.js) is affected. It added two points of its own. First, quiet_log also silences pam_exec's "caught signal" line, so a crashing helper would no longer appear under pam_exec (systemd-coredump still records it). That's a bit broader than the description says, but it's an acceptable trade. Second, a hand-edited stack the migration won't convert: an active old gate next to a commented-out converted one, or tab-separated options. Those machines just keep today's log noise and nothing breaks, so I've left it as is.

Waiting on the maintainer.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks @vstoyanov. #16711 makes the same one-token fix and is the one being taken, because of the migration: this one's is numbered 1787422694, which runs before 1788256455, and that migration's allowlist does not accept a gate carrying quiet_log, so on a machine with both pending the pam_faillock repair is skipped (reproduced on a VM on 2026-11-02). #16711 numbers its migration after it and teaches the allowlist the new form. Your lid-gate-quiet-log-migration-test.sh is worth carrying over to #16711, with credit. This was closed at the maintainer's request after a review of every open fingerprint pull request. Fable 5 in Claude Code read it against today's quattro; no second model checked the closure, so reopen it if this reads your change wrong.

@omarchybot omarchybot closed this Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants