Skip to main content

pip install a Real Linux 7.3 VM: In-Process IaC, SSH, Desktop & Zero-MITM VMI in 5.9 MB

· Updated December 2, 2026 · 6 min read

TL;DR: Normally, isolating an AI agent or third-party script so it can’t read passwords, leak data, or delete real files means running Docker or renting cloud servers. unkernel-rs 0.9.0 — live on PyPI (pip install unkernel-rs, 5.9 MB wheel) and crates.io (cargo install unkernel-rs) — turns a real Linux 7.3 micro-VM (powered by pithings/unkernel on wasmtime) into an ordinary Python or Rust object with zero Docker, zero /dev/kvm, zero Node.js, and zero root. Below are the live experiments I ran: HTTP in 5.7 ms, real OpenSSH in 345 ms, a live Fluxbox Linux desktop in Chrome, 0.8 ms portable snapshots with counterfactual branching, zero-MITM HTTPS decryption from RAM, plus the new v0.9.0 capabilities (MCP server sandboxing, zero-daemon Docker images, native 200-OK sinkhole, and sub-millisecond warm pools).

Every developer building AI coding agents, supply-chain scanners, or integration tests eventually hits the exact same wall:

  • subprocess.run on the host is fast, until an LLM or a shady npm postinstall script reads ~/.ssh or runs rm -rf.
  • Docker / Testcontainers requires a running daemon, socket privileges, and still shares the host kernel.
  • Firecracker / QEMU gives you a real VM, but requires /dev/kvm (unavailable on macOS, Windows, and most CI runners).
  • Cloud sandboxes (e2b, modal) have great Python DX, but send your code to someone else’s cloud behind an API key and a meter.

What if pip install was the hypervisor, the network stack, the Copy-on-Write filesystem, and the VMI security monitor — all in one 5.9 MB package?

How unkernel-rs Fits Together

Click any showcase below to inspect how the Rust core, Python bindings, and built-in MCP server work on top of wasmtime::SharedMemory:

Interactive Architecture One 5.9 MB Package — Rust · Python · CLI · MCP Click any capability below to inspect how it works inside Wasmtime SharedMemory
🐍 pip install unkernel-rs / 🦀 cargo install unkernel-rs / 🤖 unkernel-mcp
↓
⚡ Wasmtime SharedMemory · Linux 7.3 (aarch64 / x86_64 / ZFS) · FreeBSD 16 · OpenBSD 8
~185–315 ms Warm boot (64 MiB minimal / 128 MiB Alpine)
~51 MiB RSS Incremental RAM per VM (~130+ idle VMs on a 16 GB laptop)
0 Host Daemons No Docker, no KVM, no root, no cloud API key
🖥️ In-Process IaC, SSH & Desktop SHOWCASE 1

How it works: Forward host TCP ports straight into the guest SLiRP stack (127.0.0.1:2222 -> guest:22 or :5900). Preview web servers, SSH in with ED25519 keys, or launch Xvfb + Fluxbox + x11vnc and open a full Linux 7.3 desktop in Chrome.

Why it matters: Zero Docker daemon, zero /dev/kvm, zero root privileges — works identically on Linux, macOS, Windows, and inside unprivileged CI runners.

with unkernel_rs.Vm(net=True, port_forwards=["127.0.0.1:2222:22"]) as vm:
    vm.shell("apk add --no-cache dropbear && dropbear -R -p 22", user="root")

Showcase 1: In-Process IaC — HTTP in 5.7 ms, SSH in 345 ms & a Full Desktop in Chrome

With native SLiRP TCP port forwarding (port_forwards=["127.0.0.1:2222:22"] in Python or -p 2222:22 on the CLI), a Linux VM becomes a first-class Python context manager — essentially In-Process Infrastructure as Code:

import urllib.request
import unkernel_rs

with unkernel_rs.Vm(
    net=True,
    port_forwards=["127.0.0.1:18092:8000", "127.0.0.1:2222:22"],
) as vm:
    # 1. Serve HTTP from inside the Wasm Linux VM -> 5.7 ms round-trip
    vm.shell(
        '(printf "HTTP/1.1 200 OK\\r\\nContent-Length: 26\\r\\n\\r\\nHello from Linux 7.3 Wasm\\n" '
        '| nc -l -p 8000 >/dev/null 2>&1) &',
        user="root",
    )
    print(urllib.request.urlopen("http://127.0.0.1:18092/").read().decode())

    # 2. Or start dropbear and connect with real OpenSSH (ED25519) -> 345 ms
    vm.shell("apk add --no-cache dropbear && mkdir -p /etc/dropbear && dropbear -R -p 22", user="root")

