<div dir="ltr"><div><div>Thanks again works like a charm!<br></div>I will also move to use the boot order directives instead of the os section<br></div><div><br>so my issues were addressed specifically by (3)<br></div><div>will move to (4) for best practices<br><br></div><div>Best Regards<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 20, 2016 at 1:27 PM, jsl6uy js16uy <span dir="ltr"><<a href="mailto:js16uy@gmail.com" target="_blank">js16uy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thanks VERY MUCH for all the info and help!<br>Apologies for the extreme delay. I got distracted by other threads that forced out this work to later date. Also some frustration as well. ;)<br>I completely missed this update. Apologies and thanks<br></div>Will be diving back into this shortly!<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 24, 2016 at 3:57 PM, Laszlo Ersek <span dir="ltr"><<a href="mailto:lersek@redhat.com" target="_blank">lersek@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>On 03/21/16 19:53, jsl6uy js16uy wrote:<br>
> Apologies if this has been gone over, but I believe I have checked the<br>
> intertubes more than a bit.....<br>
><br>
> I am using libvirt and have vms booting under an OVMF.fd to use an efi<br>
> firmware. I can create vms, linux ubuntu, and they will boot up.<br>
> However, everytime I reboot am I dropped into the default efi shell<br>
> provide by the tianocore build.<br>
> Then I must walk the FS to the booting efi app and run, in this case<br>
> grubx64.efi, to actually finish booting the host.<br>
> I had tried adding boot entries with efibootmgr within the OS and also<br>
> bcfg with the efi shell. I get no errors when adding an entry, and the<br>
> new entry shows up and I can manipulate the entry i.e. set it to next<br>
> boot and the like. Soon as I reboot I get dumped back to efi shell.<br>
><br>
> Am I missing something? Are the var changes not being stored? Is there<br>
> someplace to look for an error perhaps?<br>
><br>
> I also can use the same efi bootloader under libvirt to boot a hybrid<br>
> iso. location of the efi application on the hybrid iso is<br>
> /EFI/boot/bootx64.efi. Drops me right into my grub menu, after falling<br>
> thru from EFI FLOPPY1 and EFI FLOPPY2 to EFI DVD<br>
> So since that was/is working,  tried adding that to my efi partition so<br>
> it has /EFI/boot/bootx64.efi. The thinking being that since I can't add<br>
> an entry, I will setup for the "known" efi boot path. Of course that<br>
> didn't work either<br>
><br>
> I am on arch linux:<br>
><br>
> Linux X 4.4.5-1-ARCH #1 SMP PREEMPT Thu Mar 10 07:38:19 CET 2016 x86_64<br>
> GNU/Linux<br>
> local/libvirt 1.3.2-3<br>
>     API for controlling virtualization engines<br>
> (openvz,kvm,qemu,virtualbox,xen,etc)<br>
> local/libvirt-python 1.3.1-1<br>
>     libvirt python binding<br>
><br>
> UEFI:<br>
> Shell> ver<br>
> UEFI Interactive Shell v2.1<br>
> EDK II<br>
> UEFI v2.50 (EDK II, 0x00010000)<br>
><br>
><br>
> for this host....my nvram setting look like<br>
>   <os><br>
>     <type arch='x86_64' machine='pc-i440fx-2.5'>hvm</type><br>
>     <loader readonly='yes' type='pflash'>/home/xyz/OVMF.fd</loader><br>
>     <nvram<br>
> template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/libvirt/qemu/nvram/X_VARS.fd</nvram><br>
>     <boot dev='hd'/><br>
>   </os><br>
<br>
</div></div>Your domain XML is wrong. You can use OVMF with libvirt in three setups.<br>
<br>
(1) worst setup: map the unified OVMF.fd file (which includes variable<br>
store and fimrware executable) as ROM. I don't want people to use this,<br>
ever, so although libvirt does support it, I'm not going to share the<br>
XML snippet that implements this.<br>
<br>
(2) a bit less wrong setup (but still pretty wrong): map the unified<br>
OVMF.fd file as writeable pflash. This is bad because (a) you can't<br>
share the unified OVMF.fd file between guests, and (b) whenever you<br>
rebuild the OVMF.fd file, the guest that is pointed to it will lose all<br>
of its persistent variables.<br>
<br>
(3) the right setup: you almost got it right, but the <loader> element<br>
in this setup must not point to the unified OVMF.fd file. It must point<br>
to the executable-only part, the OVMF_CODE.fd file. So here's what you need:<br>
<br>
  <os><br>
