Repository navigation
Fix: pull the sandbox image on every run, in both VM paths - #665
Conversation
`podman run` resolves an image reference only when the host has no copy of it, so a mutable `:latest` pulled once is never re-resolved -- every later `setup-vm.sh` run starts the sandboxes on it. On the 2026-10-01 KVM rig that copy predated rossoctl#372: HOME was the shared /workspace rather than /home/sandbox, and nothing in the bring-up's output hinted the containers were not what main builds. `build-rootfs.sh` had the same bug in a worse place: `podman image exists || podman pull` pulled only on a host with no copy, and a snapshot is built once and run for a long time, so a stale rootfs outlived the image it was meant to track. Both now pull before use, fail closed on a failed pull, and take SH_SKIP_PULL=1 as the documented override for an offline host or a locally built image -- the convention rossoctl#349 established for `deploy/compose/install.sh`. setup-vm.sh pulls before start_sandboxes, because `podman run --replace` recreates each container from whatever the reference resolves to at that moment. Both also log the resolved image id and creation time rather than the tag asked for: `:latest` is the same string on a current and a pre-rossoctl#372 host, so the id is what answers "is this host on the current image?". Tests: setup-vm.test.sh gains the pull, the fail-closed refusal, the skip path and an uninspectable image warning, plus a main() ordering assertion that the pull precedes the first container; build-rootfs.test.sh asserts the image is re-resolved every build (and that the `image exists` short-circuit is gone, not merely reordered), that a failed pull refuses before exporting, and that SH_SKIP_PULL builds from the local copy but refuses when there is none. Fixes rossoctl#414 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: cwiklik <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Thanks — the fix is correct and well-ordered: pull_sandbox_image runs after the firewall and before start_sandboxes, a failed pull aborts main() under set -euo pipefail, the build-rootfs.sh image exists || short-circuit is removed (not reordered), and SH_SKIP_PULL matches #349's compose convention. The main() ordering assertion is a good guard. CI is green on this head.
Two follow-ups inline:
- Stale "setup-vm.sh never pulls" guidance outside the diff.
deploy/microvm/P4-ON-P6.md:38-44still sayssetup-vm.shnever pulls and tells operators topodman pullby hand first.deploy/microvm/setup-microvm.sh:206(comment) and itscheck_container_tiersrefusal at:235("setup-vm.sh never pulls, so: podman pull $img, then re-run…") say the same, anddeploy/microvm/tests/setup-microvm.test.sh:370/:388pin that message. After this PR, re-runningsetup-vm.shis enough (unlessSH_SKIP_PULLis set). SH_SKIP_PULLwith no local copy differs between the two scripts:build-rootfs.shrefuses, butsetup-vm.shwarns and letspodman runpull. That contradicts the README's "does not attempt the pull at all".
Author: cwiklik (MEMBER — maintainer)
Areas reviewed: Shell (setup-vm.sh, build-rootfs.sh + tests), Docs
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing (16/16)
Assisted-By: Claude Code
| any of `bash git rg python3 base64 file ls cat`. It strips the container | ||
| worker binary and records the image and its digest in `/etc/moca-rootfs-source` inside the tree. | ||
|
|
||
| It **pulls the reference every run** rather than reusing a copy this host happens to hold: a |
There was a problem hiding this comment.
suggestion: This paragraph is now correct, but the same doc's step at lines 38-44 still says "setup-vm.sh never pulls: its podman run --replace reuses the image the host already has" and tells operators to podman pull by hand before re-running it. The same claim appears in deploy/microvm/setup-microvm.sh:206 (comment) and in the check_container_tiers refusal at :235 ("setup-vm.sh never pulls, so: podman pull $img, then re-run …"). tests/setup-microvm.test.sh:370/:388 pin that wording. After #414, "re-run deploy/vm/setup-vm.sh" is enough on its own, and the manual pull is only needed with SH_SKIP_PULL. Worth updating all three here (or in a quick follow-up) so the docs stop contradicting the new behaviour.
| id="$(podman image inspect --format '{{.Id}}' "$SANDBOX_IMAGE" 2>/dev/null || true)" | ||
| created="$(podman image inspect --format '{{.Created}}' "$SANDBOX_IMAGE" 2>/dev/null || true)" | ||
| if [[ -z "$id" ]]; then | ||
| echo "WARNING: no local copy of $SANDBOX_IMAGE to inspect, so this run cannot report which" \ |
There was a problem hiding this comment.
suggestion: When SH_SKIP_PULL is set and the host has no copy, this warns and continues, and podman run (default --pull=missing) then pulls from the registry anyway. That contradicts the README's "It does not attempt the pull at all (so there is no registry timeout to wait out)" and the header's "start the sandboxes on whatever copy this host already has". It also differs from build-rootfs.sh, which refuses in the same state (SH_SKIP_PULL is set but this host has no copy). I'd suggest one of two fixes: (a) refuse here when SH_SKIP_PULL is set and there's no local copy, matching build-rootfs.sh, or (b) pass --pull=never to the sandbox podman run under SH_SKIP_PULL. Either way, the warning text "podman will pull it" would then only apply to the pulled path, where it is effectively unreachable.
| grep -q 'SH_SKIP_PULL' <<<"$pull_fail_out" || | ||
| fail "the refusal must name the override an offline host needs: $pull_fail_out" | ||
| if grep -q 'podman run .*sh-sandbox-' "$MOCK_LOG"; then | ||
| fail "a failed pull still started a sandbox container: $(cat "$MOCK_LOG")" |
There was a problem hiding this comment.
nit: This check can't fail. The case calls pull_sandbox_image alone, never start_sandboxes/main, so no podman run .*sh-sandbox- line can appear. What actually stops the sandboxes is set -e in main() on the non-zero return, and nothing here exercises that. Either drop the check, or run main with MOCK_PODMAN_FAIL='pull *' and assert that no sandbox podman run happened.
Takes upstream's 11 commits after 071b213: gh vendored into the sandbox images (rossoctl#661), the sandbox image pulled on every run in both VM paths (rossoctl#665) and in compose (rossoctl#664), a cached login matched by endpoint (rossoctl#667), a kind-ci fix (rossoctl#663). No conflicts. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Rong Chang <[email protected]>
Summary
podman runresolves an image reference only when the host has no copy of it, so a mutable:latestpulled once is never re-resolved — every latersetup-vm.shrun starts the sandboxes onit. On the 2026-10-01 KVM rig that copy predated #372:
HOMEwas the shared/workspaceratherthan
/home/sandbox, and nothing in the bring-up's output hinted the containers were not whatmainbuilds.deploy/microvm/build-rootfs.shhad the same bug in a worse place:podman image exists || podman pullpulled only on a host with no copy, and a snapshot is built once and run for a long time, soa stale rootfs outlived the image it was meant to track.
Both now pull before use, fail closed on a failed pull, and take
SH_SKIP_PULL=1as the documentedoverride for an offline host or a locally built image — the convention #349 established for
deploy/compose/install.sh.Two details that are load-bearing rather than incidental:
setup-vm.shpulls beforestart_sandboxes, becausepodman run --replacerecreates each container from whatever the reference resolves to at that moment. A pull after it
would leave this run's sandboxes on the old image and only benefit the next run. There is a
main()assertion for this.:latestisthe same string on a current and a pre-feat: per-user inference credential headers and sandbox research tooling (#368 phase 1) #372 host, so the id is what answers "is this host on the
current image?".
An image with no local copy warns instead of aborting — refusing there would be refusing over the
script's own reporting step, and
podman runwill pull.Changes
deploy/vm/setup-vm.shpull_sandbox_image(fail-closed,SH_SKIP_PULL) anddescribe_sandbox_image; called frommain()beforestart_sandboxesdeploy/vm/tests/setup-vm.test.shimage inspectmock branch; four cases (pull happens, failed pull refuses, skip path, uninspectable image warns) +main()ordering assertiondeploy/microvm/build-rootfs.shpodman image exists || podman pullreplaced by an unconditional fail-closed pull withSH_SKIP_PULLdeploy/microvm/tests/build-rootfs.test.shimage existsshort-circuit is gone, not reordered), failed pull refuses before export, skip path + no-local-copy refusaldeploy/vm/README.mdSANDBOX_IMAGEparagraph updateddocs/reference/configuration.mdSH_SKIP_PULLpromoted to its own bullet, naming all three scriptsdocs/demos/vm-multi-user-demo.mddeploy/microvm/P4-ON-P6.mdSH_SKIP_PULLTesting
deploy/vm/tests/setup-vm.test.shdeploy/microvm/tests/build-rootfs.test.shpull_sandbox_image; pull moved afterstart_sandboxes; pull made non-fatal; pristinebuild-rootfs.shmake test-deploybuild-snapshot.test.sh, which produces the identical two assertions and exit 2 on stashedHEAD— pre-existing, needs microVM build tooling on this Macmake test-deploy-bash32build-rootfs.test.shunder/bin/bash3.2shellcheck -x -S warning, pre-commit shellcheck + secretsscripts/check-doc-links.pysetup-vm.test.shcannot run under bash 3.2 —mapfileatdeploy/vm/tests/setup-vm.test.sh:340predates this PR, which is why
make test-deploy-bash32does not list that suite. Not a regressionhere, but worth a follow-up.
No new feature, so CLAUDE.md's feature-flag rule does not apply: this is a bug fix in deployment
tooling, behind no user-facing switch.
Fixes #414
Assisted-By: Claude Code