Installing the KVM Stack on Raspberry Pi OS: What Each Package Does
The previous post confirmed that the kernel's side is sound. This post installs the programs that run on top of it. Most guides give you an apt install command with nine package names and no explanation. That works, but it leaves you unable to work out problems later, because you do not know which package provides which program. Part 1 of this series explained what each layer of the stack does,…
This article explains the packages involved in installing the KVM stack on Raspberry Pi OS, and what each package does. The KVM stack is a virtualization technology that enables running virtual machines on Raspberry Pi. The post begins by noting that the kernel is properly configured, so the focus is on the programs that run on top of it.
The most common command for installing the KVM stack is an apt install command with nine package names, but this approach can be confusing as it doesn't explain which package provides which program.
The first package, qemu-system-arm, provides /usr/bin/qemu-system-aarch64, the main program for each virtual machine (VM). Other components, such as device models, virtual processor threads, and the loop that runs the guest on KVM, operate inside this program. This single package is named -arm, but it contains the 64-bit qemu-system-aarch64 program, so there is no separate package to look for.
The second package, qemu-utils, provides qemu-img, which is used for creating, converting, resizing, and snapshotting disk image files. When virt-install needs a new disk, it asks libvirt, which in turn uses qemu-img. The third package, qemu-efi-aarch64, is specific to ARM64 VMs. These VMs boot with UEFI firmware, and this package installs the appropriate firmware, called AAVMF, on the Raspberry Pi.
This firmware is crucial as it determines the firmware version used by libvirt's automatic choice between different versions, which can lead to confusing failures in later steps.
The fourth package, libvirt-daemon-system, installs libvirtd and sets it up as a system service. Libvirt is the main manager that keeps track of each VM's XML definition, turns it into a QEMU command, starts the process, and manages the VM. The installation also sets up the libvirt group, defines the default NAT network, and creates the default storage pool at /var/lib/libvirt/images.
The fifth package, bridge-utils, provides brctl, a tool for Linux bridges (software network switches), which is covered in Part 5. The sixth package, dnsmasq, is a small DHCP and DNS server that libvirt uses for the default NAT network it sets up. However, installing dnsmasq can cause problems as it also installs a system service, which libvirt's own copy of dnsmasq needs to access.
To avoid this, install dnsmasq-base instead, which provides the necessary program without starting a system service. The seventh package, libvirt-clients, contains tools that are directly used by the user: virsh for managing VMs, virt-host-validate for checking the host's readiness, and virt-xml-validate for checking XML definitions.
The final package, virt-manager, is a desktop program for managing VMs in a graphical interface, but it is optional for users without a screen.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.