From: Michael Prokop Date: Fri, 2 Oct 2020 08:51:51 +0000 (+0200) Subject: Improve EFI detection by checking for /sys/firmware/efi X-Git-Tag: v0.94~4 X-Git-Url: http://git.grml.org/?p=grml-debootstrap.git;a=commitdiff_plain;h=622ca58e0d5585069b51ecbb60d0a36eede4d53a Improve EFI detection by checking for /sys/firmware/efi It might be possible that we can load the efivars module, while /sys/firmware/efi still doesn't exist and efibootmgr then fails to execute. We noticed this on Hetzner's Dell PowerEdgeâ„¢ R6515 DX181 server, which was booted in BIOS mode via PXE, while the hardware itself is EFI capable. Loading the efivars module worked there, but invoking efibootmgr then fails, and the resulting system isn't bootable. Thanks: Darshaka Pathirana for reporting and feedback --- diff --git a/grml-debootstrap b/grml-debootstrap index 52adf78..ae601f8 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -987,14 +987,18 @@ format_efi_partition() { # check for EFI support or try to enable it {{{ efi_support() { - if lsmod | grep -q efivars ; then + local efivars_loaded=false + if modprobe efivars &>/dev/null ; then + efivars_loaded=true + fi + + if [ -d /sys/firmware/efi ] ; then einfo "EFI support detected." ; eend 0 return 0 fi - if modprobe efivars &>/dev/null ; then - einfo "EFI support enabled now." ; eend 0 - return 0 + if ! [ -d /sys/firmware/efi ] && [ "${efivars_loaded:-}" = "true" ] ; then + einfo "EFI support detected, but system seems to be running in BIOS mode." fi return 1