⚡ Written in Go

Manage QEMU-KVM VMs
simply & powerfully

Kvmrun is a suite of tools providing a CLI and gRPC interface for creating and managing virtual machines. Built for hosting providers who need hot-plug devices, live migration, and block backups.

Everything you need for VM management

From hot-plugging devices to live migration, Kvmrun simplifies the most essential tasks for cloud service providers.

💻

CLI & gRPC Interface

Create, edit, start and stop VMs via command line or the full-featured gRPC API with mutual TLS authentication.

🔆

Hot-plug / Unplug Devices

Attach and detach block, network, and PCI devices without restarting virtual machines.

🚀

Live Migration

Migrate running VMs between hosts -- with or without local storage, or with a specified list of block devices.

💾

Block Backups

Full and incremental block backups to protect your virtual machine data.

👁

VNC & Console Access

Access the guest virtual console (hvc0) and VNC console for interactive management.

🎮

PCI Passthrough (GPU)

Pass through host PCI devices via vfio-pci for GPU acceleration and other hardware access.

CloudInit Support

Configure CloudInit drives and build CloudInit ISO images for automated VM provisioning.

🔒

UEFI / OVMF

Configure and manage UEFI firmware for modern boot scenarios.

Resource Limits

Limit CPU resources via cgroups (v1 and v2) and IO operations via QEMU for fair scheduling.

🌐

Network Management

Use the included vnetctl tool to create network bridges, VxLAN tunnels, VLANs and custom network schemes.

📡

VSock Communication

Use VSock devices for efficient host-guest communication without exposing network ports.

🔧

External Kernel / Initrd

Run VMs with an external kernel and initrd, plus an ISO-file with modules (Linux-specific).

How Kvmrun works

Kvmrun uses Systemd to orchestrate virtual machines, providing isolation, reliability, and easy lifecycle management.

1

Systemd Management

Each VM is managed as a systemd unit. Systemd handles starting, stopping, and proper cleanup by invoking the appropriate Kvmrun utilities.

2

Isolation

Every QEMU process runs in its own personal chroot environment as an unprivileged user -- minimizing the blast radius of any single VM.

3

API-Driven

All exposed functions are defined in .proto files under the api directory. Communication uses a secure TCP port (TLS) or an abstract UNIX socket with mutual TLS authentication.

Up and running in 5 steps

Create your first Debian virtual machine from scratch.

Install Kvmrun

Follow the installation instructions below, and make sure QEMU is installed if you built from source.

Create a bootable image

Use the included script to create a Debian guest image:

$ /usr/share/kvmrun/mk-debian-image -t bullseye-slim

Wrap the image in a loop device

$ losetup -f --show debian-bullseye-slim.img
/dev/loop0

Create your first VM

$ vmm create-conf --mem 2048 --cpu 2-4 alice
$ vmm storage attach alice /dev/loop0

Start and connect

Launch the VM and access it via VNC:

$ vmm start alice
$ vmm list

Name PID Mem(MiB) CPUs State Time
alice 32531 2048/2048 2/4 running 34s

$ vmm vnc activate alice
Password: ofKajev5
Display/Port: 1024/6924

Get Kvmrun

Available as pre-built packages for Debian/Ubuntu, or build from source.

Pre-built Package Easiest

Install the repository and package in two commands:

$ curl -s https://packagecloud.io/install/repositories/0xef53/kvmrun/script.deb.sh | sudo bash

$ sudo apt-get install kvmrun

Build from Source

Requires make, git, and docker-ce:

$ git clone https://github.com/0xef53/kvmrun.git
$ cd kvmrun
$ make && make install

# Generate certificates and start the server
$ /usr/lib/kvmrun/gencert
$ systemctl enable kvmrund.service
$ systemctl start kvmrund.service

Supported Configurations

Kvmrun works with QEMU 3.1.x and above. Below are tested combinations:

Debian 10 + QEMU 3.x/5.x Debian 11 + QEMU 5.x/6.x/7.x Debian 12 + QEMU 7.x/8.x Debian 13 + QEMU 6.x/7.x/8.x/9.x Ubuntu 20.04 LTS + QEMU 4.x Ubuntu 22.04 LTS + QEMU 6.x/7.x/8.x Ubuntu 24.04 LTS + QEMU 8.x/9.x