The Pragmatic Addict
Host VMs on your Raspberry Pi with qemu
Background
I’ve had great success using qemu on my x86_64 machines hosting various Windows servers, development environments etc. After some research Raspberry Pi does support kvm, though most of the solutions out there use libvirt which is nice but I prefer something a bit more bare bones.
- Testing was done on a Raspberry Pi 4 Model B Rev 1.5 with 8Mb of memory running Raspbian OS/Debian 12.
- This solution even works (rather well!) over ssh with X11 forwarding.
- This will support the aarch64 (arm64) architecture natively using KVM.
- This example will install the latest version of Debian as a VM. Yes you can use any OS that supports aarch64 (arm64) & uefi.
Install qemu
sudo apt-get install qemu-system-arm
Download the Debian ISO installer
wget "https://ftp.debian.org/debian/dists/stable/main/installer-arm64/current/images/netboot/mini.iso"
Create your hard disk image
qemu-img create -f qcow2 debian.qcow2 50G
Create debian-qemu.sh
#!/bin/bash
exec qemu-system-aarch64 -machine virt,accel=kvm -cpu host -m 1G \
-bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd \
-display gtk,grab-on-hover=on,zoom-to-fit=off \
-device virtio-gpu-pci \
-device qemu-xhci -device usb-kbd -device usb-tablet \
-drive if=virtio,format=qcow2,file=debian.qcow2 \
-cdrom mini.iso
Start your VM!
bash ./debian-qemu.sh
Notes
- On first run (since the disk image is blank) it should boot off of the CD image (mini.iso). Once the disk image has a bootable OS on it, it should default to that.
- qemu -boot order command does not work with the non x86 bios. Press F2 at the UEFI boot screen for options.
- In this example efi secure boot is disabled, therefore Windows 11 will be challenging (….).
- As a temporary measure if the video doesn’t work install seabios and use -device ramfb. This should help get you through some installations.
| Created: 2025-10-15 |
Modified: 2025-10-15 |