I’m migrating some existing KVM virtual machines to LXD. Since they already have a filesystem image, I just copy the raw filesystem device as it is. This works well, but booting the virtual machine fails, because it does not have an EFI partition. These are regular BIOS bootable instances. This shouldn’t be a problem since Qemu supports booting both BIOS and EFI. But I can’t find a way to convince LXD to use BIOS boot.
I tried to add the -bios
parameter:
lxc config set testvm raw.qemu='-bios /usr/share/seabios/bios-256k.bin'
With ps
I can see that the extra qemu parameter was added, but the instance still tries to boot in EFI mode.
Qemu by default uses BIOS boot, and the EFI mode seems to be becaues in /var/snap/lxd/common/lxd/logs/testvm/qemu.conf
there is a pflash drive added which uses file /snap/lxd/current/share/qemu/OVMF_CODE.fd
. So tried to override that:
lxc config set testvm raw.qemu='-drive if=pflash,format=raw,unit=0'
But lxc start testvm
fails:
qemu-system-x86_64: -drive if=pflash,format=raw,unit=0: drive with bus=0, unit=0 (index=-1) exists
Looking at the code at lxd/driver_qemu.go at master · lxc/lxd · GitHub and lxd/driver_qemu_templates.go at master · lxc/lxd · GitHub there seems to be no way to disable this. At this point I’m stuck.
What would be a good way to migrate existing BIOS instances to LXD?