omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

[Quattro] Encrypted hibernate asks for both LUKS and session passwords

Open ClGratton opened this issue 3 months ago • 4 comments

System details

Omarchy 4.0.1 Quattro, Linux 7.1.9, encrypted Btrfs root using Omarchy's stock cryptdevice= initramfs flow, with hibernate enabled through Omarchy Setup.

Problem

Hibernate resume can require two authentication prompts on a stock encrypted installation. The initramfs LUKS prompt decrypts the root device and restores the hibernation image, then the restored native Omarchy session lock asks for the account password again.

This happens because omarchy-system-sleep-monitor receives logind's generic PrepareForSleep(true) signal for both suspend and hibernate and normally invokes omarchy-system-sleep-lock. Normal reboot has only the LUKS prompt because there is no saved desktop session or session lock to restore.

Expected behavior

For Omarchy's stock interactive LUKS hibernate path, boot decryption should be the one authentication step. Unencrypted roots, keyfile or automatic unlock, unknown or custom encryption paths, suspend, and direct or unmarked sleep requests must retain the native session lock.

Current finding

The latest double-authentication trace proves that the sleep monitor saw no live hibernate marker and therefore locked before S4. The old wrapper did not log whether it was bypassed or fell back, so the missing marker's historical cause cannot be reconstructed. Current encrypted-root detection and advisory marker locking pass, and PR #8910 now logs every marker decision and fallback without recording authentication data. A marker-aware hardware retest through the Omarchy menu remains pending.

Related history appears in #3185, #6850, and #141.

ClGratton avatar Aug 29 '26 09:08 ClGratton

This also happens with suspend-then-hibernate

S4AR-inc avatar Sep 23 '26 14:09 S4AR-inc

Checked against quattro (c352b62): the cause in the report is accurate. bin/omarchy-system-sleep-monitor runs omarchy-system-sleep-lock on every PrepareForSleep(true) without knowing whether the system is suspending or hibernating, so the hibernation image is saved with the session already locked and resume asks for the session password after the LUKS prompt.

#8910 is the open fix for this and already carries Fixes #8909, so this issue will close when it merges. There are no competing open pull requests for the same change and no earlier open duplicate; #3185 and #6850 are closed.

Two things for whoever decides on #8910:

  • It only skips the lock for a hibernate started through the new omarchy-system-hibernate (the menu entry), which holds the marker the sleep monitor checks. Suspend-then-hibernate, as reported in the comment above, starts as a suspend with no marker, so the session is locked before the suspend and still asks twice after resume. That case is not covered by #8910.
  • Skipping the lock trades the session password for the disk passphrase on that path. That is a policy choice rather than a defect, and the pull request notes its own hardware hibernate retest is still pending.

Nothing was run for this issue: the fix is reviewed as its own item under #8910. Reviewed by Claude Opus 5.5 with a second opinion from Codex Medium, which agreed on the cause, the link and the suspend-then-hibernate gap; its independence is not guaranteed. This now waits on the maintainer's decision on #8910.

omarchybot avatar Oct 09 '26 07:10 omarchybot

#8910 predicts the sleep type before sleep, which is why it races and can't cover suspend-then-hibernate (the lock is correctly taken at the suspend phase). Suggest deciding after resume instead:

  1. Keep locking before every sleep, unchanged.
  2. A system-sleep hook on post checks SYSTEMD_SLEEP_ACTION=hibernate. systemd sets this only when a hibernate actually happened, including the hibernate phase of suspend-then-hibernate; a failed one reports suspend-after-failed-hibernate. If root is stock interactive LUKS (cryptdevice=, no keyfile/TPM), it writes a short-lived, root-owned, boot-id-bound marker in /run.
  3. On wake, the lock service validates the marker and dismisses itself; otherwise the normal prompt shows.

No pre-sleep race, no lid-close special cases, covers both menu hibernate and suspend-then-hibernate, and every failure leaves the lock in place. What's left is the policy call: should the disk passphrase count as session auth? Happy to open a PR and test on a Lunar Lake Zenbook if this direction is acceptable.

muneebabbas avatar Nov 12 '26 21:11 muneebabbas

The November 12 post-resume suggestion has one failure case: in systemd v262, post hooks run after the kernel sleep request fails as well as after a successful return, with SYSTEMD_SLEEP_ACTION still naming the attempted operation. A marker based only on post plus hibernate could therefore dismiss the lock without any boot authentication. See systemd's failure handling and post-hook dispatch. Root ownership and a boot ID do not distinguish those outcomes.

There is also another open proposal, #18117. It and #8910 both skip the pre-sleep lock for selected plain-hibernate requests; neither implements the suggested post-resume unlock or covers suspend-then-hibernate. #8910 already links this issue for closure.

I checked both diffs and the current quattro sleep-monitor and native lock code. The lock has no unlock IPC method, so the proposed post-resume approach needs a new authenticated handoff. This remains with the maintainer to decide how boot authentication should authorize the restored session and which approach to pursue. Neither PR was executed or hardware-verified in this issue review; each is worked separately.

Reviewed by GPT-6 High in Codex, with second opinions from Opus 5.5 High and muse-wonder via pi, thinking high. They agreed on these source findings and the waiting-maintainer disposition; their independence is not guaranteed.

omarchybot avatar Nov 18 '26 02:11 omarchybot