(Ubuntu 18.04 LTS)
Hello!
I can't get my EFI variables in the OVMF EFI firmware to persist - any changes I make in the textual interface of the EFI firmware are lost the moment I leave the interface. I understand my use-case is a bit unusual, but nevertheless there seems to be a problem here.
This is my use case/setup:
- I am attempting to have a single Windows 10 partition to boot natively (via GRUB option/dual-booting) as well as in a VM
- I am passing through my entire root drive (with both Ubuntu + Win10 partitions) to QEMU by passing through the entire block device found in /dev/disk/by-id/
- I am unmounting the EFI System Partition from the Ubuntu host every time I need to start up the VM
- I have an OVMF-based VM setup (using virt-manager & hence libvirt) to boot the Win10 partition
- I can currently boot the Win10 partition by booting first into rEFInd (via virtual CD drive + ISO) then selecting the Win10 bootloader
- I can also boot directly into Win10 by going into the EFI textual interface and selecting boot from ESP:/EFI/Boot/Microsoft/Boot/bootmgfw.efi
- When I change any settings inside the textual interface (boot order, inserting a new entry for the above bootmgfw.efi file, boot timeout are the ones I've tried), it 'saves' but then a reboot (without even killing the QEMU session) shows default settings again
- I would like to set a default boot order of the windows EFI file (bootmgfw.efi), as I won't be using this VM to boot the Ubuntu partition that the host is running off of (that would lead to file corruption obviously). I don't want to continue using this hacky rEFInd or manual selection through textual interface workflow - I'm sure to forget one time and crash my system.
I have made sure:
- Ubuntu 18.04 uses a 'split' OVMF firmware setup, with the main firmware living under /usr/share/OVMF/OVMF_CODE.fd whereas the persistent storage portion is stored under /var/lib/libvirt/qemu/nvram/<vm-name>_VARS.fd (ref1, ref2)
- the <vm-name>_VARS.fd file is actually being written to (updated on usage of the VM)
I've also tried to look at the OVMF logs (using instructions found here), but when I use sudo virsh edit <vm-name> to insert those lines, it complains it can't validate the XML file. If I force it to write and simply start the VM via virt-manager, I find that the debug lines are deleted by libvirt.
Is perhaps libvirt (or virt-manager) overwriting the EFI vars or somehow erasing the NVRAM file to implement the graphical boot order selection? I find that I can enable/disable the 'boot menu' option, and the settings inside the OVMF EFI textual interface will change (specifically the timeout changes from 0 to 3 seconds on 'enable' and vice versa'). Is there another way to debug OVMF other than those XML entries above?
TLDR:
I can't get the OVMF EFI boot order entries to persist, even with a split _VARS.fd file which apparently gets written to. Looking for ways to debug or other suggestions.
Thanks,
Fred
Here is the relevant part of my xml file:ref3
Hello!
I can't get my EFI variables in the OVMF EFI firmware to persist - any changes I make in the textual interface of the EFI firmware are lost the moment I leave the interface. I understand my use-case is a bit unusual, but nevertheless there seems to be a problem here.
This is my use case/setup:
- I am attempting to have a single Windows 10 partition to boot natively (via GRUB option/dual-booting) as well as in a VM
- I am passing through my entire root drive (with both Ubuntu + Win10 partitions) to QEMU by passing through the entire block device found in /dev/disk/by-id/
- I am unmounting the EFI System Partition from the Ubuntu host every time I need to start up the VM
- I have an OVMF-based VM setup (using virt-manager & hence libvirt) to boot the Win10 partition
- I can currently boot the Win10 partition by booting first into rEFInd (via virtual CD drive + ISO) then selecting the Win10 bootloader
- I can also boot directly into Win10 by going into the EFI textual interface and selecting boot from ESP:/EFI/Boot/Microsoft/Boot/bootmgfw.efi
- When I change any settings inside the textual interface (boot order, inserting a new entry for the above bootmgfw.efi file, boot timeout are the ones I've tried), it 'saves' but then a reboot (without even killing the QEMU session) shows default settings again
- I would like to set a default boot order of the windows EFI file (bootmgfw.efi), as I won't be using this VM to boot the Ubuntu partition that the host is running off of (that would lead to file corruption obviously). I don't want to continue using this hacky rEFInd or manual selection through textual interface workflow - I'm sure to forget one time and crash my system.
I have made sure:
- Ubuntu 18.04 uses a 'split' OVMF firmware setup, with the main firmware living under /usr/share/OVMF/OVMF_CODE.fd whereas the persistent storage portion is stored under /var/lib/libvirt/qemu/nvram/<vm-name>_VARS.fd (ref1, ref2)
- the <vm-name>_VARS.fd file is actually being written to (updated on usage of the VM)
I've also tried to look at the OVMF logs (using instructions found here), but when I use sudo virsh edit <vm-name> to insert those lines, it complains it can't validate the XML file. If I force it to write and simply start the VM via virt-manager, I find that the debug lines are deleted by libvirt.
Is perhaps libvirt (or virt-manager) overwriting the EFI vars or somehow erasing the NVRAM file to implement the graphical boot order selection? I find that I can enable/disable the 'boot menu' option, and the settings inside the OVMF EFI textual interface will change (specifically the timeout changes from 0 to 3 seconds on 'enable' and vice versa'). Is there another way to debug OVMF other than those XML entries above?
TLDR:
I can't get the OVMF EFI boot order entries to persist, even with a split _VARS.fd file which apparently gets written to. Looking for ways to debug or other suggestions.
Thanks,
Fred
Here is the relevant part of my xml file:ref3
Code:
<os>
<type arch='x86_64' machine='pc-i440fx-bionic'>hvm</type>
<loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>
<nvram>/var/lib/libvirt/qemu/nvram/win10_VARS.fd</nvram>
<bootmenu enable='yes'/>
</os>