Measured live against the published unkernel-rs==0.8.0 wheel on an AMD Ryzen 7 5700U laptop:

OperationMeasured Result
uv install of unkernel-rs==0.8.0 (5.89 MiB abi3 wheel)3 ms
Minimal 64 MiB Linux warm boot (distro="none")185 ms (~51 MiB incremental RSS)
Full Alpine 3.24 Linux warm boot (memory_mib=128)315 ms (92.1 MiB peak RSS)
Inbound HTTP via port_forwards5.7 ms
Real OpenSSH (ED25519) command round-trip345 ms

And because port_forwards forwards any TCP service, I couldn’t resist pushing it one step further: installing Xvfb + Fluxbox + xterm + x11vnc on a 4 GiB sparse ext4 overlay (data_disk="desktop.ext4"), forwarding port 5900, and opening the live desktop in Chrome via noVNC:

Live Linux 7.3 remote desktop running inside Wasmtime from Python and rendered in Chrome via noVNC

A real Linux 7.3 X11 remote desktop (Xvfb + Fluxbox + xterm + x11vnc, 290 MB/sec framebuffer read rate over port_forwards) booted from ~25 lines of Python (desktop_vnc.py) and rendered live in Chrome via noVNC — zero Docker, zero KVM, zero root.


Showcase 2: Counterfactual Branching & Portable .uksnap Snapshots

One of the biggest pain points for AI coding agents is recovering from a bad edit or testing two competing fixes. With :cow 9P mounts and VmSnapshot, you get “Git for live Linux VMs”:

import unkernel_rs

with unkernel_rs.Vm(mounts=["./repo:/work:cow"]) as vm:
    vm.shell("echo 'baseline' > /work/run.log")
    snap = vm.snapshot()
    snap.save("pre_fix.uksnap")  # 0.8 ms, 330 bytes gzip!

# Reload in the same process — or any future Python session:
reloaded = unkernel_rs.VmSnapshot.load("pre_fix.uksnap")
with reloaded.branch() as branch_a, reloaded.branch() as branch_b:
    branch_a.shell("echo 'def add(a, b): return a + b' > /work/app.py")
    branch_b.shell("echo 'def add(a, b): return a * b' > /work/app.py")

    print(branch_a.workspace_diff("/work"))  # modified=['app.py'], created=['run.log']
    branch_a.commit_workspace("/work")       # atomically commit ONLY the winner!

In our live run, capturing and saving pre_fix.uksnap took 0.8 ms (330 bytes compressed). The host ./repo/app.py stayed completely untouched across both parallel branches until branch_a.commit_workspace("/work") ran.


Showcase 3: Zero-MITM VMI TLS Decryption, Freeze-on-Ask & audit-pkg

Because the entire guest RAM lives inside wasmtime::SharedMemory, the host has an untamperable out-of-band view of the guest kernel:

  1. Level-3 VMI process monitoring: Automatically calibrates Linux struct task_struct offsets from RAM at boot — zero guest agents, zero kernel patches.
  2. Zero-MITM TLS 1.3 decryption (vmi_tls=True): Extracts live TLS session keys directly from guest memory so even certificate-pinned binaries see the real upstream certificate while Python receives plaintext HTTP events.
  3. Whole-VM Freeze-on-Ask (freeze_on_ask=True): Freezes the entire guest Linux kernel and its monotonic clock mid-syscall while your Python callback (or a human in Telegram/Slack) approves or denies.
events = []
with unkernel_rs.Vm(
    net=True,
    allow_hosts=["example.com"],
    vmi_tls=True,
    on_audit=events.append,
) as vm:
    vm.shell("wget -qO- https://example.com | head -n 1")

Here is the real structured telemetry captured straight into Python (no CA cert injected into the guest):

{
  "direction": "tx",
  "method": "vmi",
  "http_summary": "GET / (Host: example.com)",
  "proc": { "pid": 110, "ppid": 109, "comm": "wget" }
}
{
  "direction": "rx",
  "method": "vmi",
  "http_summary": "HTTP/1.1 200 OK",
  "proc": { "pid": 110, "ppid": 109, "comm": "wget" }
}

