Issue encountered booting FreeBSD STABLE and CURRENT snapshots with EFI

Kyle Evans kevans at freebsd.org
Fri Mar 23 18:34:32 UTC 2018


On Fri, Mar 23, 2018 at 1:12 PM, Rodney W. Grimes
<freebsd-rwg at pdx.rh.cn85.dnsmgr.net> wrote:
>> On Fri, Mar 23, 2018 at 1:04 PM, Rodney W. Grimes
>> <freebsd-rwg at pdx.rh.cn85.dnsmgr.net> wrote:
>> > [ Charset UTF-8 unsupported, converting... ]
>> >> On Fri, Mar 23, 2018 at 9:58 AM, Rodney W. Grimes
>> >> <freebsd-rwg at pdx.rh.cn85.dnsmgr.net> wrote:
>> >> >> On Fri, Mar 23, 2018 at 3:56 AM, Joe Maloney <jmaloney at ixsystems.com> wrote:
>> >> >> > We narrowed the issue down to how vm-bhyve attaches a null.iso when starting
>> >> >> > the VM.
>> >> >> >
>> >> >>
>> >> >> What exactly are the contents of this null.iso? It sounds like we're
>> >> >
>> >> > touch "null.iso"
>> >> > -rw-r--r--  1 root  wheel  0 Dec  3 22:55 /home/vmbhyve/.config/null.iso
>> >> >
>> >> > It is litterly a 0 byte file.   This is just there to appease windows
>> >> > installer that you have a cd drive.
>> >> >
>> >> > You can test with bhyve yourself this problem by adding:
>> >> >         -s 3:0,ahci-cd,${vm_dir}/.config/null.iso
>> >> > to your bhyve command.
>> >> >
>> >>
>> >> Thanks for that! A couple hundred printf's later, I think this might
>> >> be a firmware bug or something of the sort (?).
>> >>
>> >> In this loop [1], the address at 'dp' is getting immediately clobbered
>> >> by the efi_lookup_devpath on every iteration, so we end up looking at
>> >> basically all of the partitions and this null.iso unfortunately meets
>> >> this criteria [2] for removable media with no media present.
>> >> Therefore, we detect absolutely no disks.
>> >>
>> >> The only candidate in efi_lookup_devpath [3] is the firmware itself
>> >> having overwritten the devpath at that address. We can confirm this
>> >> with a printf just after the efi_lookup_devpath- the pointer it's
>> >> returning is in fact exactly match 'dp' every single time.
>> >>
>> >> Is there a newer/different firmware you can try? This seems like
>> >> really peculiar behavior for a firmware to be exhibiting.
>> >
>> > What happened to the boot device on the hd?
>> > There should be another -s x:0, ahci-hd drive that it boots from.
>> >         -s 4:0,ahci-hd,${vm_dir}/${vmname}/disk0.img
>> >
>>
>> Right, it's there but we think it's removable media with no media
>> present because of the above-mentioned clobbering by the firmware. We
>> could probably work around it for this specific case, but I don't know
>> if that's a great idea- there be snakes here...
>
> And this also appers to works with the Windows boot code.. so I
> do suspect something has become broken in the new loader.
>

Benno points out that this is due to a uefi-edk2 hack [1] that should
be ripped out now. To quote him and his quote of grehan:

13:23 <@benno> https://github.com/freebsd/uefi-edk2/blob/bhyve/UDK2014.SP1/BhyvePkg/Library/PlatformBdsLib/BdsPlatform.c#L1030
13:23 <@benno> If you short-circuit that if so it always returns
everything will be happier.
13:24 <@benno> Quoting grehan:
13:24 < kevans91> Oh no
13:25 < kevans91> ew
13:25 <@benno> "The change was put in as a workaround for a bug in the
FreeBSD/UEFI loader, however, that issue was fixed with
               r285246.
13:25 <@benno> I'd think it unlikely that anyone would want to run <=
10.1 with bhyve/UEFI, so I the intercept could safely be
               removed."
13:25 <@benno> So the proper fix is to remove the override entirely.
13:25 <@benno> But in my testing I only got as far as just nerfing it
via sticking a 1 || in front of the if condition.

I don't think we want to workaround this in loader, and I can't
explain why this is functional with Windows since it's Windows- if I
could review some of the relevant source, I would.

Also CC'ing grehan@, since he's the one that knows the stuff.

[1] https://github.com/freebsd/uefi-edk2/blob/bhyve/UDK2014.SP1/BhyvePkg/Library/PlatformBdsLib/BdsPlatform.c#L1008


More information about the freebsd-virtualization mailing list