Testing Debian 12 ARM64 VM on Raspberry Pi 5 KVM: Pitfalls and Solutions
After successfully setting up a Home Assistant OS (HAOS) VM on my Raspberry Pi 5 (KVM/libvirt approach), I wanted to test a minimal Debian 12 ARM64 VM for InfluxDB and Grafana.
My Setup So Far
- Host: Raspberry Pi 5, 16GB RAM
- Hypervisor: KVM / QEMU / libvirt
- Guest: HAOS running smoothly
- Management: Cockpit & virt-manager
Trying Debian 12 VM: Where virt-install Fails (and Why)
First attempt: I tried to launch a Debian 12 ARM64 VM using virt-install. Example command (does NOT work for ARM64 on RPi5):
virt-install -v --name influxdb-grafana \
--ram 3072 \
--vcpus 2 \
--disk path=~/debian12/influxdb-grafana.img,cache=none,size=25 \
--nographics \
--osinfo debian12 \
--arch aarch64 \
--cdrom ~/debian12/debian-12.12.0-arm64-netinst.iso
Pitfall:
Despite using correct UEFI firmware, virt-install on ARM64/KVM can stall at boot, consume 100% CPU, and give a cryptic Synchronous Exception at 0x... error. This happens because:
- The ARM64 QEMU stack (especially on Raspberry Pi) relies on precise firmware, boot flags, and sometimes kernel quirks.
- Even with
qemu-efi-aarch64and UEFI,virt-installmay not properly initialize all necessary hardware, particularly the disk image and CPU. - The disk image file does not exist by default and must be created beforehand.
- ARM64 support is less mature than x86, so best practice is usually manual disk and VM creation.
Solution: QEMU Launch
Step 1: Create a Raw Disk Image and get Debian 12 image
Create a 25GB disk image for Debian: qemu-img create -f raw ~/debian12/influxdb-grafana.img 25G
Download image: wget https://ftp.thm.de/debian-cd/debian-12.12.0-arm64-netinst.iso
Step 2: Run QEMU Directly
Boot the Debian 12 installer using QEMU command-line:
qemu-system-aarch64 \
-machine virt \
-cpu cortex-a76 \
-m 3072 \
-bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd \
-drive file=~/debian12/influxdb-grafana.img,format=raw \
-cdrom ~/debian12/debian-12.12.0-arm64-netinst.iso \
-nographic
- Make sure you have downloaded the ARM64 netinst ISO from a reliable mirror (e.g. ftp.thm.de or cvut.cz).
- The disk image (
influxdb-grafana.img) must exist before running QEMU. - Use
-biosto point to the UEFI firmware, typically/usr/share/qemu-efi-aarch64/QEMU_EFI.fd.
Result:
This method starts the installer without triggering the “Synchronous Exception” error and works on Raspberry Pi 5 (KVM/qemu/libvirt stack).
During the Debian 12 ARM64 installation on the Raspberry Pi 5, be aware that the installer can appear to hang at around 83% with the message
Configuring linux-image-6.1.0-39-arm64 (arm64)for up to 30 minutes (or more). Afterward, it may repeat this slow kernel configuration process for an updated version, showingConfiguring linux-image-6.1.0-40-arm64 (arm64)and again taking a long time. Both steps involve unpacking the kernel and building the initramfs - tasks that are exceptionally slow on ARM64 virtual machines, even with a fast SSD. If you see these messages, don’t panic or reboot - just be patient, and the installation will eventually continue!
During installation, I noticed the CPU usage shot up to 100% especially while configuring packages like Configuring linux-image-6.1.0-39-arm64 (arm64)- and with all ARM cores working hard, my Raspberry Pi 5 warmed up enough that my little cooling fan started spinning in earnest!
In fact, a quick check showed this:
doma@rpi5:~/debian12 $ vcgencmd measure_temp
temp=58.7'C
Step 3: Import the Debian VM for Cockpit & Libvirt Management
Under construction… Might not work
After installing everything and testing your VM with manual QEMU (the installation may take more then 1 hour), you may want to stop it and re-import for easier management in Cockpit/libvirt.
To stop the manually running VM, first find and kill the QEMU process:
ps aux | grep influxdb-grafana.img
kill <pid>
Now register your existing disk image in libvirt with virt-install --import so your VM shows up in Cockpit:
This lets you manage and monitor your Debian ARM64 VM via Cockpit or virsh!
sudo virt-install \
--name influxdb-grafana \
--ram 3072 \
--vcpus 2 \
--disk path=~/debian12/influxdb-grafana.img,format=raw,bus=virtio \
--import \
--osinfo debian12 \
--arch aarch64 \
--graphics none \
--boot uefi,loader=/usr/share/qemu-efi-aarch64/QEMU_EFI.fd \
--cpu host \
--network bridge=br0,model=virtio,mac=52:54:00:4a:19:03
Final Notes
- LIBVIRT/virt-install for ARM is less predictable than on x86, so manual
qemu-imgandqemu-system-aarch64often “just work”. - For reliable network and storage performance, always check your firmware and disk image setup.
- If you run into similar exceptions, try different QEMU CPU models or firmware versions; regressions are common.