Skip to content

Bootstrap into system domain as root outside Aqua - #2058

Open
rogerneal wants to merge 2 commits into
apple:mainfrom
rogerneal:fix/2008-system-domain-bootstrap
Open

Bootstrap into system domain as root outside Aqua#2058
rogerneal wants to merge 2 commits into
apple:mainfrom
rogerneal:fix/2008-system-domain-bootstrap

Conversation

@rogerneal

@rogerneal rogerneal commented Aug 2, 2026

Copy link
Copy Markdown

Summary

  • When running as root (euid == 0) outside an Aqua session, bootstrap into the system domain instead of user/0 or gui/0.
  • Align launchd helpers with that domain:
    • isRegistered uses launchctl print for domain-qualified targets
    • SystemStatus checks domain/label
    • register idempotency queries the same domain it bootstrapped into
    • SystemStop compares bare labels from enumerate correctly before re-qualifying for bootout

Stacked on #2045. Related to #2008 and #1514.

Test plan

Tested

  • Unit tests for root-outside-Aqua → system domain selection

Not tested

  • Exact GitHub Actions macos-26 reproduction: sudo container system start --enable-kernel-install
  • Confirm start succeeds without XPC connection error: Connection invalid
  • container system status reports registered/running in the same sudo/root context
  • Second container system start remains idempotent

Please merge #2045 first; this branch is based on it.

Surface launchctl exit status and stderr from ServiceManager.register
instead of continuing into a misleading apiserver XPC error. Keep
container system start idempotent when the service is already registered.

The system-domain bootstrap change for root outside Aqua is intentionally
left to a follow-up so this can merge on its own evidence.

Fixes apple#2008
When euid is 0 and the session is not Aqua, bootstrap launchd services
into the system domain instead of user/0 or gui/0. Align status, stop,
and registration idempotency with that domain.

Related to apple#2008 and apple#1514.
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