Check Prerequisites
SmolVM uses hardware virtualization for strong isolation. Requirements vary by platform:
- Linux (Firecracker)
- macOS (QEMU)
Requirements:If
- KVM support (check with
ls /dev/kvm) - Ubuntu, Debian, or Fedora recommended
- Root access for initial setup
/dev/kvm doesn’t exist, enable virtualization in your BIOS/UEFI or enable nested virtualization if running in a VM.Install SmolVM
Install the Python package:
- Linux Setup
- macOS Setup
Run the system setup script to install Firecracker and configure permissions:This script will:
- Install Firecracker and required dependencies
- Configure KVM permissions
- Set up networking tools (nftables, iproute2)
- Configure sudoers for runtime operations (optional)
The
--configure-runtime flag sets up scoped NOPASSWD sudo for SmolVM operations, avoiding password prompts during VM lifecycle management.Try the Context Manager Pattern
For automatic cleanup, use SmolVM as a context manager:
The context manager automatically handles VM lifecycle - it starts on entry and stops/deletes on exit.
Next Steps
Now that you have SmolVM running, explore these topics:Port Forwarding
Learn about port forwarding and local exposure
API Reference
Explore the complete SmolVM API
AI Agent Integration
Integrate SmolVM with AI agents and tool calling
Custom Images
Build specialized VM images with your own tools
Troubleshooting
KVM device not found (/dev/kvm)
KVM device not found (/dev/kvm)
Linux only - If you see “KVM device missing”:
-
Check virtualization support:
If nothing appears, enable virtualization in BIOS/UEFI.
-
Load KVM modules:
-
Check permissions:
-
Add your user to kvm group:
SSH connection timeout
SSH connection timeout
If VM starts but SSH times out:
- Wait longer - First boot downloads and builds the Alpine image (30-60s)
-
Check VM status:
-
Increase timeout:
-
Check networking:
Permission denied errors
Permission denied errors
If you see permission errors:
-
Re-run system setup:
-
Check group membership:
-
Refresh groups without logout:
-
Verify sudoers configuration:
VM boots but commands fail
VM boots but commands fail
If the VM starts but
vm.run() fails:-
Verify SSH-capable image:
-
Check boot args:
-
Auto-config mode uses SSH by default:
-
Manual config requires SSH boot args:
macOS: QEMU not found
macOS: QEMU not found
If QEMU isn’t detected:
-
Install via Homebrew:
-
Verify installation:
-
Run setup script:
Firecracker download fails
Firecracker download fails
If Firecracker installation fails:
-
Check internet connectivity:
-
Manual download (Linux):
-
Skip deps if already installed:
Verify Installation
Run the diagnostic command to check everything is configured correctly:- Backend detection (Firecracker on Linux, QEMU on macOS)
- KVM availability (Linux only)
- Required system tools
- Network configuration
Performance Expectations
SmolVM is optimized for speed. Typical timings on modern hardware:| Operation | Time (p50) |
|---|---|
| VM Create + Start | ~572ms |
| SSH Ready | ~2.1s |
| Command Execution | ~43ms |
| Stop + Delete | ~751ms |
| Full Lifecycle | ~3.5s |
First boot takes longer (30-60s) as it downloads and builds the Alpine base image. Subsequent boots use the cached image.
What’s Next?
You’ve successfully set up SmolVM! Here are some recommended next steps:- Learn the API - Explore port forwarding, environment variables, and VM persistence
- Build Custom Images - Create specialized images with pre-installed tools
- Integrate with AI Agents - Use SmolVM as a secure execution environment for LLM-generated code
- Optimize Performance - Learn about disk modes, memory sizing, and network configuration