After a recent creation of a virtual machine using a Debian 9.5 netinstall image on the Bhyve type-2 hypervisor provided by FreeNAS 11, I kept on hitting a re-occurring error: “Boot Failed. EFI Misc Device”. After much troubleshooting, the resolution is straight forward.
During the Debian install and the UEFI implementation of Bhyve causes an error because it cannot find the correct .efi file to load.
In the EFI partition, Debian installs the following:
└── EFI
├── debian
│ └── grubx64.efi
Bhyve expects the default boot .efi file as (as the UEFI standard depicts)
└── EFI
├── BOOT
│ └── bootx64.efi
In theory, the UEFI implementation should scan sub-folders and look for .efi files to add to the boot menu but the current implementation does not do that.
You will need to boot into the UEFI shell and copy debian/grubx64.efi to BOOT/bootx64.efi.
Note, after each update of grub within Debian, you will need to update the boot file. You can do so by (prior to reboot after the grub package has been updated):
sudo cp /boot/efi/EFI/debian/grubx64.efi /boot/efi/EFI/BOOT/bootx64.efi
An alternative is to run
dpkg-reconfigure grub-efi-amd64
and set it to force installation into the EFI removable path. If you do this, future upgrades will keep this updated.