FS#64175 - [libvirt] fails to detect OVMF/UEFI firmware (regression)
Attached to Project:
Community Packages
Opened by Jaume Delclòs Coll (cosarara) - Saturday, 19 October 2019, 09:40 GMT
Last edited by Anatol Pomozov (anatolik) - Saturday, 11 January 2020, 00:30 GMT
Opened by Jaume Delclòs Coll (cosarara) - Saturday, 19 October 2019, 09:40 GMT
Last edited by Anatol Pomozov (anatolik) - Saturday, 11 January 2020, 00:30 GMT
|
Details
Description:
The behaviour is described in detail in this forum post: https://bbs.archlinux.org/viewtopic.php?id=250066 In short, even when ovmf is installed and /etc/libvirt/qemu.conf is properly configured, libvirt cannot find the ovmf images. Additional info: * The bug happens with libvirt-5.8.0-1 * Disappears when downgrading to libvirt-5.6.0-1 Steps to reproduce: From https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF#Setting_up_an_OVMF-based_guest_VM * After installing qemu, libvirt, ovmf, and virt-manager, add the path to your OVMF firmware image and runtime variables template to your libvirt config so virt-install or virt-manager can find those later on. /etc/libvirt/qemu.conf nvram = [ "/usr/share/ovmf/x64/OVMF_CODE.fd:/usr/share/ovmf/x64/OVMF_VARS.fd" ] * You can now enable and start libvirtd.service and its logging component virtlogd.socket. * Add your user to the libvirt user group to ensure authentication. * Run virt-manager and create a new VM with the System kvm/qemu connection. * When the VM creation wizard asks you to name your VM (final step before clicking "Finish"), check the "Customize before install" checkbox. * In the "Overview" section, set your firmware to "UEFI". Except you can't because the option is grayed out (this is the bug). |
This task depends upon
Closed by Anatol Pomozov (anatolik)
Saturday, 11 January 2020, 00:30 GMT
Reason for closing: Fixed
Additional comments about closing: libvirt-5.10.0-2
Saturday, 11 January 2020, 00:30 GMT
Reason for closing: Fixed
Additional comments about closing: libvirt-5.10.0-2
If you install extra/qemu-arch-extra, it will populated some of the firmwares that are already setup in /usr/share/qemu/firmware/. Those will then show up in the virt-manager firmware drop-down list.
I'm wondering if we need such a config for ovmf?
Also note that existing VMs that use the ovmf firmware run just fine, presumably because the nvram tag in the image XML definition points directly to the per-image firmware in /var/lib/libvirt/qemu/nvram/. I suspect it's also possible to create a new VM using 'virsh install' and passing it an XML config pointing directly to the base nvram firmware but I haven't actually tried this.
```
$ virt-install --name test --disk size=64 --network network=default --os-variant archlinux --boot uefi --memory 8192 -d
[Sat, 19 Oct 2019 17:15:56 virt-install 8171] DEBUG (cli:208) Launched with command line: /usr/share/virt-manager/virt-install --name test --disk size=64 --network network=default --os-variant archlinux --boot uefi --memory 8192 -d
[Sat, 19 Oct 2019 17:15:56 virt-install 8171] DEBUG (virt-install:207) Distilled --network options: ['network=default']
[Sat, 19 Oct 2019 17:15:56 virt-install 8171] DEBUG (virt-install:139) Distilled --disk options: ['size=64']
[Sat, 19 Oct 2019 17:15:56 virt-install 8171] DEBUG (cli:224) Requesting libvirt URI default
[Sat, 19 Oct 2019 17:15:56 virt-install 8171] DEBUG (cli:227) Received libvirt URI qemu:///system
[Sat, 19 Oct 2019 17:15:56 virt-install 8171] DEBUG (storage:140) Found default pool name=default target=/var/lib/libvirt/images
[Sat, 19 Oct 2019 17:15:56 virt-install 8171] DEBUG (storage:208) refreshing pool=default
[Sat, 19 Oct 2019 17:15:56 virt-install 8171] DEBUG (disk:225) Creating volume 'test.qcow2' on pool 'default'
[Sat, 19 Oct 2019 17:15:56 virt-install 8171] DEBUG (disk:359) disk.set_vol_install: name=test.qcow2 poolxml=
<pool type='dir'>
<name>default</name>
<uuid>a853f421-5115-4559-b757-a85b11dd337e</uuid>
<capacity unit='bytes'>274810798080</capacity>
<allocation unit='bytes'>11137085440</allocation>
<available unit='bytes'>263673712640</available>
<source>
</source>
<target>
<path>/var/lib/libvirt/images</path>
<permissions>
<mode>0755</mode>
<owner>0</owner>
<group>0</group>
</permissions>
</target>
</pool>
[Sat, 19 Oct 2019 17:15:56 virt-install 8171] DEBUG (guest:463) Setting Guest osinfo name <_OsVariant name=generic>
[Sat, 19 Oct 2019 17:15:56 virt-install 8171] DEBUG (installer:396) No media for distro detection.
[Sat, 19 Oct 2019 17:15:56 virt-install 8171] DEBUG (installer:398) installer.detect_distro returned=None
[Sat, 19 Oct 2019 17:15:56 virt-install 8171] DEBUG (guest:463) Setting Guest osinfo name <_OsVariant name=archlinux>
[Sat, 19 Oct 2019 17:15:56 virt-install 8171] DEBUG (osdict:326) No recommended value found for key='ram', using minimum=536870912 * 2
[Sat, 19 Oct 2019 17:15:56 virt-install 8171] DEBUG (cli:263) File "/usr/share/virt-manager/virt-install", line 1012, in <module>
fail(main_e)
File "/usr/share/virt-manager/virtinst/cli.py", line 263, in fail
log.debug("".join(traceback.format_stack()))
[Sat, 19 Oct 2019 17:15:56 virt-install 8171] ERROR (cli:264) Did not find any UEFI binary path for arch 'x86_64'
[Sat, 19 Oct 2019 17:15:56 virt-install 8171] DEBUG (cli:266)
Traceback (most recent call last):
File "/usr/share/virt-manager/virt-install", line 1005, in <module>
sys.exit(main())
File "/usr/share/virt-manager/virt-install", line 993, in main
guest, installer = build_guest_instance(conn, options)
File "/usr/share/virt-manager/virt-install", line 560, in build_guest_instance
installer.set_install_defaults(guest)
File "/usr/share/virt-manager/virtinst/install/installer.py", line 340, in set_install_defaults
guest.set_defaults(None)
File "/usr/share/virt-manager/virtinst/guest.py", line 729, in set_defaults
self._set_default_uefi()
File "/usr/share/virt-manager/virtinst/guest.py", line 787, in _set_default_uefi
path = self.get_uefi_path()
File "/usr/share/virt-manager/virtinst/guest.py", line 559, in get_uefi_path
"arch '%s'") % self.os.arch)
RuntimeError: Did not find any UEFI binary path for arch 'x86_64'
```
*virsh dumpxml <existing-uefi-vm-name> virsh-test.xml -- to get a template to work with
*edit virsh-test.xml -- change the name, delete the description, uuid, os/nvram tags and set the only hard disk to the arch iso.
*virsh define virsh-test.xml --validate
*open virt-manager -- the new UEFI/OVMF VM should appear and can be launched successfully
Hand editing XML is awful, but it does work.
https://www.redhat.com/archives/libvir-list/2019-May/msg00003.html
https://www.redhat.com/archives/libvir-list/2019-September/msg00485.html
The future is clearly the new FW descriptor JSON thing, but existing setups shouldn't just fall over. I might file an upstream bug after some more digging..
```
mkdir -p /etc/qemu/firmware
sed 's#qemu/edk2-x86_64-code.fd#ovmf/x64/OVMF_CODE.fd#;s#qemu/edk2-i386-vars.fd#ovmf/x64/OVMF_VARS.fd#' < /usr/share/qemu/firmware/60-edk2-x86_64.json > /etc/qemu/firmware/10-ovmf-workaround.json
systemctl restart libvirtd
```
We should really just get with the times and provide a JSON file via the ovmf package.
I've tested a patch and submitted it here[2]
It achieves exactly the same effect as the workaround / config edits mentioned above.
1. https://bugzilla.redhat.com/show_bug.cgi?id=1763477
2.
FS#64206Here is my file for testing: /usr/share/qemu/firmware/60-ovmf-x86_64.json
There are 2 problems:
1. qemu defaults to installing pre-built edk2 blobs and JSON files. The mere presence of a Firmware Desciptor JSON file on a system is enough for libvirt to ignore the nvram setting in /etc/libvirt/qemu.conf. This is by design.
2. Arch needs to modernize and ship an appropriate JSON file with the OVMF package.
1. can be fixed by following the Fedora lead in their qemu spec file:
# Provided by package edk2
rm -rf %{buildroot}%{_datadir}/%{name}/edk2*
rm -rf %{buildroot}%{_datadir}/%{name}/firmware/*edk2*.json
2. can be fixed by applying the patch provided in
FS#64206Edit: sorry, this is the line that works for me: <nvram template="/usr/share/ovmf/x64/OVMF_VARS.fd">/var/lib/libvirt/qemu/nvram/PARABOLA_VARS.fd</nvram>
This is frustrating. I'm surprised there's only a few amount of people being effected by this.
Stop frankensteining things. Apply the JSON file like the patch does.
Most people aren't affected by this because they're happy running BIOS VMs only.
EDIT: After updating libvirt from 5.9 to 5.10 and restarting libvirtd I am running into the same issue, looks like the new version broke things even further.
libvirt.libvirtError: operation failed: unable to find any master var store for loader: /usr/share/ovmf/x64/OVMF_CODE.fd
So it looks like the nvram vars file isn't being created, where before it was created automatically.
I'm running with a user session, so for me it should be created the following path (based on existing VMs where it was created automatically):
~/.config/libvirt/qemu/nvram/<vm-name>_VARS.fd
But this isn't happening.
Still a regression from the original behaviour, but definitely usable for now, thanks.
The issue is however is windows 10, which although now boots up, it is not able to load the iso for installation from the cdrom. Even trying exit->boot manager and selecting the DVD rom, it is still not able to start the installation process (the screen just blinks and reloads).
https://forum.level1techs.com/t/solved-ovmf-linuxarch-mandjaro-ovmf-uefi-not-available-in-virt-manager/149555
create: /usr/share/qemu/firmware/60-ovmf-x86_64.json
----------------------------------------------------
{
"description": "UEFI OVMF firmware for x86_64",
"interface-types": [
"uefi"
],
"mapping": {
"device": "flash",
"executable": {
"filename": "/usr/share/ovmf/x64/OVMF_CODE.fd",
"format": "raw"
},
"nvram-template": {
"filename": "/usr/share/ovmf/x64/OVMF_VARS.fd",
"format": "raw"
}
},
"targets": [
{
"architecture": "x86_64",
"machines": [
"pc-i440fx-*",
"pc-q35-*"
]
}
],
"features": [
"acpi-s3",
"amd-sev",
"verbose-dynamic"
],
"tags": [
]
}
& finally = systemctl restart libvirtd
FS#64206suggests that a config file should be added to OVMF. It is still not clear for me how libvirt release forces OVMF to be become broken.<nvram template="/usr/share/ovmf/x64/OVMF_VARS.fd">/var/lib/libvirt/qemu/nvram/[whatever name of the virtual machine]_VARS.fd</nvram>
If I don't add this line I get the error message: «unable to find any master var store for loader: /usr/share/ovmf/x64/OVMF_CODE.fd».
001 is a backport of https://libvirt.org/git/?p=libvirt.git;a=commit;h=57f9067ca3efffcfbbc7cd3f435482b63f875b72
002 is a backport of https://libvirt.org/git/?p=libvirt.git;a=commit;h=7c5264d2bee6c0bce152f5159f70e525ef0d0ebc
003 is a backport of https://libvirt.org/git/?p=libvirt.git;a=commit;h=8e1804f9f66f13ca1412d22bf1a957b6d55a2365
not added https://libvirt.org/git/?p=libvirt.git;a=commit;h=50d7465f3d5e7ee23af91059784bc51f4c316481 instead changed references in 003
0002-src-Introduce-and-use-vi... (7.1 KiB)
0003-qemu_firmware-Try-to-aut... (4.5 KiB)
UPDATE: scratch this statement. I was confused this issue with
FS#64206libvirt-5.10.0-2 with the upstream patches been pushed to [testing]. Please install this and 'ovmf' package from [testing] and let us know the results.