Firecracker Runtime
The repository builds deterministic Firecracker configuration and can launch a real Firecracker process on Linux/KVM. macOS development still uses dry-run artifact planning without touching KVM.
The DevCell config model covers:
- machine id, vCPU, memory, and workspace disk size;
- kernel image and boot args;
- rootfs and workspace block devices;
- vsock path and guest CID (allocator bumps on collision);
- TAP network identity (
tap-<short-id>), created on start and deleted on destroy; - jailer uid, gid, chroot base, and staged jail root (
…/jailer/firecracker/<id>/root); - socket, log, and metrics paths;
- workload metadata derived from
WorkspacePlan; - runtime descriptor paths for config, metadata, vsock, API socket, TAP name, block devices, logs, metrics, and jailer dir.
BuildLaunchPlan converts that model into an official Firecracker --config-file JSON (vmconfig.json) plus argv. With jailer launch enabled (root / DEVCELL_FC_JAILER_LAUNCH=1), argv is wrapped as jailer … -- --api-sock /firecracker.sock --config-file /vmconfig.json.
deterministic modelconfig · vmconfig · pathsTAP · vsock · jailer/FCWhat It Proves
Section titled “What It Proves”Golden tests make generated config, runtime descriptors, and host vmconfig.json stable and reviewable. Dry-run tests create the per-cell runtime layout without touching KVM. On Linux with /dev/kvm and CAP_NET_ADMIN, celld --backend=firecracker creates TAP devices, opens vsock UDS, stages a jail chroot (kernel + per-cell rootfs copy), and starts a microVM. Destroy removes the TAP, vsock sockets, and cell directory.
Orphan reconcile
Section titled “Orphan reconcile”On celld startup, the Firecracker backend reconciles persisted runtime dirs against live host state:
- Load per-cell
runtime.jsondescriptors from<data>/firecracker-runtime/cells/. - Scan
/procforfirecracker/jailerprocesses whose cmdline references the runtime dir. - Kill orphan processes (cells not desired
running, or unknown runtime paths). - Delete DevCell TAP devices (
tap-*/dc<hex>) not owned by a desired running cell. - Remove vsock UDS files for stopped / non-running cells.
- Mark cells
failedwhen the store expectsrunningbut no live process is found; emitfirecracker.*audit events.
Unit tests inject fake process and TAP lists; integration tests that create real TAPs still require root / CAP_NET_ADMIN.
Artifact resolution
Section titled “Artifact resolution”celld resolves guest media from flags, DEVCELL_FC_* env vars, then the appliance images/ directory:
- CellOS names:
vmlinux,cellos.ext4, optionalinitrd - Fallback pin names:
rootfs.ext4(fromfirecracker-ci-rootfs-ext4)
Binary: --fc-bin, DEVCELL_FC_BIN, or firecracker on PATH (appliance packages include Firecracker). Jailer: DEVCELL_FC_JAILER_BIN or jailer on PATH.
Concurrent cells
Section titled “Concurrent cells”Each cell gets its own writable drives/rootfs.ext4 copy (and a second copy inside the jail root when jailer staging is on). Two cells must not share one RW overlay. Unit coverage: TestPrepareRuntimeConcurrentCellsDistinctRootfs. Integration (root + KVM): TestIntegrationTwoCellSmokeSkipsWithoutKVM.
Jailer launch policy
Section titled “Jailer launch policy”- Always (when EnableJailer): stage
<cell>/jailer/firecracker/<id>/root/{vmlinux,rootfs.ext4,vmconfig.json}with jail-relative paths. - Launch via jailer: only when
geteuid()==0orDEVCELL_FC_JAILER_LAUNCH=1(jailer needs privileged chroot/cgroup setup). Otherwise Firecracker starts directly with host-pathvmconfig.jsonunder the cell dir; TAP + vsock still apply. - Netns / fine-grained cgroups: optional hooks exist (
NetNSPath,--cgroup-version 2); full netns-per-cell remains a follow-up.
Remaining gaps
Section titled “Remaining gaps”- Workspace drive in Firecracker config until a real ext4 image exists
- Guest cell-agent vertical slice over vsock (host dial wired; needs rebuilt CellOS rootfs for green exec)
- Bridge/NAT beyond isolated TAP