You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Does not work with account with home directory in external drive over ssh, even after su into local user with local home directory #205
If possible, I've reproduced the issue using the 'main' branch of this project
Steps to reproduce
container system start in an ssh session
Current behavior
When ssh into the mac, container system start returns the following error:
Verifying apiserver is running...
Error: internalError: "failed to get a response from apiserver: interrupted: "XPC connection error: Connection invalid""
It looks like the GUI is a dependency, which is weird since this framework is supposed to run containers, and in a lot of use cases, people want to do this when using mac as a headless server.
Expected Behavior
The container should start as normal.
Environment
- OS: 15.3.1 (24D70)
- Xcode: xcode-select version 2409. xcode not installed
- Container: N/A
Sorry, I'm not quite following. It's totally normal, that you get XPC connection error if apiserver is not running.
The initial error is suspicious, because container system start starts the apiserver and then pings it to verify it's running. But starting apiserver may take some time, so it's possible, that ping is called when it's not yet running. If you could reproduce it, could you check apiserver after the system start by running any container, for example?
Running containers should be possible without a GUI, and in a SSH session. The GitHub workflows on PRs exercise this functionality. As the other have pointed out you need to first run the container system start command, before trying to run any containers
If you are able reproduce the behavior, could you share what this command returns?
I think I know what happened. I logged in an LDAP-backed account and then su to a local service account. Then I ran the container system start command there. It fails with the error.
If I (1) directly ssh into the local account or (2) ssh into a local account then su into another then everything works. So maybe this is an LDAP-binding issue.
Also in both the failing case and successful case, launchctl managername shows Background.
In the LDAP account, if I run container system start, it gets stuck forever. And container system logs returns log: Could not open local log store: Operation not permitted. I guess this is because some system directories are not created in my LDAP binding.
But this does not explain why it does not work after su into a local admin where all there directories exist.
For me, directly on a Mac mini with macOS 15.5, my main user has its home directory on an external drive - container system start does not work. Moving over to another account that has the home directory on the internal drive - it works.
I don't know if that would be the same as this issue since I'm not using it over SSH. But it sounds like it could be.
I noticed this in another CLI application. I had to add Full Disk Access permission for it to work. (System Settings -> Privacy & Security -> Full Disk Access). Not sure if it'll work here, but wanted to mentioned it
I noticed this in another CLI application. I had to add Full Disk Access permission for it to work. (System Settings -> Privacy & Security -> Full Disk Access). Not sure if it'll work here, but wanted to mentioned it
Container Version: 0.3.0 (both Homebrew and built from source)
Xcode Version: 16.4 (Build 16F6) and Xcode 26 beta
Home Directory: Located on external SSD at /Volumes/Disco/Users/
XPC connection error during container system start
Here is the error:
% container system start
Verifying apiserver is running...
Error: interrupted: "internalError: "failed to get a response from apiserver: interrupted: "XPC connection error: Connection invalid""
Ensure container system service has been started with container system start."
% launchctl managername
Aqua
% which container
/usr/local/bin/container
I tried building from source, using the signed release package, and using brew. All same error.
The apiserver service fails to register with launchd.
% launchctl list | grep -E "container|apiserver"
449 0 com.apple.containermanagerd
% launchctl print gui/$(id -u)/com.apple.container.apiserver
Bad request.
Could not find service "com.apple.container.apiserver" in domain for user gui: 501
The apiserver binary executes successfully when run directly from a local build: container-apiserver --help works
Like I said, new Mac. The only "jank" in my setup is having my home dir on external ssd. Any update? or something I can run to create a new lead?
Have similar issue, and it is pretty easy to reproduce actually without having a user home directory not on internal drive.
I have NVMe RAID0 mounted as /Volumes/DATA, where I wanted to move all the containers/images.
I tried first to do ln -s /Volumes/DATA/Container ~/Library/Application\ Support/com.apple.container to see if it will be possible to just trick the system. It failed to start.
But I noticed the option container system start --app-root /Volumes/DATA/Container, so I gave it a try, and got the same issue
container system start -a /Volumes/DATA/Container
Verifying apiserver is running...
Error: interrupted: "internalError: "failed to get a response from apiserver: interrupted: "XPC connection error: Connection invalid""
Ensure container system service has been started with `container system start`."
fwiw: In my testing, the container process call to launchctl to start the apiserver fails when the apiserver.plist is created on an external drive (reproduced on the command line). Configuring the approot to use the internal drive enables the apiserver to start and serve some xpc requests. However later services required to run a container fail (still investigating), though approot appears to be correctly obtained from the apiserver.
I don't know if there are any other issues behind the plist issue, but I think the thing for the interested developer to try out is to locate all plists that we launch from on the system volume.
I think it might be helpful for diagnostic purposes for the various managers to locate plists with all the other resource-specific infomation. Right now the PluginLoader writes the plist to pluginStateRoot but we could have it also write to, say, a common directory on the system volume that holds all the plists that we actually launch from. We could have system start create that as a temp directory and then plumb that down to the API server and plugins as CONTAINER_LAUNCH_ROOT just like our other base directories.
I can reproduce the apparent GUI-session dependency in a more controlled setup.
This is not an external-home-directory issue and does not depend on SSH. The affected account has a normal local home directory on the internal disk.
Summary
container works:
for root from a headless system LaunchDaemon;
for an unprivileged service account after that account has an Aqua session.
It does not work for that same unprivileged account when it is run headlessly through a system LaunchDaemon with UserName=<service-account>.
The failure is permanent, not a startup race: container system start creates the per-user apiserver.plist, but com.apple.container.apiserver is never registered in a usable bootstrap domain, and all subsequent CLI calls fail with XPC connection error: Connection invalid.
This prevents using Apple Container as an unattended service runtime owned by a non-admin service account.
Environment
macOS: <paste sw_vers output>
Hardware: Apple silicon Mac mini
Container version: <paste container version output>
Install location: /usr/local
Service account: standard, non-admin local user with home at /Users/gitlab
The account is not logged in during the failing test.
The account home directory is on the internal system volume.
Reproduction
Create a standard local user, for example gitlab, with a normal local home directory.
Install a system LaunchDaemon that runs only:
<key>UserName</key>
<string>gitlab</string>
<key>ProgramArguments</key>
<array>
<string>/bin/zsh</string>
<string>-c</string>
<string>
/usr/local/bin/container system start --timeout 60
/usr/local/bin/container list --all
</string>
</array>
Load it in the system domain while gitlab is not logged in.
Launching container-apiserver...
Testing access to container-apiserver...
Error: internalError: "failed to get a response from apiserver: interrupted: "XPC connection error: Connection invalid""
Retrying container list --all repeatedly continues to fail with the same error.
Unified logs show the CLI attempting the Mach lookup and failing:
activating connection: mach=true ... name=com.apple.container.apiserver
failed to do a bootstrap look-up: xpc_error=[3: No such process]
invalidated after a failed init
There is no gui/507 bootstrap domain while the account is logged out, and no gitlab-owned container-apiserver process appears.
Control experiments
1. Root, headless, system LaunchDaemon: works
A temporary root-owned system LaunchDaemon running:
container system start
container list --all
works without any GUI login.
container system status reports:
status running
appRoot /var/root/Library/Application Support/com.apple.container/
A root-owned container-apiserver is registered in the system domain, and container list --all succeeds.
2. Same gitlab account in an Aqua session: works
After fast-user-switching into gitlab and running:
container system start
container list --all
the account gets a gui/507 bootstrap domain, com.apple.container.apiserver appears there, and a gitlab-owned apiserver process starts.
container list --all succeeds, and creating/removing a disposable native volume succeeds.
After logging gitlab out, gui/507 disappears. Re-running the original UserName=gitlab system LaunchDaemon reproduces the XPC failure.
Generated plist comparison
The generated apiserver plists for the working interactive user and the failing service account are structurally identical except for app-root path and ownership.
but it is never registered in user/507 and cannot be reached by the CLI.
Expected behavior
One of these should be supported:
container system start should be able to bootstrap and use a per-user apiserver from a noninteractive system LaunchDaemon running as that user; or
the project should document that per-user Apple Container runtimes require an Aqua login session, and provide a supported headless/service-account mode for unattended workloads.
The current behavior leaves an awkward gap:
root works headlessly;
an interactive user works;
a non-admin, headless service account does not.
That makes it difficult to run an unattended service with a dedicated least-privilege account.
Happy to provide the minimal plist, full launchctl print output, and filtered unified logs if useful.
FYI, my workaround circa April '26 was to run the service initially as a internal-drive user, and then edit the plist to remove the Aqua session requirement. Then I can run the container by changing only the shell user when executing the command (the Aqua session is still pinned to the external-drive user). This still means running container as the internal-drive user, but avoids the need to logout the external-driver user and login the internal-drive user (and stop whatever else the external user on the Aqua/GUI session is doing).
Activity
makhov commentedon Jun 15, 2025
Could you please, show the apiserver logs? Try it again and then run
container system logs --last 1mafbjorklund commentedon Jun 15, 2025
I got the same error,
Error: interrupted: "XPC connection error: Connection invalid"Nothing much in the logs:
Restarting the container daemon seems to have fixed it,
container system restartmakhov commentedon Jun 15, 2025
And if you increase the time interval is it anything in the logs?
afbjorklund commentedon Jun 15, 2025
afbjorklund commentedon Jun 15, 2025
After rebooting (without GUI), it stopped working again.
But maybe this is the normal error, when it is not running?
And it was only the first time, when I got it also on start and stop.
makhov commentedon Jun 15, 2025
Sorry, I'm not quite following. It's totally normal, that you get
XPC connection errorifapiserveris not running.The initial error is suspicious, because
container system startstarts the apiserver and then pings it to verify it's running. But starting apiserver may take some time, so it's possible, that ping is called when it's not yet running. If you could reproduce it, could you check apiserver after thesystem startby running any container, for example?afbjorklund commentedon Jun 15, 2025
adityaramani commentedon Jun 15, 2025
Running containers should be possible without a GUI, and in a SSH session. The GitHub workflows on PRs exercise this functionality. As the other have pointed out you need to first run the
container system startcommand, before trying to run any containersIf you are able reproduce the behavior, could you share what this command returns?
mjc0608 commentedon Jun 16, 2025
I think I know what happened. I logged in an LDAP-backed account and then su to a local service account. Then I ran the
container system startcommand there. It fails with the error.If I (1) directly ssh into the local account or (2) ssh into a local account then su into another then everything works. So maybe this is an LDAP-binding issue.
Also in both the failing case and successful case,
launchctl managernameshowsBackground.mjc0608 commentedon Jun 16, 2025
In the LDAP account, if I run
container system start, it gets stuck forever. Andcontainer system logsreturnslog: Could not open local log store: Operation not permitted. I guess this is because some system directories are not created in my LDAP binding.But this does not explain why it does not work after
suinto a local admin where all there directories exist.mjc0608 commentedon Jun 16, 2025
If you believe this is not an issue, please close the thread.
transitorykris commentedon Jun 16, 2025
I've found the same error with
container system starton an account that has its user directory on an external unencrypted drivemjc0608 commentedon Jun 16, 2025
@transitorykris Did you try to login into that user and then su to a local user?
My LDAP user also has external home directories. So this may be a home directory issue.
9 remaining items
tjakobsson commentedon Jun 18, 2025
For me, directly on a Mac mini with macOS 15.5, my main user has its home directory on an external drive -
container system startdoes not work. Moving over to another account that has the home directory on the internal drive - it works.I don't know if that would be the same as this issue since I'm not using it over SSH. But it sounds like it could be.
ephemer commentedon Jun 20, 2025
I noticed this in another CLI application. I had to add
Full Disk Accesspermission for it to work. (System Settings -> Privacy & Security -> Full Disk Access). Not sure if it'll work here, but wanted to mentioned ittjakobsson commentedon Jun 20, 2025
I tested this, it did not work unfortunately.
ZhuangZzzi commentedon Aug 3, 2025
I am having the same error. New Mac.
Environment
Here is the error:
% container system start
Verifying apiserver is running...
Error: interrupted: "internalError: "failed to get a response from apiserver: interrupted: "XPC connection error: Connection invalid""
Ensure container system service has been started with
container system start."% launchctl managername
Aqua
% which container
/usr/local/bin/container
I tried building from source, using the signed release package, and using brew. All same error.
The apiserver service fails to register with launchd.
% launchctl list | grep -E "container|apiserver"
449 0 com.apple.containermanagerd
% launchctl print gui/$(id -u)/com.apple.container.apiserver
Bad request.
Could not find service "com.apple.container.apiserver" in domain for user gui: 501
The apiserver binary executes successfully when run directly from a local build: container-apiserver --help works
Like I said, new Mac. The only "jank" in my setup is having my home dir on external ssd. Any update? or something I can run to create a new lead?
mortbauer commentedon Oct 7, 2025
I'm trying to run it as a daemon with a daemon user with home directory at /var/container and face the same issue, no external ssd, new macos mini m4
outcoldman commentedon Nov 4, 2025
Have similar issue, and it is pretty easy to reproduce actually without having a user home directory not on internal drive.
I have NVMe RAID0 mounted as /Volumes/DATA, where I wanted to move all the containers/images.
I tried first to do
ln -s /Volumes/DATA/Container ~/Library/Application\ Support/com.apple.containerto see if it will be possible to just trick the system. It failed to start.But I noticed the option
container system start --app-root /Volumes/DATA/Container, so I gave it a try, and got the same issuewti commentedon Nov 15, 2025
fwiw: In my testing, the container process call to
launchctlto start the apiserver fails when the apiserver.plist is created on an external drive (reproduced on the command line). Configuring the approot to use the internal drive enables the apiserver to start and serve some xpc requests. However later services required to run a container fail (still investigating), though approot appears to be correctly obtained from the apiserver.jglogan commentedon Apr 5, 2026
@wti that's my observation as well.
@adityaramani FYI
I don't know if there are any other issues behind the plist issue, but I think the thing for the interested developer to try out is to locate all plists that we launch from on the system volume.
I think it might be helpful for diagnostic purposes for the various managers to locate plists with all the other resource-specific infomation. Right now the PluginLoader writes the plist to pluginStateRoot but we could have it also write to, say, a common directory on the system volume that holds all the plists that we actually launch from. We could have
system startcreate that as a temp directory and then plumb that down to the API server and plugins asCONTAINER_LAUNCH_ROOTjust like our other base directories.robbiemu commentedon Jun 23, 2026
I can reproduce the apparent GUI-session dependency in a more controlled setup.
This is not an external-home-directory issue and does not depend on SSH. The affected account has a normal local home directory on the internal disk.
Summary
containerworks:rootfrom a headless system LaunchDaemon;It does not work for that same unprivileged account when it is run headlessly through a system LaunchDaemon with
UserName=<service-account>.The failure is permanent, not a startup race:
container system startcreates the per-userapiserver.plist, butcom.apple.container.apiserveris never registered in a usable bootstrap domain, and all subsequent CLI calls fail withXPC connection error: Connection invalid.This prevents using Apple Container as an unattended service runtime owned by a non-admin service account.
Environment
<paste sw_vers output><paste container version output>/usr/local/Users/gitlabReproduction
Create a standard local user, for example
gitlab, with a normal local home directory.Install a system LaunchDaemon that runs only:
Load it in the system domain while
gitlabis not logged in.Actual behavior
The job runs with the expected Unix identity:
But
container system startfails:Retrying
container list --allrepeatedly continues to fail with the same error.Unified logs show the CLI attempting the Mach lookup and failing:
After this failure:
shows that the service is not registered.
There is no
gui/507bootstrap domain while the account is logged out, and nogitlab-ownedcontainer-apiserverprocess appears.Control experiments
1. Root, headless, system LaunchDaemon: works
A temporary root-owned system LaunchDaemon running:
works without any GUI login.
container system statusreports:A root-owned
container-apiserveris registered in the system domain, andcontainer list --allsucceeds.2. Same
gitlabaccount in an Aqua session: worksAfter fast-user-switching into
gitlaband running:the account gets a
gui/507bootstrap domain,com.apple.container.apiserverappears there, and agitlab-owned apiserver process starts.container list --allsucceeds, and creating/removing a disposable native volume succeeds.After logging
gitlabout,gui/507disappears. Re-running the originalUserName=gitlabsystem LaunchDaemon reproduces the XPC failure.Generated plist comparison
The generated apiserver plists for the working interactive user and the failing service account are structurally identical except for app-root path and ownership.
Both include:
The service-account plist is generated correctly under:
but it is never registered in
user/507and cannot be reached by the CLI.Expected behavior
One of these should be supported:
container system startshould be able to bootstrap and use a per-user apiserver from a noninteractive system LaunchDaemon running as that user; orthe project should document that per-user Apple Container runtimes require an Aqua login session, and provide a supported headless/service-account mode for unattended workloads.
The current behavior leaves an awkward gap:
That makes it difficult to run an unattended service with a dedicated least-privilege account.
Happy to provide the minimal plist, full
launchctl printoutput, and filtered unified logs if useful.wti commentedon Jun 28, 2026
FYI, my workaround circa April '26 was to run the service initially as a internal-drive user, and then edit the plist to remove the Aqua session requirement. Then I can run the container by changing only the shell user when executing the command (the Aqua session is still pinned to the external-drive user). This still means running container as the internal-drive user, but avoids the need to logout the external-driver user and login the internal-drive user (and stop whatever else the external user on the Aqua/GUI session is doing).
docs: clarify app-managed restart policy scope (apple#205) (#16)