QEMU-KVM on aarch64: installation problems

Hi!

I’m trying to setup a vm server for arm64 development on an Honeycomb system with 1T NVMe SSD and 32G RAM.

I used the supplied Ubuntu 20.04 image for the base system.

I issued an apt update &&apt upgrade and rebooted.

I added via apt install:

  • qemu-system-arm, -common, -data
  • qemu-efi-aarch64, -arm
  • qemu-utils

Installation image: Ubuntu 18.04.04 for ARM64 from http://cdimage.ubuntu.com/ubuntu-server/bionic/daily-live/current/bionic-live-server-arm64.iso (renamed to install.iso)

I found this tutorial: How to launch ARM aarch64 VM with QEMU from scratch. - ARM-Datacenter

Creation of the images for pflash and the virtual disk drive:
#!/bin/bash
rm *.img
dd if=/dev/zero of=flash0.img bs=1M count=64
dd if=/usr/share/qemu-efi/QEMU_EFI.fd of=flash0.img conv=notrunc
dd if=/dev/zero of=flash1.img bs=1M count=64
qemu-img create -f qcow2 image.img 20G

Installation:

#!/bin/bash
qemu-system-aarch64 -enable-kvm -nographic -machine virt,gic-version=max -m 512M -cpu host -smp 4
-netdev user,id=vnet,hostfwd=:127.0.0.1:0-:22 -device virtio-net-pci,netdev=vnet
-drive file=image.img,format=qcow2,if=none,id=drive0,cach e=writeback -device virtio-blk,drive=drive0,bootindex=0
-drive file=install.iso,format=raw,if=none,id=drive1,cach e=writeback -device virtio-blk,drive=drive1,bootindex=1
-drive file=flash0.img,format=raw,if=pflash -drive file=flash1.img,format=raw,if=pflash

This seems to work fine as I can see. However, after the reboot does’t start into the newly installed system but into the installer.

Then I pkill qemu and try to run the installed system:

#!/bin/bash
qemu-system-aarch64 -enable-kvm -nographic -machine virt,gic-version=max -m 512M -cpu host -smp 4
-netdev user,id=vnet,hostfwd=:127.0.0.1:0-:22 -device virtio-net-pci,netdev=vnet
-drive file=image.img,format=qcow2,if=none,id=drive0,cach e=writeback -device virtio-blk,drive=drive0,bootindex=0
-drive file=flash0.img,format=raw,if=pflash -drive file=flash1.img,format=raw,if=pflash

I always end up in the UEFI shell but cannot start the installed system.

Whats wrong here?

Are there other idiot-proof tutorials?

Thanks

Frank

You most likely need to go into edk2 setup utility and choose your boot medium that you installed to. Generally I recommend using the libvirt tools like virt-install to install and manage VMs. They are less obtuse and much better documented.

ok, I have everything up and running.

  1. Broken installation images
    I first tried daily builds. These images are untested and are most probably just broken.

  2. Missing virtio driver in images.
    With some images the vm would boot from the image, start the installation but would complain about a missing cdrom - event if it successfully booted seconds before from just that virtual drive. This seems to be either a driver missing in the installation image or just a bug in the whole virtio thing. On PC platforms one should use IDE instead of virtio, but the simulated virtual machine just doesn’t have that. (or I didn’t find out how to use it)

I ended up using netboot ISO images. With those the installation worked fine. They don’t need to mount the cdrom again since they fetch all packages from the network, so the problem above is never triggered.

I got my images from here:
http://cdimage.ubuntu.com/netboot/

I tested 16.04, 18.04 and 20.04 LTS successfully.

I hope this might help others.

Frank

1 Like