Skip to content

Save and resume the state of jailed Firecracker VMs #437

Closed

Description

@fctl-sh

On a host that runs as root, Firecracker VMs run through the jailer (#434), and #431's snapshots skip them: such a VM stops without saving its state, and a message boots it again from its disk, so Claude starts again rather than resuming where it was. Firecracker, chrooted as the jail's user, writes the state where the snapshot request says, which is inside its chroot, and the host removes the chroot as the VM stops; a restore would need the jail made again around the saved state.

  • Save: ask for the state at paths in the chroot (/vmstate, /memory), then move both out to the sandbox's saved/, checked to be regular files the jail's user made (not links it put there), and give them to root.
  • Resume: make the jail as a start does but without a configuration file, link the saved state into it lent to the jail's user (it must read the memory), load it (PUT /snapshot/load), and only then link the vsock's socket out, since Firecracker makes it as the state loads.
  • Test it as root: CI's Firecracker job runs its root tests under sudo, and stopped_sandboxes_resume_where_they_were turns the jailer off today.

Refs #345

Activity

  1. added
    enhancement
    host
    on Nov 6, 2026
  2. fctl-sh commented on Nov 7, 2026

    @fctl-sh
    ContributorAuthor

    #439 is merged as 33f177e, on main. Jailed Firecracker VMs, on hosts that run as root, now save their state when they stop and resume where they were. CI's Firecracker job checks it as root on x86_64: a jailed VM saved its state in 3.3 s and resumed in 78 ms, with its programs still running.

    No release has it yet (the newest is v0.30.2), so hosts get it with the next one, through auto-update or fctl self update. After that update, a VM that a v0.30.2 host started in a jail stops once without saving its state, because the host has no record of its configuration. It boots from its disk, and saves normally from then on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementhost

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions