Repository navigation
Change the root LUKS key before syncing login and root passwords - #532
Merged
Merged
Conversation
omarchy-drive-password now keeps the login and root passwords on the system disk's passphrase, as installation sets them, but only after the new LUKS key is confirmed to open the disk. A secret-free journal lets the next run finish an interrupted change, and other encrypted drives change alone.
Ask for the current password up front and journal its slot, the pre-change slots and the disk UUID, so a rerun accepts only the old or new key (never another key such as a recovery passphrase), retires whichever the interrupted change left behind, and finds the disk after renumbering. Judge luksChangeKey by whether the new key opens the disk rather than by its exit status, fail closed when / cannot be resolved, serialise runs with a lock and never trace passwords.
On LUKS1 the old-key retirement would otherwise find the new key in the slot it had just been written to and kill it. Retire only a slot the old key still opens in its original place.
Pass argon2id only to LUKS2, so LUKS1 drives can change at all, and keep retiring slots until the old key opens nothing. Hold a disk lock around every cryptsetup step so one left running by a killed run finishes before the next run reads the drive. Fail closed on a crypt layer lsblk cannot name, refuse a journal without its slot list, and never remove more than the one slot an interrupted change added.
maralcbr
changed the base branch from
mac/18-generic-luks
to
quattro-upstream
September 25, 2026 10:09
maralcbr
added a commit
that referenced
this pull request
Sep 25, 2026
Brings in the password sync (#532), audio (#535), display (#533), Wi-Fi resume (#529) and battery charge limit (#525) work. omarchy-drive-password takes #532's version. It already carries what #503 added (no tracing, the new password over stdin), and it has no Apple branch. #503's drive-password-apple-test.sh asserted that the disk password never changes the login or root password, which ticket 19 replaced with a journaled LUKS-first sync for the system disk; drive-password-test.sh covers the shared behaviour, so the Apple copy goes.
This was referenced Sep 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket 19. Stacked on #517 (
mac/18-generic-luks), whose journal helpers it reuses. The same fix for the frozen fork is maralcbr#272.What changed
omarchy-drive-passwordnow keeps the drive holding/, the login user and root on one password, as installation sets them. For that drive it asks for the current password and checks it opens the disk, changes the LUKS key, confirms the new key opens the disk and the old one no longer does, and only then runschpasswdfor the login user and root. Any other encrypted drive changes its LUKS key alone and leaves the accounts untouched.A journal in
~/.local/state/omarchy/drive-password.state(LUKS UUID, key slots, phase; never a password, written withrekey_state_put) lets the next run finish an interrupted change. The rerun asks for the password the disk opens with now and accepts only the old key (removing the slot the interrupted change added) or the new one (retiring the old slot). Once the new key is confirmed only its slot is accepted, so another key such as a recovery passphrase never becomes the login password. The outcome ofluksChangeKeyis judged by whether the new key opens the disk, not by its exit status.Runs are serialised, and every
cryptsetupstep holds a disk lock so one left running by a killed run finishes before the next run reads the drive. A/whose LUKS partition cannot be resolved fails closed. The script never traces passwords.Behaviour changes, all platforms (x86 included; quattro-upstream and upstream Quattro changed only the LUKS key):
guminstead of cryptsetup's prompt, and a new password equal to it is refused--pbkdf argon2idis passed only to LUKS2, since LUKS1 rejects it, so LUKS1 drives can change their password againNot covered: typing a recovery passphrase as the current password still rotates that slot rather than the daily key, as before. That belongs with ticket 33.
Testing
test/shell.d/drive-password-test.sh(rewritten): fake slot-table drives plus the realcryptsetupon file-backed LUKS2 and LUKS1 volumes with the command's own KDF. Everycryptsetupandchpasswdcall is a crash point; the run is killed after each step, rerun with the old or the new password, and each rerun is killed after each of its own steps.luksChangeKey,luksChangeKeydying between keys, an orphanedluksChangeKey, recovery key refused before and after confirmation, renumbered disk found by UUID, failed or unnamed root lookup, unreadable journal, slots enrolled after the crash, failedchpasswd root, concurrent runs,bash -x, one-slot disk, LVM on LUKS, unencrypted root, data drive leaves the login unchanged.test/allin an Arch aarch64 container: same failures as the base branch (environment-only files).test/clipasses.Second review, two rounds, all findings fixed and covered above:
luksChangeKeydropped the journal; a recovery passphrase was accepted before confirmation; an interrupted LUKS1 rotation left the old key valid; root lookup failed open; runs could interleave; tracing leaked passwords.cryptsetupescaped the lock; empty slot lists and extra slots were trusted.A confirming pass on the final diff is pending.