And with ask_net=True, freeze_on_ask=True, an unapproved outbound connection freezes the guest and hands Python the exact originating process:

{
  "approval_id": 1,
  "kind": "net_connect",
  "target": "example.com:443",
  "detail": "ip=104.20.23.154 port=443",
  "proc": { "pid": 109, "ppid": 108, "comm": "wget" }
}

On the CLI, unkernel-rs audit-pkg bundles all of this into a one-command CI supply-chain firewall (exits 2 on suspicious credential reads or blocked exfiltration attempts):

unkernel-rs audit-pkg --ecosystem npm lodash --json
unkernel-rs audit-pkg --mount .:/work:cow --allow-host registry.npmjs.org --cmd "sh /work/postinstall.sh"

Showcase 4: Built-In MCP Server & 5 Booted Kernels

Want to give Claude Desktop, Claude Code, Cursor, Antigravity, or OpenCode a disposable Linux sandbox with counterfactual branching (vm_snapshot, vm_branch_exec, vm_diff, vm_commit, vm_inspect)? Drop three lines into your MCP config — via Rust or Python (uvx, zero Rust toolchain needed):

{
  "mcpServers": {
    "unkernel": {
      "command": "uvx",
      "args": ["--from", "unkernel-rs", "unkernel-mcp", "--mount", ".:/work:cow"]
    }
  }
}

And because unkernel-rs auto-exports mutable Wasm globals and supports standalone SMP kernels via --bundle, we’ve verified five different OS kernels booting on the exact same host runtime:

  • Linux 7.3.4+ aarch64 (default Alpine/Debian)
  • Linux 7.3.4+ x86_64 (via @JeremySu0818’s x86-64 bundle)
  • Linux 7.3.4+ with OpenZFS (tsirysndr/unkernel-assets, /proc/filesystems → nodev zfs)
  • FreeBSD 16.0-CURRENT (GENERIC_MP arm64)
  • OpenBSD 8.0-current (GENERIC.MP)

What’s New in v0.9.0

Four new building blocks landed right after the initial 0.8.0 benchmarks:

  1. Sandbox any untrusted MCP server (unkernel-rs wrap-mcp): Wrap third-party npx or uvx MCP tools inside an isolated micro-VM so they can only see the folder and domains you explicitly allow.
  2. Zero-daemon Docker / OCI images (image="alpine:3.21" / --image): Pull and run standard container images directly over HTTPS without Docker installed — cached locally and mounted in safe draft mode (:cow).
  3. Native 200-OK HTTP/HTTPS sinkhole (sinkhole=True / --sinkhole) + virtual time_warp: Intercept every outbound DNS and HTTPS request in-process with a local 200 OK trap (zero packets leave your machine, full decrypted POST payloads logged) while fast-forwarding sneaky sleep() delays.
  4. Sub-millisecond warm pools (snap.warm_pool(size=2)): Keep pre-booted VM branches ready in the background so pool.acquire() hands out a fresh Linux sandbox in under 1 ms.
import unkernel_rs

with unkernel_rs.Vm(image="alpine:3.21") as base:
    snap = base.snapshot()

events = []
with snap.warm_pool(size=2, sinkhole=True, time_warp=True, on_audit=events.append) as pool:
    with pool.acquire() as vm:  # < 1 ms from warm pool
        vm.shell("cat /etc/os-release")

Honest Limits (Where to Use It — and Where Not To)

This is not a replacement for production Kubernetes nodes or heavy C++ build farms:

  • Emulated CPU overhead: Guest aarch64 instructions are JIT-translated to Wasm and then to host machine code via Cranelift, and each VM runs single-vCPU (wasm_cpu_count=1). Shell scripts, Python/Node tooling, web previews, SSH, and security detonation feel great; multi-gigabyte C++ compiles or video encoding do not.
  • Where it shines: Local-first AI agent sandboxes, unprivileged CI supply-chain auditing, pytest fixtures for real Linux ops/IaC scripts, self-contained security/network labs (unkernel-rs lab), and embeddable Linux-as-a-Library in Rust or Python apps.

Try It in 10 Seconds

# Python (Linux x86_64/aarch64, macOS arm64, Windows x64 — Python 3.9+)
pip install unkernel-rs

# Rust CLI / library
cargo install unkernel-rs
cargo add unkernel-rs

The views and opinions expressed here are my own and do not reflect those of my employer.