HVF: Ubuntu Server fails to boot Linux 5.4.0-104

Host environment

  • Operating system: macOS 12.1
  • OS/kernel version: Darwin admins-Mac-mini.local 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:29:10 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T8101 arm64
  • Architecture: ARM64
  • QEMU flavor: qemu-system-aarch64
  • QEMU version: 6.2.0
  • QEMU command line:
    ./qemu-system-aarch64 -nodefaults -vga none -device ramfb -cpu host -smp 4 -machine virt,highmem=off -accel hvf -drive if=pflash,format=raw,unit=0,file=/opt/homebrew/share/qemu/edk2-aarch64-code.fd,readonly=on -m 4096 -device nec-usb-xhci,id=usb-bus -device usb-mouse,bus=usb-bus.0 -device usb-kbd,bus=usb-bus.0 -device virtio-blk-pci,drive=drive0,bootindex=0 -drive if=none,media=disk,id=drive0,file=data.qcow2,cache=writethrough -device usb-storage,drive=drive1,bootindex=1,removable=true,bus=usb-bus.0 -drive if=none,media=disk,id=drive1,file=ubuntu-20.04.3-live-server-arm64.iso

Emulated/Virtualized environment

  • Operating system: Ubuntu 20.04
  • OS/kernel version: Linux 5.4.0-104
  • Architecture: ARM64

Description of problem

On macOS with HVF, when Ubuntu Server updates the Linux kernel to 5.4.0-104, it no longer boots and gets stuck at EFI stub: Exiting boot services and installing virtual address map.... This is not the case with QEMU 6.0.0 (with @agraf's HVF patches applied).

It seems like 5.4.0-104 is the culprit because 5.4.0-100 boots fine.

Steps to reproduce

  1. Download Ubuntu Server 20.04 ARM64 ISO: https://ubuntu.com/download/server/arm
  2. Run the above QEMU command (make sure networking is disabled so Ubuntu installer does not auto-upgrade the kernel)
  3. Install Ubuntu with the default settings and reboot
  4. It will not reboot (expected) so Ctrl+C and restart the command adding -device virtio-net-pci,netdev=net0 -netdev user,id=net0 to the end to get networking
  5. Boot into Ubuntu and install 5.4.0-104 kernel: sudo apt install linux-image-5.4.0-104-generic
  6. Reboot and it will get stuck at EFI stub: Exiting boot services and installing virtual address map...

Additional information

image

Edited by osy