Skip to content

[snapshot] restored boxes lose persisted commands without OCI metadata #132

Description

@ZhiXiao-Lin

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

  1. Run a box with an explicit command that writes a marker and stays alive.
  2. a3s-box snapshot create <box>.
  3. a3s-box snapshot restore <snapshot> --name restored.
  4. Confirm a3s-box inspect restored contains the original command.
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/runtimeRuntime, VM lifecycle, exec, wait, and long-running jobsbugSomething isn't workingpriority/highHigh priority regression or production blocker

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions