unkernel Hands-On: A Real Linux Kernel in WebAssembly as a Throwaway Machine for Coding Agents
I booted Alpine from Node on my own machine: 377 ms from createKernel() to the first command, gcc and Python running inside, and a Gemini-powered OpenCode agent that finished its task in 13 seconds with the VM as its only tool.
Every coding agent I run eventually wants a shell: to install a package, run a test, or delete a folder it shouldn't touch. I don't want that happening on my laptop, and a full VM for a five-second experiment feels heavy.
So when unkernel hit the Hacker News front page on 28 November, I paid attention. It's a real Linux kernel compiled to WebAssembly, with a Node SDK, and the README says it "boots to a shell in less than a second". That sounds like exactly what an agent needs: a Linux machine you can create, use and throw away from a few lines of JavaScript.
I installed it, timed the boot, did real work inside it, built a bridge so an agent could use it as its only tool, and put it next to a container. Here's what I found.
What unkernel actually is
unkernel is Linux 7.x built as a single wasm module. It's by Pooya Parsa (@_pi0_), and the repo is open source. The interesting part is the split:
- The kernel is compiled, not emulated. Syscalls, the scheduler, memory management, ext4 and TCP/IP run as native wasm.
- User programs are unmodified aarch64 binaries. They run on kwemu, an aarch64 CPU written in Zig and linked into the kernel, with a JIT for hot code. That's why Alpine and Debian packages work as they are.
- There's a real MMU.
fork,mmap, copy-on-write and signals behave like they do on hardware, not like a no-MMU port.
The same kernel file runs in Node and in the browser, and the npm package is a zero-dependency TypeScript SDK. The SDK and web page are MIT; the package also ships the kernel and busybox, so npm lists it as MIT AND GPL-2.0-only.
Installing it and booting Alpine from Node
I used Node 24.22.1 on an 8-core Intel Xeon Linux machine with 16 GB of RAM. The package requires Node 24 or newer, and checkSupport() checks for JSPI and the other wasm features before you boot:
npm install unkernel # unkernel@0.2.0-261128-df6d726, 16 MB on disk, unkernel.wasm is 11.9 MB import { checkSupport, createKernel, fetchDistro } from "unkernel"; console.log(await checkSupport()); // { ok: true, wasm: true, bigint: true, jspi: true, memory64: true, problems: [] } const distro = await fetchDistro("alpine"); // downloads a 4 MB image once const vm = await createKernel({ distro }); const { stdout } = await vm.exec("uname", ["-a"]); console.log(stdout); // Linux unkernel 7.3.4+ #6eb41ee7f809 Sat Nov 28 18:57:55 UTC 2026 aarch64 Linux await vm.exec("poweroff", [], { user: "root" }); console.log(await vm.exited); // { code: 0, reason: 'halt', kind: 'halt' } That's it. No daemon, no image registry, no root. /etc/os-release says Alpine 3.24.4.
One thing surprised me. Every call to fetchDistro("alpine") took about 1.6 to 1.8 seconds, even with the image already cached. Reading the SDK source, it fetches distros.json from the GitHub release on every call to check the image. If you boot often, resolve the path once and pass it straight in:
const distro = `${process.env.HOME}/.cache/unkernel/v0.2.0-261128-df6d726/alpine.erofs`; const vm = await createKernel({ distro }); // no network round trip All my timings below use the cached path.
How fast it really boots
I ran the boot ten times, each in a fresh Node process, and timed three things: createKernel(), the first exec(), and the kernel's own Run /init timestamp from dmesg.
for i in $(seq 1 10); do node bootbench.mjs; done # fresh process each time # medians (range) over 10 runs, Alpine 3.24 # createKernel(): 108 ms (103-122) # first vm.exec("uname"): 270 ms (260-272) # createKernel() -> first command: 377 ms (363-392) # node start -> first command: 436 ms (418-452) # kernel "Run /init" (guest clock): 52 ms # host RSS after boot: 202 MB So the README's claim holds up on my machine: the kernel reaches /init in about 50 ms, and I have a working Alpine machine answering commands well under half a second after Node starts.
A second boot in the same process is faster again. Boots two to six took 198 to 222 ms to the first command, with /init at 14 ms. The catch is memory: the Node process grew by about 57 MB per boot, from 180 MB to 488 MB over six boots, and forcing garbage collection didn't bring it back. Only one kernel runs per thread anyway, so for a long-lived service I'd run each machine in a worker or a child process and recycle it.
Real work inside: shell, packages, gcc, Python
A fast boot doesn't matter if the machine can't do real work, so I gave it the jobs an agent would. I turned on networking with directBackend(), which uses the host's sockets, and gave it 2 GB of memory:
import { createKernel, directBackend } from "unkernel"; const vm = await createKernel({ distro, net: directBackend(), memoryMiB: 2048 }); const run = (cmd) => vm.exec("sh", ["-c", cmd]); Everything ran as the default user user, who has passwordless sudo. Here's what came back:
mkdir -p ~/proj/src && cd ~/proj && printf 'b\na\nc\n' > src/x.txt && sort src/x.txt ln -s src/x.txt link && mv src/x.txt src/y.txt && find . -type f && rm -rf src # all exit 0, 21 ms for the whole chain sudo apk update # 874 ms, "OK: 5989 distinct packages available" sudo apk add build-base # 9.1 s, 22 packages gcc -O2 hello.c -o hello # 0.80 s ./hello # a 100M-iteration loop in 0.27 s file hello # ELF 64-bit LSB pie executable, ARM aarch64 ... ld-musl-aarch64.so.1 sudo apk add python3 # 2.3 s, Python 3.14.10 python3 -c 'print(sum(i*i for i in range(1000000)))' # 1.66 s sudo apk add git # 1.6 s, git version 2.54.1 /proc, cgroups, overlayfs and HTTPS all behaved like a normal Linux machine. Node took two tries. apk add nodejs npm git failed because npm lives in Alpine's community repository and apk starts with main only. Typing node then triggered unkernel's built-in installer, which pulled Node 26.13.1 for arm64 musl and linked it into ~/.local/bin. At 1 GB of memory it refused ("needs 245 MiB free ... only 213 MiB is"), because the writable root lives in memory; at 2 GB it worked, and npm install left-pad finished in 13.4 s.
That last number shows where the cost goes. The kernel path is fast, but user code is emulated aarch64. A loop of 1,000 /bin/true processes took 1.35 s, CPU-heavy Python was about 30 times slower than in a native container, and npm's startup stays mostly on the interpreter. For an agent running tests, git and small builds, that's fine. For heavy compiles, it isn't.
Turning it into a tool for my coding agent
The SDK has exec(), spawn() with a pty, host mounts and vsock, but no built-in agent protocol. So I wrote a small daemon that boots one machine and runs commands in it over a local port:
// ukd.mjs: one throwaway VM, commands over 127.0.0.1:7311 import http from "node:http"; import { createKernel, directBackend } from "unkernel"; const vm = await createKernel({ distro, net: directBackend(), memoryMiB: 2048 }); http.createServer(async (req, res) => { let body = ""; for await (const c of req) body += c; const { cmd } = JSON.parse(body); const r = await vm.exec("sh", ["-lc", cmd], { cwd: "/home/user" }); res.end(JSON.stringify(r)); // { stdout, stderr, exitCode, signal } }).listen(7311, "127.0.0.1"); On top of that I put two front ends: a uk 'command' CLI, and a dependency-free MCP server with one tool, vm_run. The VM was ready 360 to 545 ms after the daemon started. A uk 'true' round trip took 81 ms at the median, and most of that is the CLI's own Node startup; the command itself took 16 to 93 ms inside the VM.
Throwing the machine away is just poweroff and a new createKernel(). Nothing the agent installed or broke survives, unless you attach a data disk on purpose.
What happened when an agent used it
I ran OpenCode 1.19.0 with Gemini 3 Flash (google/gemini-3-flash-preview) and made the MCP tool unkernel_vm_run its only way to act. OpenCode's own shell, read, write and edit tools were switched off. This is the relevant part of opencode.json:
{ "mcp": { "unkernel": { "type": "local", "command": ["node", "uk-mcp.mjs"] } }, "tools": { "bash": false, "read": false, "write": false, "edit": false, "glob": false, "grep": false } } The AGENTS.md said only that it was working on a throwaway Linux machine and that unkernel_vm_run was its one tool. It didn't name the distro. The task was small but real: install Python, write a word-frequency script that ignores case and punctuation, and pass an exact check.
opencode run --model google/gemini-3-flash-preview "$(cat prompt.txt)" Gemini made three tool calls, and the daemon logged each one as it ran inside the VM:
# 1. exit 0 in 2,805 ms sudo apk add python3 && mkdir -p ~/wordtop # 2. exit 0 in 28 ms cat <<EOF > ~/wordtop/wordtop.py import sys import re from collections import Counter text = sys.stdin.read().lower() words = re.findall(r'[a-z]+', text) counts = Counter(words).most_common(3) for word, count in counts: print(f"{word} {count}") EOF # 3. exit 0 in 455 ms printf "A b a, c b A d" | python3 ~/wordtop/wordtop.py # a 3 # b 2 # c 1 That's the expected output, first time. The whole opencode run took 13.1 seconds of wall time, model calls included, and the three commands spent about 3.3 seconds of that inside the VM. Nothing in its instructions named Alpine, yet its first command used apk, and it worked.
Afterwards I checked both sides. Inside the VM, ~/wordtop/wordtop.py was there and gave the same output. On my machine, the project folder still held just its three config files, and no wordtop.py existed anywhere on the host. One poweroff later, the whole thing was gone.
The "only tool" part matters more than the model. In an earlier run I tried a small local model with OpenCode's normal shell tool still on and an AGENTS.md asking it to run everything in the VM. It wrote a file into my project folder and ran sudo apt install python3 on the host anyway. Instructions are a suggestion. A tool list is a boundary the agent can't talk its way around, so don't ask the agent to use the VM; make the VM its only tool.
unkernel vs a container vs a microVM
For the container side I installed rootless Podman 5.4.2 and ran the same Alpine 3.24 release natively on x86_64. Measured on my machine:
- Start to first command: 377 ms for unkernel, 80.5 ms for
podman run --rm alpine:3.24 uname -r(both medians of 10 runs). - Memory while idle: about 200 MB of host RSS for the Node process running unkernel; under 1 MB for the container's process plus about 2 MB for Podman's
conmon. -
apk add python3: 2.3 s in unkernel, 0.84 s in the container, including the container's start. - gcc compile and run: 0.80 s and 0.27 s in unkernel, 0.03 s and 0.06 s in the container.
- 1,000 process spawns: 1.35 s in unkernel, 0.37 s in the container.
For microVMs I'm using Firecracker's published numbers, not my own: its specification promises at most 125 ms from the InstanceStart call to the guest's /sbin/init, and at most 5 MiB of VMM memory overhead for a 1 vCPU, 128 MiB guest (SPECIFICATION.md).
So unkernel isn't the fastest or lightest way to start Linux on a Linux server. A container beats it on every number above. What it gives you is different: no daemon, no root, no KVM, and the same kernel file running in Node and in a browser tab. You add one npm package and you have a full Linux machine in-process, wherever Node 24 or a modern browser runs.
It's a scratch machine, not a security boundary
The README and docs talk about speed, a real kernel and embedding. They make no isolation or security claim, and I wouldn't infer one. Two probes from my own run show why you shouldn't treat it as one by default:
# 1. A host folder mounted with default options is writable # vm.mount("/work", nodeFs("./hostdir")) echo 'written from the guest' > /work/from-guest.txt # appeared on my host # 2. directBackend() gives the guest the host's network reach wget -qO- http://<my machine's LAN IP>:8798/notes.txt # returned the host file The guest user also has passwordless root inside the VM. None of that is a bug; it's what an embeddable dev machine should do. But it means the safety comes from how you wire it:
- Mount host folders with
{ readOnly: true }, or use aMemoryFsand copy results out. - Leave networking off (it's off unless you pass
net), or write a backend that only allows the hosts you want. Any object withconnectandlookupworks. - Give the agent only the VM tool, as above.
When the code is truly untrusted, such as a stranger's pull request or a multi-tenant service, I'd use a real isolation layer: a Firecracker microVM, gVisor, or a hardened container with seccomp and no host mounts. unkernel is for keeping my own agent's mess off my machine, not for holding back an attacker.
Where I'd use it
After a day with it, unkernel has a clear spot in my toolkit:
- A scratch Linux for local agents, created per task in under half a second and thrown away after, with the VM as the agent's only tool.
- Linux where there's no Linux runtime. The same kernel file runs in Node and in browsers, so there's no Docker Desktop or KVM to set up.
- Reproducible CI checks and tutorials that need
apk add, git and a real/proc, but not heavy compute.
To try it yourself:
npm install unkernel npx unkernel # Alpine in your terminal, Ctrl-] to quit npx unkernel --mount .:/work:ro # your folder, read-only inside the guest The code is at github.com/pithings/unkernel, the docs are at docs.unkernel.dev, and you can boot it in the browser at unkernel.dev.