Bug 244906

Summary: kernel booted by loader.efi on VMware Fusion crashes in EFI firmware
Product: Base System Reporter: Francis Dupont <fdupont>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed DUPLICATE    
Severity: Affects Some People CC: brigadir15, chris, garga, grahamperrin, hehongbo, lilycollins9x, lwhsu, pi, rleigh, tsoome, yklaxds, ypankov, yuripv, yuripv
Priority: --- Keywords: uefi
Version: CURRENT   
Hardware: amd64   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250580
Attachments:
Description Flags
Screenshot of failure none

Description Francis Dupont 2020-03-19 12:19:34 UTC
It is a known issue generic to some VMware products (https://www.reddit.com/r/freebsd/comments/drxqlm/failed_to_do_efi_boot_on_a_vmware_virtual_machine/f6om6p2/) and restoring a previous version of /boot/loader.edi works well.

So the bug is between 13.0-CURRENT loader.efi and VMware EFI firmware.

Unfortunately VMware does not give information (other than the firmware crashes) so I am afraid the bug will be hard to find. BTW I have a pretty fast host so I can help.
Comment 1 Ruslan Garipov 2020-03-20 15:00:57 UTC
After r358989 I unable to boot my FreeBSD 13.0-CURRENT VMware guest
systems anymore.  Even with that ``loader prompt trick''.

I wrote to Toomas Soome, and he said[1] that:

> Regarding the issue with vm, I am afraid the roots are going much
> deeper there. I have not got to the exact cause (and therefore a fix),
> but the problem is not about this specific patch. The problem is about
> memory map, specifically one just before and after we switch off Boot
> Services.

Therefore, currently I have to revert r358989 to be able to boot UEFI
VMware guests on VMware ESXi or Workstation.  But that patch is not
actually the reason for boot failing.

[1] https://lists.freebsd.org/pipermail/svn-src-head/2020-March/134676.html
Comment 2 Francis Dupont 2020-03-23 17:04:46 UTC
Found another reference http://freebsd.1045724.x6.nabble.com/ESXi-VM-does-not-boot-in-UEFI-mode-from-20190906-snapshot-ISO-td6350284.html

Note the r358989 breaks the work-around: the only way to recover is to boot from an install or live cd and restore a working (e.g 12.1 release, not 12 stable) loader.efi file.
Comment 4 Toomas Soome freebsd_committer freebsd_triage 2020-03-23 18:33:28 UTC
(In reply to Ruslan Garipov from comment #1)

Yes, it does "help" to trigger the issue by adding a bit to loader.efi size and via some change to screen update - getting text on screen via simple text output protocol does cause memory allocation by uefi firmware.

The first visible related error is memory allocation to store efi memory map just before we switch off BootServices, however simple switch to alternate memory does not chenge anything there, so it must be something more going on.

My guess is that the best option still would be to hook up to gdb stub and try to catch where we are blowing up and then we also know why exactly. Right now we can only guess.
Comment 5 Yuri Pankov 2020-10-08 18:13:07 UTC
So this is now in 12.2 as well? Can it be fixed finally?
Comment 6 ykla 2020-10-27 02:39:19 UTC
I Installed freebsd 12.2-RC3 in vmware16 with UEFI. After Installed, it also not boot with the following error message: "The firmware encountered an unexpected exception. The virtual machine cannot boot."
Comment 7 Roger Leigh 2020-10-31 15:22:28 UTC
Created attachment 219242 [details]
Screenshot of failure

VMware 15 on AMD Ryzen 2700X.
Comment 8 Roger Leigh 2020-10-31 15:23:52 UTC
See attached screenshot.

See https://forums.freebsd.org/threads/cant-boot-on-uefi.68141/ for a 2018 report of the issue, though the discussion is looking at irrelevant details which aren't actually the root cause.

See also https://communities.vmware.com/thread/643481 (they think it's most likely a FreeBSD bug, but there's a small possibility it's a vmware issue).  I've attached detailed logs from the vmware side there which include all of the hardware details.

Also on pfSense: https://redmine.pfsense.org/issues/10943

FreeBSD 12.2: installer booted; it's on boot of the new install the failure occurs.

FreeBSD CURRENT: installer will not boot.
Comment 9 Hongbo He 2020-11-04 02:04:01 UTC
If I hit ESC and entering the EFI shell of VMware's UEFI firmware before booting FreeBSD then it will boot successfully. Hope this helps.

see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250580#c5
Comment 10 Hongbo He 2020-11-04 02:17:40 UTC
See also https://communities.vmware.com/message/2994826 (Discussion on VMware forum)
Comment 11 Yuri Pankov 2020-11-21 08:25:30 UTC
(In reply to Hongbo He from comment #9)
It doesn't, that looks like completely different issue.

Still the same issue with VMware Workstation 16.{0,1} now and FreeBSD-13.0-CURRENT-amd64-20201119-f2ea0734875-disc1.iso .
Comment 12 Graham Perrin freebsd_committer freebsd_triage 2020-12-04 08:38:27 UTC
Cross reference https://old.reddit.com/r/freebsd/comments/ir90ra/hp_probook_440_g7/gejo49g/ – apparently a hardware instance of the bug. 

HP ProBook 440 G7.
Comment 13 Graham Perrin freebsd_committer freebsd_triage 2020-12-12 03:20:00 UTC
(In reply to Roger Leigh from comment #7)

Also: 

HP Elitebook 830 G7
<https://lists.freebsd.org/pipermail/freebsd-current/2020-December/077823.html>
Comment 14 Yuri Pankov freebsd_committer freebsd_triage 2020-12-17 17:47:37 UTC

*** This bug has been marked as a duplicate of bug 251918 ***
Comment 15 Yuri Pankov freebsd_committer freebsd_triage 2020-12-17 17:48:12 UTC

*** This bug has been marked as a duplicate of bug 251866 ***
Comment 16 Yuri Pankov freebsd_committer freebsd_triage 2020-12-17 17:48:51 UTC
(In reply to Yuri Pankov from comment #14)
sorry, bad copy/paste :(
Comment 17 lily coliins 2022-08-24 15:11:05 UTC
MARKED AS SPAM