Problem
SmolVM uses QEMU on macOS, which has significant limitations:
Slirp networking: host cannot reach guest IP directly
No vsock support through SmolVM's QEMU backend
Port forwarding requires SSH tunnels (guest must run sshd)
Slow boot (~2-3s) compared to Firecracker on Linux (~500ms)
This forces users to either run SSH in their guest images or use workarounds like expose_local() for host→guest communication.
Proposal
Add libkrun as a third backend alongside Firecracker and QEMU.
libkrun is a lightweight VMM that uses Apple's Hypervisor.framework on macOS (and KVM on Linux). Key advantages:
Native virtio-vsock — direct host↔guest communication without networking
TSI (Transparent Socket Impersonation) — network connectivity without a virtual NIC
Fast boot — comparable to Firecracker (~500ms)
Lightweight — ~5MB library vs QEMU's ~200MB
OCI image support — can boot from container images via krunvm
Benefits
Unified vsock path : same guest agent communication on both Linux (Firecracker) and macOS (libkrun)
No SSH dependency : guest images don't need sshd for port forwarding
Faster dev loop : sub-second boot on macOS
Simpler networking : vsock replaces SSH tunnels + port forwarding
Implementation
New runtime_libkrun.py adapter following the pattern of runtime_firecracker.py and runtime_qemu.py
Add libkrun option to backend detection (auto selects libkrun on macOS if available, falls back to QEMU)
vsock device configuration (already supported in VMConfig via feat: add virtio-vsock support for Firecracker VMs #141 )
Process management for libkrun-based VMs
References
Problem
SmolVM uses QEMU on macOS, which has significant limitations:
This forces users to either run SSH in their guest images or use workarounds like
expose_local()for host→guest communication.Proposal
Add libkrun as a third backend alongside Firecracker and QEMU.
libkrun is a lightweight VMM that uses Apple's Hypervisor.framework on macOS (and KVM on Linux). Key advantages:
Benefits
Implementation
runtime_libkrun.pyadapter following the pattern ofruntime_firecracker.pyandruntime_qemu.pylibkrunoption to backend detection (autoselects libkrun on macOS if available, falls back to QEMU)VMConfigvia feat: add virtio-vsock support for Firecracker VMs #141)References