Old School Manual ARM for Libvirt/KVM

craig arm-based netbook running debian


  • Create a non-EFI (old school) ARM Hard Float 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 Images

NB Instead of vmlinuz and initrd.gz as the filenames you should use filenames that include the debian version and architecture (e.g. call vmlinuz debian-10.6.0-armhf-vmlinuz).

  1. Get Debian Buster armhf kernel
  2. Get Debian Buster armhf initrd
  3. Get Debian Buster armhf CD#1 image

Prepare to Use the Debian-Installer Image

Open the download location in a terminal.

Copy the kernel, initrd, and CD image

  1. sudo cp vmlinuz initrd.gz debian-10.6-buster-armhf-complete-image.img /var/lib/libvirt/images on the machine where you will host the ARM VM.

OR upload kernel, initrd, and CD image using virsh

  1. ls -al vmlinuz initrd.gz debian-10.6.0-armhf-xfce-CD-1.iso
  2. virsh -c qemu+ssh://user@host/system vol-create-as --pool default --name vmlinuz --format raw --allocation <size-from-ls> --capacity <size-from-ls>
  3. virsh -c qemu+ssh://user@host/system vol-upload --pool default --vol vmlinuz --file vmlinuz
  4. virsh -c qemu+ssh://user@host/system vol-create-as --pool default --name initrd.gz --format raw --allocation <size-from-ls> --capacity <size-from-ls>
  5. virsh -c qemu+ssh://user@host/system vol-upload --pool default --vol initrd.gz --file initrd.gz
  6. 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>
  7. 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

  1. Launch “Virtual Machine Manager” (virt-manager from the command line).
  2. Select ‘File|New Virtual Machine’
  3. Select ‘Import existing disk image’
  4. 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).
  5. Select ‘Browse…’, create a virtual hard disk for the new VM, and select ‘Choose Volume’.
  6. For each of the kernel and initrd, browse to the file and select ‘Choose Volume’.
  7. Set ‘Kernel args’ to ‘elevator=noop noresume’.
  8. Set the operating system to ‘Debian10’
  9. Select ‘Forward’
  10. Configure the amount of memory and cpus (max 4) and select ‘Forward’
  11. Set the VM name and check ‘Customize configuration before install`
  12. Select the appropriate network device for your virtual hosting setup.
  13. Click ‘Finish’
  14. Select ‘Add Hardware’, and add a Controller of ‘Type: SCSI’ and ‘Model: VirtIO SCSI’.
  15. Select ‘Add Hardware’, and add Storage (CD-ROM) for the CD ISO image (use SCSI as the bus type).
  16. Select ‘Begin installation’
  17. 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:

  1. These instruction assume you don’t use LVM.
  2. GRUB installation will fail. This is expected — we will work around this below.
  3. Click through (OK/Continue/Ignore) until you are able to Select ‘Continue without bootloader’
  4. Installation will complete and the VM will reboot into the installer.
  5. Force Off the VM (e.g. in VMM with ‘Virtual Machine|Force Off’)
  6. Remove the CD image from the CD-ROM (optionally remove the virtual CD-ROM device too; you won’t need it).

Enable Booting the Virtual Machine

NB You will need to repeat this whenever the initramfs and/or kernel is updated.

Copy the kernel (vmlinuz) and initramfs (initrd.img) from the domain (VM)

So that you can use it to boot the domain (VM).

On the virtual machine host:

  1. Become root
  2. Execute mkdir /tmp/armbootfiles
  3. Execute chmod 700 /tmp/armbootfiles
  4. Execute cd /tmp/armbootfiles
  5. Execute guestfish -c qemu:///system --ro -i -d <name-of-your-vm>
  6. Execute ls /boot to find the names of the newest vmlinuz and initrd.img (you don’t want the plain vmlinuz and initrd.img because they are just symlinks).
  7. Execute copy-out /boot/vmlinuz-x.x-x.x-armmp-lpae /boot/initrd.img-x.x.x-x-armmp-lpae ./
  8. Execute exit
  9. Execute prename -e 's/^/<name-of-your-vm>/' *
  10. Execute mv <name-of-your-vm>-* /var/lib/libvirt/images
  11. Execute exit

Edit the domain (VM) to update the direct boot

Using the kernel and initrd from the VM.

  1. In Virtual Machine Manager, in the VM Details page, Select ‘Boot Options’
  2. Make sure ‘Enable direct kernel boot’ is checked.
  3. For the ‘Kernel Path’, ‘Browse’ to the location of the new kernel and select ‘Choose Volume’
  4. For the ‘Initrd Path’, ‘Browse’ to the location of the new initrd.img and select ‘Choose Volume’
  5. Add root=/dev/vda2 to ‘Kernel args’. (If you used LVM the path will be slightly different).
  6. Select ‘Apply’

Alternative method to edit domain (VM)

  1. Execute virsh -c qemu+ssh://user@host/system edit <name-of-domain>
  2. Place the appropriate paths in the <kernel>…</kernel> and <initrd>…</initrd> tags.
  3. Also edit the <cmdline>…</cmdline> to add root=/dev/vda2 as above.
  4. Save your changes.

Boot to Test

Test that your system now boots properly by using ‘Virtual Machine|Run’.

By Daniel F. Dickinson

Daniel Dickinson has been using and exploring computer and electronic technologies for over three decades. He is proficient with various flavours of Linux (including varieties of desktop, server, and embedded systems) as well as modern Windows. Daniel still enjoys software and firmware development, but prefers integration and extending existing open source solutions to quickly achieve desired goals. Fo more details see https://www.wildtechgarden.com/about/about-daniel-f

Leave a comment

Your email address will not be published. Required fields are marked *