I had a very mysterious boot issue with a virtual machine. I was debugging something and re-installed Grub from inside a chroot, from the parent host. The VM did not boot anymore (“no such device: UUID; unknown filesystem”). Normally a Grub re-install would have fixed it, but for some reason it didn’t (and I tried disabling UUIDs and many other options).

How to boot a VM without Grub? A workaround is to boot a kernel located on the parent server, instead of inside the VM itself. This means that the parent server is responsible for updating kernels, which can be more tedious for most people unless it’s well automated, but it’s a useful workaround.

To use it, edit the libvirt settings for that VM:

1
virsh edit myvm

Then add this inside the <os> section:

1
2
3
    <kernel>/var/lib/libvirt/images/vmlinuz-5.10.0-22-amd64</kernel>
    <initrd>/var/lib/libvirt/images/initrd.img-5.10.0-22-amd64</initrd>
    <cmdline>root=/dev/vda1 console=ttyS0 ro debug nosplash</cmdline>

In this case, I had copied the vmlinuz/initrd from my VM onto the parent host. Also note that I hardcoded /dev/vda1 because that’s what all my VMs use.