Summary
A box restored from a filesystem snapshot persists the original cmd in boxes.json, but start ignores it when the restored layout has no OCI image config. Guest-init receives the fallback echo No command specified; exec /bin/sh, so the restored workload exits immediately with code 0.
Reproduction
- Run a box with an explicit command that writes a marker and stays alive.
a3s-box snapshot create <box>.
a3s-box snapshot restore <snapshot> --name restored.
- Confirm
a3s-box inspect restored contains the original command.
a3s-box start restored.
Observed on Windows/WHPX: the restored record becomes dead/exit 0 and init-rust.log shows BOX_EXEC_ARG_1=echo No command specified; exec /bin/sh.
Root cause
boot_from_record correctly reconstructs BoxConfig.cmd. However, VmManager::build_instance_spec only applies config.cmd inside the Some(oci_config) branch. Snapshot-restored layouts can have layout.oci_config == None; that branch always installs the no-command fallback, even when the persisted command/entrypoint override is non-empty.
Expected behavior
Persisted command and entrypoint overrides must be authoritative even when OCI metadata is unavailable. The fallback shell should only be used when neither an OCI command nor an explicit persisted command/entrypoint exists.
Validation needed
- Unit regression for a guest-init layout with no OCI config and a non-empty command override.
- End-to-end snapshot create/restore/start test that proves the restored filesystem marker is present and the restored command remains running.
Summary
A box restored from a filesystem snapshot persists the original
cmdinboxes.json, butstartignores it when the restored layout has no OCI image config. Guest-init receives the fallbackecho No command specified; exec /bin/sh, so the restored workload exits immediately with code 0.Reproduction
a3s-box snapshot create <box>.a3s-box snapshot restore <snapshot> --name restored.a3s-box inspect restoredcontains the original command.a3s-box start restored.Observed on Windows/WHPX: the restored record becomes dead/exit 0 and
init-rust.logshowsBOX_EXEC_ARG_1=echo No command specified; exec /bin/sh.Root cause
boot_from_recordcorrectly reconstructsBoxConfig.cmd. However,VmManager::build_instance_speconly appliesconfig.cmdinside theSome(oci_config)branch. Snapshot-restored layouts can havelayout.oci_config == None; that branch always installs the no-command fallback, even when the persisted command/entrypoint override is non-empty.Expected behavior
Persisted command and entrypoint overrides must be authoritative even when OCI metadata is unavailable. The fallback shell should only be used when neither an OCI command nor an explicit persisted command/entrypoint exists.
Validation needed