Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#74694 - [edk2-ovmf] not working with QEMU UEFI and NVMe

Attached to Project: Arch Linux
Opened by Filipe Fernandes (filotek) - Tuesday, 10 May 2022, 12:59 GMT
Last edited by Toolybird (Toolybird) - Monday, 11 July 2022, 07:55 GMT
Task Type Support Request
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No



I use qemu and edk2-ovmf to install archlinux within a virtual machine. When using a nvme virtual device, and having setup GRUB, I was no longer able to get uefi to boot from the efi boot volume. The NVMe boot partition was missing from the list of options viewable via `efibootmgr -v`, so there was no way to set the next boot entry via `efibootmgr -n XXXX`.

After much searching and testing (which included manually adding efi entries using efibootmgr), downgrading edk2-ovmf to 202111-5 resolved the issue.

After some more searching, I found an email by Mara Sophie Grosch detailing a patch she submitted where the latest edk2 release doesn't properly recognize the NVMe command set. Her github PR was merged into edk2 but I'm guessing it was too late to include in the final release.

I included the fix into the edk2 PKGBUILD, rebuilt the package, and confirmed that her fix works to install archlinux in a qemu vm with uefi and nvme devices. The PKGBUILD diff is included as an attachment to this ticket.

Additional info:
* package version(s)
edk2-omvf 202202-2

* link to upstream bug report, if any">

Steps to reproduce:

The steps below is rather bare-bones and doesn't include the setup of the nic, I hope it's sufficient. If not, the gist of it is you just need to setup a qemu environment where uefi and nvme is employed to setup an archlinux install.

$ pacman -S edk2-ovmf qemu-desktop
$ truncate -s 20G disk.raw
$ qemu-system-x86_64 -cdrom ./archlinux.iso -drive file=./disk.raw,if=none,id=nvme0,format=raw,if=none,id=nvme0 -cpu host -smp cores=2 -m 4G -enable-kvm -drive if=pflash,format=raw,readonly=on,file=/usr/share/edk2-ovmf/x64/OVMF_CODE.fd -drive if=pflash,format=raw,file=/tmp/OVMF_VARS.fd -device nvme,drive=nvme0,serial=deadbeaf1,max_ioqpairs=8 -nic bridge,br=qemubr0,mac=52:54:2c:0f:11:b4

* Follow archlinux installation wiki using GRUB boot loader.
* efibootmgr -v
* the above should have NVMe as a boot option to set via `efibootmgr -n XXXX` but it is missing.
This task depends upon

Closed by  Toolybird (Toolybird)
Monday, 11 July 2022, 07:55 GMT
Reason for closing:  Fixed
Additional comments about closing:  edk2-ovmf 202205-1
Comment by Filipe Fernandes (filotek) - Tuesday, 10 May 2022, 13:01 GMT
I set the task-type as a "Support Request" because according to the Archlinux bug reporting guidelines, it's not a bug if the fix is already available upstream but not included in the final release.
I know that packages can have upstream patches applied but I don't know under what circumstances this is allowed and whether this circumstance fits the bill.