Fix first-run setup timing out on the kernel download

On a Mac without the Linux kernel, setup ran `container system start
--enable-kernel-install` with a 120 s limit. That command downloads a
697 MB archive without printing anything, so most connections hit the
limit and the window showed `timedOut([...])`.

- Start the service with --disable-kernel-install (10 min: a first
  start still pulls the 69 MB base filesystem).
- Download the kernel in its own step with progress, then hand the file
  to `container system kernel set --tar ... --digest ...`, which checks
  it against the runtime's digest.
- Opening the setup window no longer starts the download; Set Up does.
- Timeouts and runner errors read as sentences.
- A rebuild deletes the image it replaced, which frees about 2 GB each
  time, and deletes or stops the builder VM unless it was already
  running (it kept about 2.8 GB of memory).
- Setup asks for 10 GB free, measured on a real setup.
This commit is contained in:
aculix committed 2026-09-29 16:25:50 +05:30
1 parent 4b67728cce
commit 9fd654298a
13 files changed
+559 -128

No files matched your search

@@ -13,6 +13,22 @@ struct SessionSetupRunTests {
#expect(h.backend.calls == [.sweep(keeping: []), .fix(.serviceStopped), .preflight, .fix(.imageMissing), .preflight])
}
@Test func aWindowRunFetchesTheKernelBetweenTheServiceAndTheBuild() async {
let h = Harness()
h.backend.queuePreflight(.issue(.kernelMissing), .issue(.imageMissing))
#expect(await h.controller.runSetup(.serviceStopped, continuing: true) == .ready)
#expect(h.backend.calls == [.sweep(keeping: []), .fix(.serviceStopped), .preflight, .fix(.kernelMissing), .preflight,
.fix(.imageMissing), .preflight])
}
@Test func aKernelThatStaysMissingIsReportedOnce() async {
let h = Harness()
h.backend.queuePreflight(.issue(.kernelMissing))
#expect(await h.controller.runSetup(.kernelMissing, continuing: true)
== .failed(.kernelMissing, SessionController.stillBrokenMessage))
#expect(h.backend.calls.filter { $0 == .fix(.kernelMissing) }.count == 1)
}
@Test func aWindowRunStartsFolded() async {
let h = Harness()
h.backend.hold(.fix)
@@ -79,6 +95,22 @@ struct SessionSetupRunTests {
#expect(h.backend.calls == [.sweep(keeping: []), .preflight, .fix(.serviceStopped), .preflight])
}
@Test func checkingNeverDownloadsTheKernel() async {
let h = Harness()
h.backend.queuePreflight(.issue(.serviceStopped), .issue(.kernelMissing))
#expect(await h.controller.checkSetup() == .needs(.kernelMissing))
#expect(h.state == .idle)
#expect(h.backend.calls == [.sweep(keeping: []), .preflight, .fix(.serviceStopped), .preflight])
}
@Test func setupErrorsReadAsSentences() {
let timedOut = SessionController.message(for: CLIRunner.Failure.timedOut(["system", "start"]))
#expect(timedOut == "The container runtime stopped responding. Try again.")
#expect(SessionController.message(for: CLIRunner.Failure.notInstalled) == "Apple's container runtime isn't installed.")
#expect(SessionController.message(for: CLIRunner.Failure.launchFailed("denied"))
== "Couldn't run the container runtime: denied")
}
@Test func checkingOpensALinkACardWasHolding() async {
let h = Harness()
h.backend.queuePreflight(.issue(.imageMissing))