Skip to content

Lifecycle dispatch interface, wired into owner provisioning - #540

Merged
maralcbr merged 12 commits into
quattro-upstreamfrom
mac/20-lifecycle-dispatch
Sep 25, 2026
Merged

maralcbr merged 12 commits into
quattro-upstreamfrom
mac/20-lifecycle-dispatch

Conversation

@maralcbr

@maralcbr maralcbr commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Ticket 20 of the Apple Silicon convergence plan: the lifecycle dispatch interface, with owner provisioning as its one real caller.

Stacked on #514 (mac/13-hw-platform). #517 (mac/18-generic-luks) is merged into this branch, because the caller is the journaled re-key that #517 adds. Once both land, only this ticket's commits remain in the diff.

What changed

  • omarchy-lifecycle-dispatch <operation> runs one of a fixed set of boot lifecycle operations through the platform's boot package: provision-prepare/commit/verify, reset-prepare/verify/rollback, update-preflight/verify and boot-rebuild.
    • Only apple-silicon is registered. Its entrypoints are /usr/lib/omarchy/mac-boot/<operation>, from omarchy-mac-boot, and every operation except update-preflight is required.
    • On x86, generic aarch64 and Qualcomm, every operation is a no-op, and callers keep their generic path.
    • A missing required entrypoint fails with a clear message, for example: provision-prepare on apple-silicon needs omarchy-mac-boot, which provides /usr/lib/omarchy/mac-boot/provision-prepare; it is not installed.
  • Nothing in the environment decides what runs as root.
    • The dispatcher runs as bash -p with a fixed PATH, and runs the detector under env -i.
    • An entrypoint must be a root-owned file with root-owned parent directories that nobody else can write, and no symlinks.
    • Entrypoints run with an empty environment.
    • Fixture roots work only for unprivileged callers.
  • Owner provisioning goes through the dispatcher:
    • provision-prepare runs before the owner form on each attempt.
    • The re-key's boot-time unlock callbacks use provision-commit and provision-verify when the platform implements both, and the existing Limine UKI callbacks when it implements neither. Anything in between fails closed.
    • The stale-entry refresh after a factory reset rebuilds through boot-rebuild where the platform implements it, instead of limine-update.
    • x86 runs the same code as before.
  • docs/lifecycle-dispatch.md is the contract. It covers the operations, registration, trust rules, caller shapes, the Converge Apple installation with shared Omarchy and package boot support #503 mapping and how Qualcomm plugs in.

Mapping for #503

#503's Apple modules become the implementation through thin entrypoints. The modules stay in /usr/lib/omarchy-mac/boot, and packages/omarchy-mac/boot/install gains one loop that stages entrypoints/* into /usr/lib/omarchy/mac-boot/.

#503 today Operation
The "Required omarchy-mac-boot provision support is unavailable" refusal, plus the Apple checks in run_setup provision-prepare
apple_rekey_boot (drop rd.luks.key=, mkinitcpio -P, omarchy-mac-boot-update), removing /boot/omarchy/luks-key, mark_encrypt_finished provision-commit
The Apple half of require_finished_luks, plus the encrypt.state finished check provision-verify
stage_luks_rekey_apple and rebuild_next_boot_apple (ticket 34) reset-prepare, reset-verify
mx-mac's reset rollback reset-rollback
omarchy-mac-boot-update boot-rebuild
omarchy-apple-silicon-boot-check (ticket 35) update-verify

The slot steps in rekey_luks_apple fold into #517's shared journal. Whether the recovery passphrase stays Apple-only is ticket 33's decision.

Testing

  • New test/shell.d/lifecycle-dispatch-test.sh, run on the Apple, Qualcomm, generic aarch64 and x86 fixtures. It covers:
    • no-ops, with Mac entrypoints on disk that would fail if they ran
    • Apple with and without the boot package
    • arguments, exit status and the cleared environment
    • untrusted entrypoints, usage errors and an undetermined platform
    • root ignoring fixture roots, BASH_ENV and exported functions (under a namespaced root)
  • test/shell.d/luks-rekey-journal-test.sh now goes through the real dispatcher.
    • The kill-after-every-step matrix runs on x86 (fake, LUKS2 and LUKS1 volumes). The Limine path is unchanged and no Mac entrypoint runs.
    • The same matrix runs on Apple with a fake boot package.
    • Setup stops before the owner form when the package is missing or not ready.
    • The worker fails closed without the package.
    • The stale-entry refresh is covered on both platforms.
  • Seeded regressions in the dispatcher and the provisioning caller were all caught. The one exception was the explicit symlink check, which the permission check also enforces.
  • Full ./test/all as non-root, base against branch:
    • aarch64 (Arch Linux ARM container): the same 23 files fail on both, from missing container dependencies; the new file passes.
    • x86 (the CI's Arch image): 5 files fail on both, from the missing sibling checkouts and known issues. The new files pass. Two sleep tests (sleep-lock-test.sh, system-sleep-ownership-migration-test.sh) swapped places between the runs. Reruns show both are flaky on base too.
  • The journal test also runs as root, where only its x86 runs apply.
  • Not done: the encrypted-install VM on the x86 Proxmox worker, which is not available yet. No hardware is needed until tickets 32 and 34.

Second review: round one found four issues, and all are fixed with tests:

  • the root caller's environment reached the dispatcher before its PATH reset
  • an inherited UNLOCK_OWNER was trusted
  • the generic Limine rebuild ran on Apple for stale entries
  • operation names were matched as substrings

The confirming round could not run in that tool until its quota resets on 2026-09-30. An independent confirming review found the fixes correct and no root-trust gaps. It flagged three weak test assertions and some doc wording, both fixed here.

@maralcbr
maralcbr changed the base branch from mac/13-hw-platform to quattro-upstream September 25, 2026 10:19
Keep #527's direct Apple re-key until omarchy-mac-boot ships its dispatch
entrypoints: the provisioning and boot-rebuild operations stay optional on
Apple until tickets 32, 35 and 36 make them required.
@maralcbr
maralcbr merged commit 6486b38 into quattro-upstream Sep 25, 2026
5 checks passed
maralcbr added a commit that referenced this pull request Sep 25, 2026
…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.
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