opencomputeproject / onie

Open Network Install Environment
https://opencomputeproject.github.io/onie
Other
606 stars 376 forks source link

(Grub-2.04) grub-install: error: GRUB was not built with efivar support; cannot register EFI boot entry. #994

Open jaytclin opened 2 years ago

jaytclin commented 2 years ago

Hello everyone,

We're using 2022.02 tag ONIE with grub-2.04 and saw this issue at the end of NOS installation. Please check below log.

======================================================================== ... (Skipped) Support tarball created:/mnt/ubuntu/ufispace/install/onie-support-ufispace_icelake_common.tar.bz2 INFO:Update ONIE grub configuration.. 329.010661]ext4 filesystem being mounted at /tmp/tmp.DqqOHK supports timestamps until 2038 (0x7fffffff) INFO: Previous boot Order: 0000,0002,0006,0003,0004,0005

INFO: Regular GRUB install.. Installing for x86 64-efi platform. grub-install: error: GRUB was not built with efivar support; cannot register EFI boot entry. ERROR: grub-install failed on:/dev/sda

INFO: Current boot Order: 0000,0002,0006,0003,0004,0005 ONIE: Rebooting...

========================================================================

After tracing the install.sh of demo_install_uefi_grub, we found the difference was that the demo code used "--no-nvram" parameter and used efibootmgr tool to configure the boot option/order, while some NOS did not have "--no-nvram" and thus grub-install(in grub-2.04) would need efivar support for boot option/order manipulation. https://github.com/opencomputeproject/onie/blob/2022.02/demo/installer/grub-arch/install.sh#L293

The above log showed the error and the installer failed to set boot order using grub-install, so after installation the BIOS booted to ONIE again with boot order unchanged. So my question is, do we have to build the Grub with efivar supported to cover different NOS's installation behavior? If so, how do we do it? We had "UEFI_ENABLE = yes" configured in the machine.make but it seemed not to work for building grub with efivar support. Please kindly help on this issue, thanks.

Jay

ehdoyle commented 2 years ago

Hi - thanks for the use of output and contextual details in filing this. My first question is: am I correctly understanding your question:

jaytclin commented 2 years ago

Hi @ehdoyle , Thanks for your prompt response! Yes I think you correctly understood my questions according to your description. I'm not sure why and whether different NOS vendors use grub-install with or without "--no-nvram", but you're right, ONIE grub may need to be built with efivar support (specifying --no-nvram shouldn't be a must). As we can see from below patch description, by doing this, there're some benefit we can get. https://github.com/opencomputeproject/onie/blob/master/patches/grub/2.04/efi-variable-storage-minimise-writes.patch

For now, we'll check with our vendor if they can modify the install.sh based on demo OS's, and see how we can build ONIE grub with efivar and efiboot libraries. Please also update if you have the answer.

Thanks again for your help. Jay