Before you can fork microVMs, your Linux host needs a handful of one-time configuration steps: KVM access for the current user, a Firecracker binary, a host-side tap device for the parent VM, per-child network namespaces for isolation, and cgroup v2 for per-sandbox memory limits. This guide walks through each step, explains what every script does, and shows howDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/deeplethe/forkd/llms.txt
Use this file to discover all available pages before exploring further.
forkd doctor verifies the result.
Prerequisites
Architecture
x86_64 Linux (aarch64 builds exist but are not benchmarked)
Kernel
Linux kernel 5.10 or newer. 5.7+ required for v0.4 live-fork mode.
KVM
/dev/kvm must exist. Bare-metal or nested-virt with VT-x / AMD-V exposed.Distro
Ubuntu 22.04+ recommended. Other systemd-based distros work; PRs welcome.
sudo access to install packages, configure tap devices, and provision network namespaces.
One-shot setup
Install the forkd binaries
Download the pre-built release tarball — no Rust toolchain needed:Alternatively, if you are building from source:
Run setup-host.sh
scripts/setup-host.sh performs the following actions:- Checks that
/dev/kvmexists and that the CPU advertises VT-x / AMD-V - Adds your user to the
kvmgroup (requires log-out / log-in to take effect) - Installs apt dependencies:
build-essential,pkg-config,libssl-dev,iproute2,bridge-utils,iptables,socat,jq,qemu-utils - Installs Rust via
rustup(if missing) - Downloads and installs Firecracker
v1.10.1to~/.local/bin/firecracker - Enables KSM (kernel same-page merging) for CoW page deduplication
- Reserves 1 GiB of hugepages (
512× 2 MiB) for live-fork mode
--paranoid to download pinned rustup-init and Firecracker archives with SHA-256 verification before installing:After the script adds you to the
kvm group you must log out and back in (or run newgrp kvm) before /dev/kvm becomes writable without sudo.Create the host tap device
scripts/host-tap.sh creates forkd-tap0 at 10.42.0.1/24 on the host. This tap is used by the parent VM during warmup (before any children are forked). It also enables ip_forward and installs a MASQUERADE iptables rule so the parent has outbound internet access during the snapshot build step.Provision per-child network namespaces
Each forked child runs in its own network namespace (Each namespace receives:
forkd-child-<N>) for multi-tenant isolation. scripts/netns-setup.sh N provisions N namespaces and wires them up to a host bridge (forkd-br0) with outbound NAT:- A tap device
forkd-tap0at10.42.0.1/24(faces the guest VM) - A veth pair connected to
forkd-br0at10.43.0.<i+1>/16(faces the host bridge) - A default route via
10.43.0.1(the bridge) - An SNAT rule so guest traffic carries a unique source IP the bridge can route back
The number you pass (
100 above) must be at least as large as the --n value you plan to pass to forkd fork. Re-run the script with a larger N to add more namespaces.Verify the setup with forkd doctor
forkd doctor runs 16 checks and prints a fix hint for each non-passing item:| Check | What it verifies |
|---|---|
platform | x86_64 Linux |
kvm_device | /dev/kvm exists and is accessible |
hw_virt | CPU exposes VT-x or AMD-V in /proc/cpuinfo |
kvm_access | Current user can open /dev/kvm without root |
cgroup_v2 | Unified cgroup v2 hierarchy mounted at /sys/fs/cgroup |
ip_forward | net.ipv4.ip_forward = 1 on the host |
tap_device | forkd-tap0 exists and is up |
netns | At least one forkd-child-* namespace is provisioned |
firecracker_binary | firecracker is on $PATH or ~/.local/bin/ |
firecracker_version | Firecracker version is ≥ v1.10 |
docker_daemon | Docker daemon reachable (optional — needed for forkd from-image) |
snapshot_dir | ~/.local/share/forkd/snapshots/ exists and has ≥ 2 GiB free |
kernel_image | A vmlinux-* kernel image found at a standard path |
controller | Controller daemon reachable at FORKD_URL (or http://127.0.0.1:8889) |
uffd_wp | vm.unprivileged_userfaultfd = 1 or CAP_SYS_PTRACE (v0.4 live-fork) |
memfd_create | memfd_create(2) available (v0.4 live-fork) |
forkd doctor whenever something feels off — it surfaces the exact fix commands to run.v0.4 live-fork prerequisites
The default snapshot/fork flow works on any kernel ≥ 5.10 with vanilla Firecracker. To use live BRANCH (--live / mode: "live") you need three additional prerequisites:
- Kernel ≥ 5.7 — required for
UFFD_WP(userfaultfd write-protection) vm.unprivileged_userfaultfd = 1— orCAP_SYS_PTRACE:
- Vendored Firecracker fork — the
mem_backend.backend_type: "Shared"feature is not yet upstream. Install the vendored build:
forkd doctor probes both uffd_wp and memfd_create and emits specific fix hints if either is missing.
Kubernetes deployment
Running forkd inside Kubernetes is supported — oneforkd-controller Pod hosts N sandbox children; the K8s scheduler runs once at Pod creation regardless of fan-out size. Nodes require /dev/kvm + cgroup v2. Managed K8s clusters (GKE, EKS, AKS) typically need a bare-metal node SKU or explicit nested-virt to qualify.
See /operations/kubernetes for the starter manifest and node configuration guide.