Skip to content

Fix launchd domain mismatch between container system start/stop - #2050

Draft
JaewonHur wants to merge 1 commit into
apple:mainfrom
JaewonHur:use-user-501-only
Draft

Fix launchd domain mismatch between container system start/stop#2050
JaewonHur wants to merge 1 commit into
apple:mainfrom
JaewonHur:use-user-501-only

Conversation

@JaewonHur

Copy link
Copy Markdown
Contributor

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

getDomainString() picked gui/ or user/ based on the calling shell's launchd session type (Aqua vs Background), so registering the apiserver from a GUI Terminal and stopping it from tmux/ssh computed different domains, causing bootout to silently target a domain the service was never registered in.

Always resolve to user/ instead: it's the parent of the Aqua session domain for the same UID, so lookups from GUI shells still find it, and start/stop now agree regardless of which shell invokes them.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

getDomainString() picked gui/<uid> or user/<uid> based on the calling
shell's launchd session type (Aqua vs Background), so registering the
apiserver from a GUI Terminal and stopping it from tmux/ssh computed
different domains, causing bootout to silently target a domain the
service was never registered in.

Always resolve to user/<uid> instead: it's the parent of the Aqua
session domain for the same UID, so lookups from GUI shells still find
it, and start/stop now agree regardless of which shell invokes them.
@JaewonHur
JaewonHur marked this pull request as draft July 31, 2026 18:30
@JaewonHur

Copy link
Copy Markdown
Contributor Author

Has some issue when container system needs a GUI alert for user, like asking keychain password.

@github-actions

Copy link
Copy Markdown

Code Coverage

Tier Line Coverage
Unit 24.35%
Integration 66.19%
Combined 75.6%

@jglogan

jglogan commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@JaewonHur what issue does this fix?

@JaewonHur

Copy link
Copy Markdown
Contributor Author

I often do container system start on normal terminal, or tmux terminal. Then, every time, the container launchd services are started under different domain (i.e., gui/501 when starting from normal terminal, user/501 when from tmux). It gets confusing when stopping container system because stopping it from different domain tricks me as if the system is stopped correctly, but not. I often wasted my time debugging leftover launchd services.

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.

2 participants