Hi!
I’m trying to build qcow2 images for bare metal deployments (afterwards converted to raw) with using Packer and QEMU/KVM.
For BIOS supported hardware it works already fine and I’m building images for several Linux and Windows distributions. But since our newly DELL servers only supporting UEFI when using our NVME disks I need also UEFI images.
After hours of debugging I finally got KVM running with UEFI by using these qemuargs
in Packer.
"qemuargs": [
["-m", "2048M"],
["-machine", "q35,accel=kvm"],
["-smp", "2"],
["-global", "driver=cfi.pflash01,property=secure,value=on"],
["-drive", "file=artifacts/qemu/{{user `name`}}/packer-{{user `name`}},if=virtio,cache=none,discard=unmap,format=qcow2"],
["-drive", "file=/usr/share/OVMF/OVMF_CODE.secboot.fd,if=pflash,format=raw,unit=0,readonly=on"],
["-drive", "file=/var/lib/libvirt/qemu/nvram/f20-uefi_VARS.fd,if=pflash,format=raw,unit=1"],
["-boot", "order=c,once=d,menu=on,strict=on"]
],
So far, so good. In my example I’m building a Ubuntu 20.04 image. The unattended installer is running fine and then Ubuntu installation reboots for the final provisioning steps.
And here comes the issue, the UEFI driver ignores the KVM -boot order and always using CD-ROM as first boot device. So it never boots from the installed qcow2 disk - so the machine hangs in a CD-ROM boot-loop forever.
Has someone already found a solution for this? I’ve been trying around with using bootorder
on the -drive
parameters but this seems also not being supported:
2020/11/25 05:22:52 packer-builder-qemu plugin: Qemu stderr: qemu-kvm: -drive file=artifacts/qemu/ubuntu-20.04.1/packer-ubuntu-20.04.1,if=virtio,cache=none,discard=unmap,format=qcow2,bootindex=0: Block format ‘qcow2’ does not support the option ‘bootindex’
Thank you in advance!
Alex