<span>    <loader<br>
     readonly='yes'<br>
     type='pflash'<br>
</span>    >/your/build/output/OVMF_CODE.fd</loader><br>
    <nvram<br>
     template='/your/build/output/OVMF_VARS.fd'<br>
    >/var/lib/libvirt/qemu/nvram/guest_name_VARS.fd</nvram><br>
  </os><br>
<br>
This allows the firmware binary to be upgraded centrally, while every VM<br>
can keep its private varstore.<br>
<br>
The virt-install(1) manual describes this, under the example<br>
<br>
--boot<br>
loader=/.../OVMF_CODE.fd,loader_ro=yes,loader_type=pflash,nvram_template=/.../OVMF_VARS.fd<br>
<br>
The way you specified it implies that the varstore range will be mapped<br>
as read-only pflash directly from the unified OVMF.fd file, which<br>
happens to make the varstore non-writeable. In addition, the real<br>
varstore file will be mapped below *that*, which is completely bogus.<br>
<br>
(4) Instead of <boot> elements in the <os> element, <boot order='...'/><br>
elements are preferred under <disk> and friends.<br>
<br>
(5) You can (and are encouraged to) look at the OVMF log. If you want to<br>
capture it, you should implement the following changes:<br>
<br>
- add the following attribute to the root element of the domain XML:<br>
<br>
  <domain<br>
   type='kvm'<br>
   xmlns:qemu='<a href="http://libvirt.org/schemas/domain/qemu/1.0" rel="noreferrer" target="_blank">http://libvirt.org/schemas/domain/qemu/1.0</a>'  <-- this one<br>
  ><br>
<br>
- add the following XML fragment near the end of the domain XML, as a<br>
direct child of the <domain> element:<br>
<br>
    <qemu:arg value='-global'/><br>
    <qemu:arg value='isa-debugcon.iobase=0x402'/><br>
    <qemu:arg value='-debugcon'/><br>
    <qemu:arg value='file:/tmp/guest_name.log'/><br>
<br>
This will send the OVMF log to /tmp/guest_name.log.<br>
<br>
(6) If you are already missing a boot option to boot your installed OS,<br>
you might have to reestablish that boot option manually (after the above<br>
changes) -- add the option, and place it first in the boot order. You<br>
can use efibootmgr for this, or the BCFG command, or simply the firmware<br>
TUI.<br>
<br>
I could go into why, but this time I won't. If you are interested, you<br>
can mostly find the reason in the OVMF whitepaper<br>
<<a href="http://people.redhat.com/~lersek/ovmf-whitepaper-c770f8c.txt" rel="noreferrer" target="_blank">http://people.redhat.com/~lersek/ovmf-whitepaper-c770f8c.txt</a>>, section<br>
"Platform-specific boot policy", bullet (b), "Auto-generation of boot<br>
options". The point is, boot options pointing to arbitrary boot loader<br>
UEFI applications on non-removable media cannot be autogenerated, hence<br>
OVMF cannot filter them in. If you install the guest OS with the correct<br>
domain XML in the first place, then things will work.<br>
<br>
Some UEFI OSes also install "system rescue" utilities to the target<br>
non-removable media, under the default removable media pathname. The<br>
idea is that if you lose your "main" boot option (pointing to an<br>
arbitrary OS boot loader), then the firmware can still auto-generate a<br>
boot option for this fallback utility, and the fallback utility can<br>
restore the OS-specific boot loader's boot option. You can read more<br>
about this at<br>
<<a href="https://blog.uncooperative.org/blog/2014/02/06/the-efi-system-partition/" rel="noreferrer" target="_blank">https://blog.uncooperative.org/blog/2014/02/06/the-efi-system-partition/</a>>.<br>
<br>
Summary:<br>
- use a domain XML like described in (3) and (4)<br>
- when in doubt, capture the OVMF debug log as described in (5)<br>
<br>
Thanks<br>
<span><font color="#888888">Laszlo<br>
<br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>