VM fails to boot on Arch Linux host

This is a problem that has plagued me for weeks. I have an Arch Linux system running the Linux Surface kernel (https://github.com/linux-surface/linux-surface). I first really noticed this problem when I tried to make a Windows 11 VM in virt-manager with qemu and kvm. I’m fairly certain I configured Secure Boot, TPM and whatnot correctly. I manage to get to the point where the win11 spinning icon shows up… and then the VM crashes for no reason.

I also tried to boot a Tails usb stick by passing through the partitions and attempted to make a diskless VM with only archiso as the bootable device, as a last ditch effort. In both cases it would just refuse to recognise that the storage devices were bootable despite them being ticked in the boot order menu in the settings. I then also tried Virtualbox with a diskless VM running archiso, and it just said failed to boot and asked me if I wanted to try another medium instead. Again, I’m fairly certain that I have installed and enabled everything I require for virtualisation as the VMs successfully got to a UEFI screen, just that no OS could be booted.

If anyone wants to see the output of a certain command or some other log files, I can post it here. I am not too experienced with virtual machines and I have no idea what I should try.

Thanks for the help 🙂

EDIT:
Since I posted this I have moved to Artix Linux (basically arch but no systemd.) I followed the instructions given in one of the answers and installed some secure boot related stuff, and both artix install iso and Windows 10 iso do boot successfully. However win11 is still crashing when I attempt to boot the iso. I will attempt to upgrade from win10 to 11 to see if that will work.

Asked By: Merton Wu

||

Issue

QEMU is not UEFI aware by default. It normally boots Legacy BIOS only. See: OVMF Github

Solution

I believe you need to install Package:edk2-ovmf 202311-1 via pacman and try again. I’d link a tutorial here from the ArchWiki but the only ones I can find relate to PCI Passthrough for Graphics Cards, which assumes that you have the VM running already.

Answered By: eyoung100

I fixed it. The solution was… wait for it… don’t allocate the entire capacity of your RAM to the virtual machine! I suspect the kernel killed QEMU when it ran out of memory so it would crash. When I gave the thing less memory, win11 installation media would boot.

Answered By: Merton Wu