Repository navigation
Conversation
When no default kernel is configured and neither `--enable-kernel-install` nor `--disable-kernel-install` is given, `container system start` prompts for an answer. Without a terminal, for example under launchd, `readLine` returns nil and the command failed with "failed to read user input" even though the services had already started. Keep prompting and reading the answer as before, so a piped answer such as `yes | container system start` still works. When no answer can be read and standard input is not a terminal, log a warning that names the ways to set a default kernel, skip the install, and exit successfully. Move the decision into a function with unit tests, and update the option's help text and the command reference. Fixes apple#2489.
resker
reviewed
Nov 13, 2026
resker
left a comment
There was a problem hiding this comment.
Tested at 21b4855 on macOS 27.3 (debug build, fresh app roots, no default kernel):
- stdin from
/dev/null, no flag: exits 0, services are running, and the warning names both fixes.container runthen fails with the expected "default kernel not configured". printf 'n\n' | container system start: declines and exits 0, same as before.SystemStartTestspass, andswift-fmt-checkis clean.
LGTM.
1 task done
Author
|
Thanks for testing it, and for checking that |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Motivation and Context
Fixes #2489.
When no default kernel is configured and neither
--enable-kernel-installnor--disable-kernel-installis given,container system startprompts for an answer. Without a terminal, for example under launchd,readLinereturns nil and the command exits 1 withfailed to read user input, although the services have already started.system startstill prompts and reads the answer as before, so a piped answer such asyes | container system startkeeps working. Only when no answer can be read and standard input is not a terminal does it now log a warning that namescontainer system kernel set --recommendedand--enable-kernel-install, skip the install, and exit 0, as it already does when the answer isn. With either flag there is still no prompt, and an interactive run where input ends still fails as before.The decision moves into
kernelInstallDecision, which has unit tests for each case. The option's help text anddocs/command-reference.mddescribe the new default.Testing
Added
SystemStartTests.missingAnswerSkipsWithoutTerminalfails if the no-answer case is reverted to an error.make testandmake checkpass.Ran a debug build with a fresh
--app-rootand no default kernel on macOS 27.2:system start < /dev/null: exit 0, andsystem statusreports running. It logs: "Services started, but no default kernel is configured and none was installed because no answer could be read from standard input. Containers cannot start until a default kernel is set. Runcontainer system kernel set --recommended, or start with--enable-kernel-install."echo n | system start: exit 0 with the existing "Please use thecontainer system kernel set --recommendedcommand" message and no new warning.system start --disable-kernel-install < /dev/null: exit 0, no prompt and no warning.I did not run the paths that install a kernel (answering yes,
--enable-kernel-install). This PR has unit tests only; I can add an integration test for the/dev/nullcase if you'd like it here.