UEFI manual ARM for Libvirt/KVM
NB These instructions are out of date since the release of Debian 11 (Bullseye). Some parts of this guide will need to be updated to the new Debian release.
Overview
- Create an UEFI (newish) ARM hardfloat (32-bit) virtual machine for Libvirt/KVM using a traditional interactive Debian install.
- See Four ARMs for Libvirt/KVM virtualisation for prerequisites, why, and other alternatives.
Get the Installer Image
For Debian 10 (Buster)
- Get [Debian Buster armhf CD#1
image](
https://mirror.csclub.uwaterloo.ca/debian-cd/10.6.0/armhf/iso-cd/debian-10.6.0-armhf-xfce-CD-1.iso
)
Prepare to Use the Debian-Installer Image
Open the download location in a terminal.
Copy the CD image
On the machine where you will host the ARM VM:
sudo cp debian-10.6-buster-armhf-complete-image.img /var/lib/libvirt/images
OR upload CD image using virsh
Execute
virsh -c qemu+ssh://user@host/system vol-create-as --pool default --name debian-10.6.0-armhf-xfce-CD-1.iso --format raw --allocation <size-from-ls> --capacity <size-from-ls>
Execute
virsh -c qemu+ssh://user@host/system vol-upload --pool default --vol debian-10.6.0-armhf-xfce-CD-1.iso --file debian-10.6.0-armhf-xfce-CD-1.iso
Create the ARM VM using Virtual Machine Manager
- Launch “Virtual Machine Manager” (virt-manager from the command line).
- Select ‘File|New Virtual Machine’
- Select ‘Import existing disk image’
- Change ‘Architecture options’ to Architecture: ‘arm’, Machine Type: ‘virt-2.12’. (virt-3.0 and virt-3.1 are known to not work with this guide; newer and older versions likely will work).
- Select ‘Browse…’, create a virtual hard disk for the new VM, and select ‘Choose Volume’.
- Set the operating system to ‘Debian10’
- Select ‘Forward’
- Configure the amount of memory and cpus (max 4) and select ‘Forward’
- Set the VM name and check ‘Customize configuration before install`
- Select the appropriate network device for your virtual hosting setup.
- Click ‘Finish’
- Change ‘Firmware’ to ‘Custom: /usr/share/AAVMF/AAVMF32_CODE.fd’ and click ‘Apply’.
- Select ‘Add Hardware’, and add a Controller of ‘Type: SCSI’ and ‘Model: VirtIO SCSI’.
- Select ‘Add Hardware’, and add Storage (CD-ROM) for the CD ISO image (use SCSI as the bus type).
- Under ‘Boot Options’ make sure ‘SCSI CD-ROM 1’ is checked and second (after VirtIO Disk 1)
- Select ‘Begin installation’
- Make sure to select the VM console when it appears otherwise random errors may occur.
Perform Debian Installation
I won’t cover this in detail as it’s a fairly standard Debian install except:
- Installation will complete and the VM will reboot into the installer. (This misbehaviour may depend on the version of libvirt you are using; if you are fortunate the VM will simply boot into Debian directly).
- Force off the VM (e.g. in VMM with ‘Virtual Machine|Force Off’)
- Remove the CD image from the CD-ROM (optionally remove the virtual CD-ROM device too; you won’t need it).
Enable VM (domain) Boot into Debian
- Boot the VM (e.g. using ‘Virtual Machine|Run’).
- It will drop to a UEFI shell.
- Execute
bcfg boot add 0 FS0:EFI\debian\grubarm.efi "Linux"
- Execute
reset
- VM should reboot into Debian GNU/Linux.
Boot at Will
Your UEFI ARM hardfloat virtual machine is now ready for use.