[Bug]: Does not work with account with home directory in external drive over ssh, even after su into local user with local home directory
I have done the following
- [x] I have searched the existing issues
- [ ] 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
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Could you please, show the apiserver logs? Try it again and then run container system logs --last 1m
I got the same error, Error: interrupted: "XPC connection error: Connection invalid"
Nothing much in the logs:
Filtering the log data using "subsystem == "com.apple.container""
Timestamp Thread Type Activity PID TTL
--------------------------------------------------------------------------------------------------------------------
Log - Default: 0, Info: 0, Debug: 0, Error: 0, Fault: 0
Activity - Create: 0, Transition: 0, Actions: 0
Restarting the container daemon seems to have fixed it, container system restart
And if you increase the time interval is it anything in the logs?
Not sure how I get back in fail mode, so don't know how to reproduce (maybe OP is still in that state).
My OS upgrade (over SSH) also went into "fail mode"*, and it wasn't fixed until I logged in with the GUI...
* All of my installer commands failed (including installing Swift SDK), due to some similar XPC error:
PackageKit: XPC error in -[_PKInstallClientConnection blockingProxy]_block_invoke_2 (Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.installd.user was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.installd.user was invalidated: failed at lookup with error 3 - No such process.})
So I figured this was "normal" (don't see anything in the logs --last 30d).
But they both work now. I'll try a headless reboot, and see if it still works.
After rebooting (without GUI), it stopped working again.
afb:~/ $ container run -it alpine true
Error: interrupted: "XPC connection error: Connection invalid"
But maybe this is the normal error, when it is not running?
afb:~/ $ container system start
Verifying apiserver is running...
afb:~/ $ container run -it alpine true
afb:~/ $
- https://github.com/apple/container/issues/80
And it was only the first time, when I got it also on start and stop.
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?
I have not been able to reproduce the error with container system start, but installer died again after the reboot...
So it seems that there are some services that are only started by the GUI and not by SSH, but otherwise I have no clue.
$ swiftly install 6.2-snapshot
Fetching the latest 6.2 development branch snapshot...
Installing 6.2-snapshot-2025-06-14
Downloading 6.2-snapshot-2025-06-14
100% [======================================================================================================================================]
Downloaded 1637.5 MiB of 1637.5 MiB
Installing package in user home directory...
Error: RunProgramError(exitCode: 1, program: "installer")
Eventually got the build going again, it didn't want to build with 6.1.0.
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?
launchctl managername
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.
If you believe this is not an issue, please close the thread.
I've found the same error with container system start on an account that has its user directory on an external unencrypted drive
@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.
Oh interesting. If you have swift installed on the system can you please share the output from this
$ swift repl
> import Foundation
> FileManager.default.urls(for: .applicationSupportDirectory,in: .userDomainMask).first!.appendingPathComponent("com.apple.container")
Yes, regardless of how you initially logged into the system XPC fails if the current user does not have a home directory on the system drive (or possibly just encrypted drive).
External drive:
$ swift repl
Welcome to Apple Swift version 6.2 (swiftlang-6.2.0.9.909 clang-1700.3.9.907).
Type :help for assistance.
1> import Foundation
2> FileManager.default.urls(for: .applicationSupportDirectory,in: .userDomainMask).first!.appendingPathComponent("com.apple.container")
$R0: Foundation.URL = {
_url = {
ObjectiveC.NSObject = {
isa = Foundation._BridgedURL
}
_url = "file:///Volumes/HSExternal/Users/kris/Library/Application%20Support/com.apple.container/"
}
}
3>
Internal drive:
% swift repl
Welcome to Apple Swift version 6.2 (swiftlang-6.2.0.9.909 clang-1700.3.9.907).
Type :help for assistance.
1> import Foundation
2> FileManager.default.urls(for: .applicationSupportDirectory,in: .userDomainMask).first!.appendingPathComponent("com.apple.container")
$R0: Foundation.URL = {
_url = {
ObjectiveC.NSObject = {
isa = Foundation._BridgedURL
}
_url = "file:///Users/krisiscoding/Library/Application%20Support/com.apple.container/"
}
}
Here's mine. Setup: ssh into ldap account, then su into local admin.
admin@mini ~ % swift repl
Welcome to Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3).
Type :help for assistance.
1> import Foundation
2> FileManager.default.urls(for: .applicationSupportDirectory,in: .userDomainMask).first!.appendingPathComponent("com.apple.container")
$R0: Foundation.URL = "file:///Users/admin/Library/Application%20Support/com.apple.container/"
3> ^D
admin@mini ~ % container system restart
Verifying apiserver is running...
Error: internalError: "failed to get a response from apiserver after 10 seconds: interrupted: "XPC connection error: Connection invalid""
admin@mini ~ %
And in the LDAP account directly:
_ ~ swift repl
Welcome to Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3).
Type :help for assistance.
1> import Foundation
2> FileManager.default.urls(for: .applicationSupportDirectory,in: .userDomainMask).first!.appendingPathComponent("com.apple.container")
$R0: Foundation.URL = "file:///home/jcma/Library/Application%20Support/com.apple.container/"
3> ^D
_ ~ container system restart
Verifying apiserver is running...
Error: internalError: "failed to get a response from apiserver after 10 seconds: interrupted: "XPC connection error: Connection invalid""
_ ~
(The title was updated to reflect the more likely cuase.)
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.