/dev/kvm, Docker, curl, python3 and mkfs.ext4, the firecracker binary from a Firecracker release, and an uncompressed guest kernel (vmlinux), such as one of the 6.1 kernels Firecracker publishes for its own testing.
Build the root filesystem
The guest needs the static binaries, a shell for the commands you run, and an init that mounts the kernel filesystems and execs axed so it becomes PID 1. This example uses static busybox:rootfs/init:
--listen 'vsock://any:1024?auth=none'listens on vsock port 1024 without a token. Outside the guest, only the host reaches the vsock channel through the VMM, so the channel is the trust boundary. Inside the guest, any process could connect over the loopback CID, so anauth=nonevsock listener refuses connections from the guest itself and accepts only the host. Passing--listenreplaces the default TCP gRPC listener.--agent-sandbox=falseturns off the sandboxd API. Without it, axed also opens the REST API on TCP port 8080.- The init mounts
/dev/ptsso terminal sessions work, and/sys/fs/cgroupso axed can use cgroups.
Boot the VM
Start Firecracker, wait for its API socket to appear, then point the boot source at your kernel withinit=/init, attach the rootfs, and add a vsock device:
Connect from the host
Firecracker exposes the guest’s vsock as a Unix socket on the host (uds_path). A host client connects to it, writes CONNECT 1024\n, reads OK <n>\n, and then the stream reaches the guest listener.
axectl dials plain Unix sockets, so put a small proxy in between that performs the handshake for each connection. The repository has one you can use or adapt, tests/firecracker/vsock_proxy.py:
axectl binary you copied into rootfs/usr/local/bin, or put a copy on your PATH. axectl info shows pid1 true and the guest’s cgroup. In your own platform, perform the same handshake in your host agent’s dialer.
Cgroups in the guest
As PID 1 with the cgroup v2 hierarchy mounted, axed takes over the guest’s cgroups with--cgroups auto. Each process gets its own cgroup, so whole-tree kill works, and memory limits are enforced when the kernel has the memory controller (an over-limit process is reported oom-killed). CPU limits need the cpu controller. axed enables whichever of cpu, memory and pids the guest kernel provides; check /sys/fs/cgroup/cgroup.subtree_control in the guest to see which ones yours has.
Snapshot and restore
Pause the VM, take a full snapshot, and later load it into a new Firecracker process:instance_id stays the same, because the process table survived.
Call axectl resumed after every restore
Firecracker freezes the guest clocks across the snapshot, so timeouts stay correct without help. But the clocks do not show the gap, so axed does not detect the resume on its own, and the guest’s wall clock falls behind. After every restore, report the restore withSystem.Configure:
generation N, clock stepped S.SSSs, entropy added. axed checks the request, then handles it in this order:
- Steps the guest’s wall clock to the host’s time if it is more than 50 ms off. This needs
CAP_SYS_TIME; without it the call fails here and nothing else happens. - Adds the entropy to the guest’s random pool, so clones of one snapshot stop sharing random state. This needs
CAP_SYS_ADMIN. It is best effort: without the capability the entropy is skipped and the output saysentropy not added. - Records the resume, which increments the generation.
--no-entropy skips step 2.
To quiesce processes before the snapshot, run axectl freeze first and axectl freeze --thaw after restore. Freezing needs cgroups. See Snapshots.
What was tested
With Firecracker v1.18.0 and a 6.1 guest kernel, using the setup on this page:- axed runs as PID 1 and takes the guest’s cgroup v2 hierarchy.
- Offset replay, PTYs, memory limits (
oom-killed) and whole-tree kill work inside the microVM. - After pause, snapshot, 15 seconds stopped and restore: the instance id is unchanged, the detached process is still running and producing output, replay from offset 0 is intact, and
axectl resumedrecords the resume. - A 20-second timeout fires after about 20 seconds of running time, not counting the 15 seconds stopped.

