From 622ca58e0d5585069b51ecbb60d0a36eede4d53a Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 2 Oct 2020 10:51:51 +0200 Subject: [PATCH] Improve EFI detection by checking for /sys/firmware/efi MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- grml-debootstrap | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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 -- 2.1.4