[pve-devel] [RFC installer 1/7] only require grub-efi to succeed if booted using UEFI

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Mar 7 16:02:58 CET 2017


newer grub versions treat not being able to register with
efibootmgr as error and exit accordingly. since registering
is not possible when booted using legacy BIOS, but we want
to install Grub for UEFI anyway, downgrade the 'die' to a
'warn' in such situations.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 proxinstall | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/proxinstall b/proxinstall
index 18df7bb..8d8d263 100755
--- a/proxinstall
+++ b/proxinstall
@@ -1440,8 +1440,14 @@ _EOD
 		if ($di->{esp}) {
 		    syscmd ("mount -n $di->{esp} $targetdir/boot/efi") == 0 ||
 			die "unable to mount $di->{esp}\n";
-		    syscmd ("chroot $targetdir /usr/sbin/grub-install --target x86_64-efi --no-floppy --bootloader-id='proxmox' $dev") == 0 ||
-			die "unable to install the EFI boot loader on '$dev'\n";
+		    my $rc = syscmd ("chroot $targetdir /usr/sbin/grub-install --target x86_64-efi --no-floppy --bootloader-id='proxmox' $dev");
+		    if ($rc != 0) {
+			if (-d '/sys/firmware/efi') {
+			    die "unable to install the EFI boot loader on '$dev'\n";
+			} else {
+			    warn "unable to install the EFI boot loader on '$dev', ignoring (not booted using UEFI)\n";
+			}
+		    }
 		    # also install fallback boot file (OVMF does not boot without)
 		    mkdir("$targetdir/boot/efi/EFI/BOOT");
 		    syscmd("cp $targetdir/boot/efi/EFI/proxmox/grubx64.efi $targetdir/boot/efi/EFI/BOOT/BOOTx64.EFI") == 0 ||
-- 
2.1.4





More information about the pve-devel mailing list