Skip to content

Move the Mac factory-reset first-boot markers into reset-prepare - #579

Merged
maralcbr merged 3 commits into
quattro-upstreamfrom
mac/81-reset-prepare-marker
Sep 26, 2026
Merged

maralcbr merged 3 commits into
quattro-upstreamfrom
mac/81-reset-prepare-marker

Conversation

@maralcbr

Copy link
Copy Markdown
Member

Ticket 81. The runtime factory reset is now upstream/48-lifecycle-dispatch's omarchy-system-factory-reset. The Mac first-boot marker handling it used to do inline now lives in omarchy-mac-boot's reset-prepare.

What changed

  • Runtime: bin/omarchy-system-factory-reset is upstream/48's file, except for one line. The passphrase check keeps --token-type passphrase-only, which quattro-upstream had since Apple factory reset through lifecycle dispatch #552 and upstream/48 dropped. That line should go into upstream/48. The file also brings in upstream's stricter account scrub and its slot lookup by key, and drops the quattro-only test hooks.
  • reset-prepare: after the boot-file backup, it clears the fresh image's first-boot state (mac-first-boot/deferred-steps, install.conf, the ESP install.conf) from the factory root and arms mac-first-boot/pending. It also clears that state and owner setup's markers from the sealed @factory beside the root. It unseals @factory only when something is there, and reseals it after. A factory root with no @factory beside it is refused.
  • Tests: upstream's factory-reset-dispatch-test.sh and factory-reset-accounts-test.sh are added. factory-reset-luks-test.sh now loads the functions the way upstream's tests do, and checks the markers after a full Apple reset through the real entrypoints. Two tests no longer source the reset script, which now elevates with sudo when run.

Publish order

Recorded in docs/lifecycle-dispatch.md. An omarchy-mac-boot pin that includes this must publish before any runtime without the inline handling. Otherwise a reset leaves the factory root without the Mac's first boot, which makes its package keyring, or with an older image's conversion token. A new boot package with an older runtime is safe: the steps are idempotent.

Behaviour change

A reset cancelled at the passphrase prompt no longer clears @factory's first-boot markers. The next reset that reaches reset-prepare clears them. Completed and rolled-back resets behave as before.

Testing

  • As non-root in an arm64 Arch container:
    • mac-reset-test.sh, factory-reset-luks-test.sh, factory-reset-dispatch-test.sh, mac-boot-provider-test.sh, provision-root-environment-test.sh and lifecycle-dispatch-test.sh pass, after the merge of current quattro-upstream.
    • factory-reset-accounts-test.sh passes with user namespaces allowed.
  • Mutation checks: dropping the arming or the @factory scrub fails both the boot-package suite and the runtime suite. The second review broke the marker handling eight ways, and each break was caught.
  • x86 VM on omarchy-gpu (overlay of the encrypted integ install, running this branch's script):
    • The reset staged with exit 0: a throwaway slot, a UKI keyfile and the owner-setup markers. No mac-first-boot was created, the root hash in @ and @factory is !, and there are no account backups. @factory stays read-only.
    • After a reboot the machine reached "Press Return to Start Setup" unattended.
    • The VM and its disk were deleted.
  • Not run: the Apple VM factory-reset scenario (not automated yet, needs an aarch64 KVM host) and hardware.

Second review: no blockers. It found one doc line that called the passphrase check upstream's, now fixed, and the cancel-path difference above. Fable re-check owed.

… reset

omarchy-system-factory-reset is now upstream/48-lifecycle-dispatch's, which
arms only owner setup. omarchy-mac-boot's reset-prepare re-arms
mac-first-boot/pending in the factory root without the conversion token or
install.conf, and drops them and owner setup's markers from the sealed
@factory beside it, as the runtime did inline. The reset's passphrase check
keeps --token-type passphrase-only, which upstream/48 lacks.
@maralcbr
maralcbr merged commit 0c5d088 into quattro-upstream Sep 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant