Jorge Turbica / blog · Blog ← All articles ES · Leer en español
Technologies

Repo of the day: unkernel, the real Linux kernel compiled to WebAssembly, boots in 0.3 s

unkernel compiles Linux 7.x to WebAssembly with a real MMU: Alpine or Debian in the browser or Node via npx. Built for tests and labs.

A fork, exit and wait round trip in 57 µs, faster than the 73 µs the project measures natively. unkernel was created on November 12, 2026, had 4,213 GitHub stars by November 30 and hit the Hacker News front page on November 28 with 607 points and 167 comments. Version 0.3.0 landed on npm on November 29.

What it is: Linux compiled, not emulated

Most "Linux in the browser" projects emulate an entire PC, kernel included, so every syscall and page fault goes through emulated hardware. unkernel flips that split: the Linux 7.x kernel is compiled straight to WebAssembly, with a real MMU (Sv48 page tables), and the only thing emulated is user space, unmodified aarch64 binaries. That is why Alpine 3.24 and Debian 13 packages run as they are, and why fork, mmap, copy-on-write, threads and signals behave as they do on hardware.

The piece that makes it work is kwemu, an aarch64 CPU written in Zig and linked into the kernel. It walks Linux's own page tables, so memory management is done by real Linux code. When a program makes a syscall, kwemu hands control back to the kernel, which handles it as native wasm, with no emulated trap or kernel mode in between. Hot user code goes through a JIT that compiles it to wasm modules at run time. Devices are small paravirtual drivers (block, network, display, sound, vsock, shared memory) that talk to a zero-dependency TypeScript SDK.

The README numbers explain the buzz: the kernel reaches /init about 70 ms after it starts, the Alpine prompt shows up 0.3 s after node launches, and the web page downloads about 10 MB. A getppid costs around 172 ns, against 110 natively and 1,662 under qemu-system. And it is a real kernel: cgroups, namespaces, overlayfs, ext4 and TUN are enough for systemd to boot Ubuntu 26.10 to multi-user.target.

The kernel, emulator and patched linker are GPL-2.0-or-later; the SDK and web page are MIT. The npm package, which bundles the kernel, is declared MIT AND GPL-2.0-only.

How to use it: a shell via npx or a VM from Node

The quickest route is the CLI. The first run downloads the Alpine image (about 4 MB) from that version's GitHub release and caches it in ~/.cache/unkernel:

bash
npx unkernel                                  # Alpine with networking; Ctrl-] quits
npx unkernel --distro debian                  # Debian 13 (about 57 MB, once)
npx unkernel --mount .:/work:ro --no-net      # your directory, no network
npx unkernel --timeout 60 --input '{8}uname -a\n{2}poweroff\n'

The last line is the one that matters for automation: the CLI types input on a schedule, stops on a timeout and reports how the guest ended through its exit code (0 power off, 124 timeout, 253 kernel panic, 254 wasm trap). --forward 8000:80 exposes a guest server on port 8000 of your machine.

To embed it in an app, the SDK is one npm install unkernel away:

javascript
import { createKernel, fetchDistro } from "unkernel";

const vm = await createKernel({ distro: await fetchDistro("alpine") });
vm.onOutput((bytes) => process.stdout.write(bytes));
vm.write("uname -a; poweroff\n");
const { code, kind } = await vm.exited;

On Node, fetchDistro checks the image's size and SHA-256 against the release's distros.json. In the browser you host the image yourself and it is read lazily with range requests.

What I like and what I don't

I like the design. Running Linux's actual code removes the whole class of bugs you get from runtimes that reimplement syscalls: /proc, epoll, cgroups and overlayfs behave like they do on a server because they are the same code. For throwaway test environments, training labs, documentation playgrounds or reproducing a bug on a specific distro without spinning up a VM, it is a very appealing tool.

What I don't: the project is 18 days old, still at 0.x, with 23 npm releases and 52 open issues. Performance shines on the kernel path, but CPU-heavy code is well behind native (apk add python3 takes about 3.4 s) and floating point goes through the interpreter even inside compiled code. Networking has limits the README owns up to: no IPv6, no inbound connections and, on the web page, no UDP beyond DHCP and DNS. The SDK and CLI boot a single CPU by default, and a wasm trap in the kernel ends the session.

The caveat that matters most is licensing: embed the package in a product and you are shipping a GPL-2.0 kernel, even if your code and the SDK are MIT. Your legal team will want a say before it goes to customers.

unkernel vs v86

v86 is the go-to "Linux in the browser" project: 23,758 stars, a BSD-2-Clause license and commits as recent as November 27, 2026. It emulates a full x86 PC and translates machine code to WebAssembly at run time.

unkernelv86
ApproachLinux kernel compiled to wasm, aarch64 user space emulatedFull x86 PC emulated, x86-to-wasm JIT
What it bootsLinux 7.x with Alpine or Debian32-bit x86 systems (Linux, 9front, Android-x86…)
CPU limitsOne CPU by default in the CLI and SDKNo multicore, no 64-bit extensions
Deploymentnpx unkernel, SDK for Node and the browserBrowser library
LicenseGPL-2.0-or-later, MIT SDKBSD-2-Clause
Maturity0.3.0, created November 12, 2026Established, actively committed

When to pick which: v86 if you need an operating system other than Linux, a permissive license for the whole package, or the more established option. unkernel if you want modern Linux with current packages and fast syscalls, say for scripts or tests heavy on fork and I/O, and you can live with a project that still changes every few days.

Sources

Jorge Turbica

Software Engineer and SRE. I write about the real challenges I run into in production.

See portfolio ↗