Booting virtual machines with libvirt (kvm), without grub
Contents
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:
|
|
Then add this inside the <os>
section:
|
|
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.
Author Mathieu Lu
LastMod 2023-06-17