vm-bhyve icon indicating copy to clipboard operation
vm-bhyve copied to clipboard

Not able to boot Debian (UEFI)

Open solskogen opened this issue 5 years ago • 13 comments

I was able to install it, and the first reboot went well (still running under "vm install ...") But as soon as I try to start it "vm start..." it's not able to boot with UEFI.

This is my config: loader=uefi cpu=8 memory=2G wired_memory="yes" network0_type="virtio-net" network0_switch="public" disk0_type="ahci-hd" disk0_name="disk0.img" graphics="yes" xhci_mouse="yes" graphics_res="1024x768" graphics_wait="yes" uuid="4440a308-0f66-11ea-99b9-6045cb9a0b3b" network0_mac="58:9c:fc:02:b6:8c"

solskogen avatar Nov 25 '19 09:11 solskogen

"BOOT FAILED. EFI Hard drive"

solskogen avatar Nov 25 '19 09:11 solskogen

Debian's EFI filename doesn't match what bhyve UEFI expects. The workaround is to rename the file. See https://blog.tkrn.io/freenas-11-boot-failed-efi-misc-device-fix-debian/

thebiss avatar Dec 15 '19 01:12 thebiss

This sounds like it's related to efi variables. Many Linux distributions don't use the default filename for the EFI filename (for perfectly good reasons), and use EFI variables to store the correct path. Unfortunately bhyve loses this on restart as it doesn't store the efivars anywhere.

Hopefully bhyve will fix this some day. It's been known for at least 18 months.

Peter Grehan - May 04, 2018 That is exactly the issue. The current UEFI code does not save non-volatile variables to persistent storage. Guest o/s's are increasingly writing their efi loaders to non-standard locations and using nv vars to direct UEFI to boot from these locations.

I'm (very slowly) merging a fix from Leon for this in both UEFI and bhyve which directs nv var writes to a file on the host, providing a persistent store.

churchers avatar Jan 13 '20 15:01 churchers

Issue still persists ...

dMopp avatar Apr 10 '21 09:04 dMopp

Type this in a shell when install is finished and before rebooting. I installed debian bullseye with gnome. Runs great.

mkdir /target/boot/efi/EFI/BOOT/ cp /target/boot/efi/EFI/debian/grubx64.efi /target/boot/efi/EFI/BOOT/bootx64.efi

got it from a howto link below https://www.cyberciti.biz/faq/how-to-install-linux-vm-on-freebsd-using-bhyve-and-zfs/

copy of my .conf file loader="uefi" cpu=8 memory=16G network0_type="virtio-net" network0_switch="public" disk0_type="virtio-blk" disk0_name="disk0.img" graphics="yes" graphics_port="5999" graphics_res="1920x1200" graphics_wait="auto" xhci_mouse="yes" uuid="f227071d-69e4-11ec-90ec-e0d55e690dc6" network0_mac="58:9c:fc:02:e3:88"

bluntstone avatar Dec 31 '21 23:12 bluntstone

Fixed in https://github.com/churchers/vm-bhyve/issues/449 with FreeBSD 14

driesmp avatar Oct 26 '23 14:10 driesmp

Fixed in #449 with FreeBSD 14

Does this mean no additional config required in vm-bhyve to make Debian work?

jhfoo avatar Dec 20 '23 20:12 jhfoo

You only need "uefi_vars=yes" in the config file of the vm.

driesmp avatar Dec 20 '23 21:12 driesmp

Anyone getting debian booting with "uefi_vars"?

nunotexbsd avatar Feb 10 '24 13:02 nunotexbsd

Yes, do you have 14 release or higher?

driesmp avatar Feb 10 '24 14:02 driesmp

Got it.

(FreeBSD 15 4594eb454891 / Debian 12.4.0 amd64)

Followed instructions https://npulse.net/en/blog/125-bhyve-uefi-drops-into-efi-shell-linux-wont-boot-easy-workaround

  • Enter Boot Maintenance Manager / Boot From File, using EFI/debian/grubx64.efi
  • Permanent solution:
mkdir /boot/efi/EFI/BOOT
cp /boot/efi/EFI/debian/grubx64.efi /boot/efi/EFI/BOOT/bootx64.efi

Maybe uefi_vars don't fix it right?

nunotexbsd avatar Feb 10 '24 14:02 nunotexbsd

uefi_vars works fine. If you can boot your os from the eufi bootmenu then uefi_vars"yes" should just work. But you do need to adjust the UEFI boot settings. Just choosing the right EFI file and booting it won't fix anything.

You need to add the boot option, then the boot order and then you save those settings. Like in a regular bios. uefi_vars="yes" just makes sure those settings are actually saved for the next reboot. If you don't have that then the settings are not saved.

If it doesn't work: FreeBSD 15 is beta software. It's not production ready. ;-)
Honestly though. It probably should work if you just really change the settings.

xzenor avatar Feb 10 '24 17:02 xzenor

@xzenor

I misunderstood uefi_vars at first. It's working fine as I created a new boot option pointing to grubx64.efi and save. I removed BOOT/bootx64.efi as I don't need it anymore.

Thanks!

nunotexbsd avatar Feb 11 '24 02:02 nunotexbsd