Skip to content

Apple owner provisioning through lifecycle dispatch entrypoints - #545

Merged
maralcbr merged 7 commits into
quattro-upstreamfrom
mac/32-apple-provision
Sep 25, 2026
Merged

maralcbr merged 7 commits into
quattro-upstreamfrom
mac/32-apple-provision

Conversation

@maralcbr

@maralcbr maralcbr commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Ticket 32 of the Apple Silicon convergence plan: Apple owner provisioning (install.conf handoff, the initramfs conversion's re-key, firmware ordering and ESP selection) now goes through the lifecycle dispatch interface.

Base is mac/04-land-503 (#527, merged in at 0b08030ae). #540 (mac/20-lifecycle-dispatch, df641c871) is merged into this branch, so the diff shows #540's commits as well; once #527 and #540 land, only the last commit remains. These three should merge together: #540 alone makes Apple provisioning fail without these entrypoints.

What changed

  • omarchy-mac-boot ships provision-prepare, provision-commit and provision-verify in /usr/lib/omarchy/mac-boot, one install loop, thin wrappers around Converge Apple installation with shared Omarchy and package boot support #503's lib/provision.sh.
    • They re-check the platform, run as bash -p, and as root ignore the environment and use a fixed PATH.
  • provision-prepare (read-only, before the owner is asked anything) refuses:
    • a plain root when first boot recorded encrypt=1, which it records for an absent install.conf, so an absent install.conf still means encrypting
    • an unfinished conversion, or a LUKS device /etc/crypttab doesn't name
    • an initramfs that doesn't load the vendor firmware before the password prompt
    • boot files that don't go to the ESP the device tree names (omarchy-mac-esp, ported from omarchy-mx-mac)
  • provision-commit drops rd.luks.key=, rebuilds, checks the rebuilt initramfs still orders the firmware, then removes the boot-partition key and records phase=finished with the owner and acknowledged recovery slots. A failure restores rd.luks.key=, and the key goes last, so the retry still boots unattended. It never touches the key while a conversion is unfinished.
  • provision-verify fails while the boot-partition key, rd.luks.key= in GRUB's defaults or the loader's command line, or an unfinished encrypt.state remain.
  • Core: omarchy-provision-owner loses Converge Apple installation with shared Omarchy and package boot support #503's Apple re-key, encrypt.state and GRUB handling. The Mac boot chain is reached only through dispatch.
    • The Apple re-key runs in the shared journal. luks-rekey.sh keeps a recovery slot once the owner acknowledged its key, and retires an unacknowledged one; x86 never records one.
    • The recovery key stays Apple-only (recovery_key_offered), as in Converge Apple installation with shared Omarchy and package boot support #503. Whether every encrypted install gets one is ticket 33's call. Once it sits beside the owner slot, a retry must use the same password.
  • docs/lifecycle-dispatch.md and the boot README describe the implementation.

Not here: boot-rebuild, which provisioning uses only to refresh stale Limine entries after a factory reset (tickets 34/35 own it), and pointing omarchy-mac-limine-deploy at omarchy-mac-esp (gap-audit B6).

Testing

  • New packages/omarchy-mac/boot/test/mac-provision-test.sh runs the staged entrypoints against a fixture root:
    • the install.conf handoff, including an absent install.conf recorded by first boot
    • the firmware, ESP and unmounted-Boot-partition refusals, and the platform re-check
    • commit on GRUB and Limine Macs, failure restore (including after an interrupted attempt), resume and idempotency, and never touching an unfinished conversion's key
    • every verify leftover
  • test/shell.d/provision-owner-luks-test.sh now drives omarchy-provision-owner through the real dispatcher and the real staged entrypoints: recovery key, re-key, failed rebuild and retry, retry after commit, leftovers stopping setup, xtrace.
  • luks-rekey-journal-test.sh (x86 crash matrix unchanged) adds kept and retired recovery slots. mac-boot-provider-test.sh fails if core names Mac boot files again. Also new: mac-esp-test.sh, and entrypoint staging in mac-boot-install-test.sh.
  • CI (Tests, Package resolution) passes on 95d90cfeb via workflow_dispatch, since this base triggers no PR checks.
  • In the Arch ARM container, the full runtime suite has no new failures: 6 fail on the base too, and the sleep and sshd migration tests are flaky (they pass on rerun). The boot package test/all passes, and so does the disposable in-place conversion test (privileged container).
  • Read-only check on the M2 Max: its real initramfs lists all three firmware-ordering files provision-prepare requires, and its ESP is the device-tree partition at /boot/efi.
  • Not done: VM acceptance of an encrypted fresh install. It needs ticket 23's image, and the mac-image harness needs an Apple device-tree identity and keystrokes for owner setup. The exact steps are in the ticket.

Second review, two rounds:

  • The first round found no blockers. It found one major issue: a retry after an interrupted commit could leave the boot key unnamed on the command line. It also found minor gaps: a stale recovery slot in encrypt.state, an empty phase, weak leftover tests, and xtrace.
  • The confirming round found no blockers. Its minor finding was that the entrypoints did not require the image's Boot partition at /boot. Its nits were an ESP override honoured as root, the journal message, and the docs.
  • All are fixed with tests. Left out: Converge Apple installation with shared Omarchy and package boot support #503's encrypt.state owner-slot backstop for a lost journal, which no in-repo path reaches.

…erface

# Conflicts:
#	bin/omarchy-provision-owner
#	test/shell.d/luks-rekey-journal-test.sh
omarchy-mac-boot now ships provision-prepare, provision-commit and
provision-verify in /usr/lib/omarchy/mac-boot, wrapping #503's provision
module. Owner provisioning keeps only dispatch calls for the Mac boot chain:
the Apple re-key folds into the shared journal, which keeps an acknowledged
recovery slot, and the Apple-only recovery key stays a core policy.

provision-prepare holds setup to the encryption install.conf asked for (an
absent one means encrypt), the vendor firmware before the password prompt
and the ESP the device tree names (omarchy-mac-esp, from omarchy-mx-mac).
A failed commit put rd.luks.key= back only when the same attempt had removed
it, so an attempt killed after rewriting GRUB's defaults left a retry with the
key on the boot partition but no command line naming it. Also drop a stale
recovery slot from encrypt.state, refuse an encrypt.state without a phase,
log the real reason provision-prepare refuses, and keep the password out of
xtrace in rekey_accepts_password.
…points

With it unmounted, /boot is a directory on the root and commit, verify and
the initramfs rebuild would all work on the wrong files. Also keep a
recovery slot that equals the owner slot out of encrypt.state, read the
device-tree ESP node only from the live system as root, and say which
slots the journal found when they are not the kept ones.
@maralcbr
maralcbr changed the base branch from mac/04-land-503 to quattro-upstream September 25, 2026 13:31
…sion

#540 landed with the provisioning operations optional on Apple, so owner
setup kept #527's direct Apple re-key until omarchy-mac-boot shipped its
entrypoints. This branch removes that direct path, so an optional operation
would now send a Mac to the generic Limine path, which leaves the
boot-partition key and rd.luks.key= behind. omarchy-mac-boot 20260925-2 ships
the entrypoints, so provision-prepare, -commit and -verify are required again,
as the contract planned for this ticket: a Mac with an older package stops
before the owner form naming it. boot-rebuild stays optional until tickets 35
and 36 ship it.
…t-rebuild

The stale-entry refresh test only ran against a fake boot-rebuild the real
package does not ship. Also make the old-package case look like #527's
package, and correct the contract's boot-rebuild row.
@maralcbr
maralcbr merged commit 4e56f1d into quattro-upstream Sep 25, 2026
5 checks passed
maralcbr added a commit that referenced this pull request Sep 25, 2026
Owner provisioning and its journal test take quattro-upstream's version,
which already carries #540 and ticket 32. The dispatch contract keeps both
sides; boot-rebuild stays optional until ticket 36, since the update path
does not call it.
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