OVMF/UEFI guests on Arch with Libvirt

I recently weathered a bloody battle with grub2 which ended with me pondering: Why don't I just boot this VM via UEFI? (Automating an Arch install to boot from UEFI post coming soon.) To hell with grub, it's finicky configuration, and the massive pain in my side.

Step 1: Install OVMF on the VM host

There are a few different OVMF packages available via extra and AUR. After trying the extra/ovmf package, and it not working immediately, I uninstalled and jumped to AUR with aur/ovmf-aarch64 & aur/ovmf-git.

This led me down an interesting path, as it seemed that I the OVMF_CODE.fd and OVMF_VARS.fd were missing, and just OVMF.fd was compiled in its place. One of the OVMF co-maintainers chimed in on the Debian bug tracker explaining essentially that it's up to distributions of the project to split the files, as including the OVMF.fd leads to confusion. It certainly led to my confusion.

Per the co-maintainer's suggestion, I went back to the distribution's ovmf package, and started debugging again from there.

$ yay -S extra/ovmf

Onto the extra configuration!

Step 2: Configure Libvirt to use OVMF

Libvirt claims that the nvram configuration option is obsolete, and Libvirt will follow the QEMU firmware metadata specification to automatically locate firmware images.

I found this to be hopelessly false. Whether or not the package maintainer is following the expected format or locations, these values do need to be configured to those paths where ovmf installs the files.


nvram = [

From there, simply restart the libvirtd service and create the new VM with the appropriate <os> values.

  <type arch="x86_64" machine="pc-q35-4.0">hvm</type>
  <loader readonly="yes" type="pflash">/usr/share/ovmf/x64/OVMF_CODE.fd</loader>
  <boot dev="hd"/>

If you are using virt-manager to create your VMs through the wizard, you should be able to now select “UEFI x86_64” in the “Firmware” dropdown when you customize your machine.