Repository navigation
Apple factory reset through lifecycle dispatch - #552
Merged
Merged
Conversation
Factory reset reaches the Mac's boot chain only through omarchy-lifecycle-dispatch: omarchy-mac-boot's reset-prepare stages and rebuilds the factory root's boot files, reset-verify proves they boot it, reset-commit writes the Boot partition key after the switch, and reset-rollback restores the previous boot state on any earlier failure. x86 keeps its Limine UKI path.
…tried reset rollback
…ple-factory-reset # Conflicts: # bin/omarchy-system-factory-reset # docs/lifecycle-dispatch.md # test/shell.d/factory-reset-luks-test.sh
maralcbr
added a commit
that referenced
this pull request
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 34.
omarchy-system-factory-resetno longer sourcesomarchy-mac-boot's module on Apple Silicon: it reaches the Mac's boot chain only throughomarchy-lifecycle-dispatch, andomarchy-mac-bootimplements the reset operations as entrypoints around #503's module.What changed
reset_boot_ownerresolves the reset operations. All resolve: the platform owns the factory root's boot chain. None resolve (x86, Snapdragon, generic aarch64): the existing Limine UKI path runs unchanged. Some, or a resolution failure (Apple without the entrypoints): the reset stops, with the dispatcher's error naming the package.reset-prepare <factory-root> [<luks-device>], thenreset-verify <factory-root>. After verification the throwaway slot is added and the subvolumes switch. Last,reset-commitreceives the throwaway on stdin. If anything fails before the switch,reset-rollbackruns, then the slot this attempt added is revoked and the clone is deleted, so the previous root still boots with its own boot files and encryption state.reset-prepare,reset-verify,reset-commitandreset-rollback. Prepare backs up the live boot files and stages the unlock (crypttab andrd.luks.key=). It starts the Limine menu over on the ESP thatomarchy-mac-espnames (/boot/efior/boot), refusing an ESP Limine doesn't write to. It rebuilds inside the factory root and reopensencrypt.statelast. Every refusal happens before anything changes: kernel drift from/boot, a bad factory root, device or ESP, a stale reset, or a failed backup. Verify is read-only. It checks the kernel against/boot, that the initramfs loads the firmware before the prompt, and that the unlock is on the GRUB defaults and on the loader's command line. On Limine it also checks the menu's entry for the factory root's machine-id and every UKI hash. Commit writes/boot/omarchy/luks-keydurably (mode 600) and drops the backup. Rollback restores the boot files andencrypt.state, and puts the old menu back only when its UKIs are back too.reset-commit, required on Apple. Land #503 with the review fixes and the gap-audit merge blockers #527 writes the Boot-partition key only after the switch, so a power loss before the switch never auto-unlocks the previous root. The three defined operations all run before the switch, so a post-switch step was needed to keep that guarantee. The alternative is to write the key inreset-prepare: that reopens a window of under a second, between the slot being added and the switch becoming durable, where a power loss would auto-unlock the old root.docs/lifecycle-dispatch.mdrecords the arguments, the order and the Apple mapping.Testing
packages/omarchy-mac/boot/test/mac-reset-test.shruns the staged entrypoints on fixtures. It covers the platform re-check, GRUB and Limine Macs, an ESP at/boot, every verify failure, rollback after each failure point, a partial restore, the kernel/ESP/stale refusals, unencrypted resets and a failed key write.test/shell.d/factory-reset-luks-test.shnow runsstage_full_resetthrough the real dispatcher. On x86, no Mac entrypoint runs. The Apple cases: a finished reset (prepare → verify → slot → switch → commit, and the throwaway never in argv), a failed verification that rolls back to the previous root with no slot added, and a failure after the slot, where the slot is revoked and the boot state restored. It also covers the token passphrase case (Security: keep enrolled LUKS2 tokens from passing LUKS key checks #549) and a real file-backed LUKS2 volume with a keyring token.--token-typeflag and a hash of the random throwaway.packages/omarchy-mac/boot/test/all(all ok), and./test/allon base and branch. Branch fails the same files as base (config, hermes-remove, snapper and unowned-system-paths, which need an omarchy-pkgs checkout), plussystem-sleep-ownership-migration-test, which is flaky on base too (2 of 5 base runs failed the same assertion).omarchy-system-factory-resetin the guest, with the same staged result: throwaway slot, UKI keyfile and drop-ins, a rebuilt UKI keyed to the new machine-id. Both rebooted with no passphrase to "Press Return to Start Setup". VMs and overlays were deleted.Second review: no blockers. Its verified points are fixed: binds that won't unmount are detached before the clone is deleted, the dispatch doc now notes the new firmware-ordering refusal, and a test covers a second reset attempt after a partial rollback. It asks for one Apple run under the dispatcher's real empty environment, which is in the VM steps.