Skip to contentSkip to conversation

fix grub-install efibootmgr presence test with --removable

PATCH In review Leif Lindholm 3 participants 7 messages May 9, 2013 – May 11, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix grub-install efibootmgr presence test with --removable

When executed for an EFI target, grub-install checks for the path of efibootmgr - however, this utility is not required (or used) when installing to a removable media (with --removable).

However, since grub-install does "set -e", the absence of efibootmgr on the system causes the install script to exit with an error code, without any message, after a successful installation.

(Found because I'm doing EFI builds on my chromebook.)

Trivial patch attached.

/
Leif

=== modified file 'util/grub-install.in'

grub-install.in +1 -1
@@ -754,7 +754,7 @@
     fi
 
     # Try to make this image bootable using the EFI Boot Manager, if available.
-    efibootmgr="`which efibootmgr`"
+    efibootmgr="`which efibootmgr`" || true
     if test "$removable" = no && test -n "$efi_distributor" && \
 	test -n "$efibootmgr"; then
         # On Linux, we need the efivars kernel modules.
#1 lore raw

В Thu, 9 May 2013 10:44:35 +0000
Leif Lindholm <[email protected]> пишет:

Quoted 8 lines

When executed for an EFI target, grub-install checks for the path of efibootmgr - however, this utility is not required (or used) when installing to a removable media (with --removable).

However, since grub-install does "set -e", the absence of efibootmgr on the system causes the install script to exit with an error code, without any message, after a successful installation.

Yes, was hit by this as well. Makes sense really.

Quoted 6 lines

(Found because I'm doing EFI builds on my chromebook.)

Trivial patch attached.

/
Leif

#2 lore raw
In reply to Leif Lindholm
Quoted 4 lines · Leif Lindholm

When executed for an EFI target, grub-install checks for the path of efibootmgr - however, this utility is not required (or used) when installing to a removable media (with --removable).

This patch would simply ignore the problem. I comitted another fix which is cleaner.

Quoted 17 lines

However, since grub-install does "set -e", the absence of efibootmgr on the system causes the install script to exit with an error code, without any message, after a successful installation.

(Found because I'm doing EFI builds on my chromebook.)

Trivial patch attached.

/
Leif

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#3 lore raw
Quoted 7 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 4 lines

When executed for an EFI target, grub-install checks for the path of efibootmgr - however, this utility is not required (or used) when installing to a removable media (with --removable).

This patch would simply ignore the problem. I comitted another fix which is cleaner.

It wouldn't ignore the problem, since the test following explicitly checked whether $efibootmgr is nonzero length.

But I agree your fix is cleaner.

/
Leif

#4 lore raw
In reply to Vladimir 'φ-coder/phcoder' Serbinenko

В Fri, 10 May 2013 16:57:38 +0200
Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]> пишет:

Quoted 10 lines · Leif Lindholm
Quoted 5 lines

When executed for an EFI target, grub-install checks for the path of efibootmgr - however, this utility is not required (or used) when installing to a removable media (with --removable).

This patch would simply ignore the problem. I comitted another fix which is cleaner.

Note that "which command" already prints error message when command was not found, so additional error output is strictly speaking redundant.

#5 lore raw
Quoted 10 lines · Andrey Borzenkov

В Fri, 10 May 2013 16:57:38 +0200
Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]> пишет:

Quoted 7 lines · Leif Lindholm
Quoted 5 lines

When executed for an EFI target, grub-install checks for the path of efibootmgr - however, this utility is not required (or used) when installing to a removable media (with --removable).

Quoted 7 lines
Quoted 3 lines

This patch would simply ignore the problem. I comitted another fix which is cleaner.

Note that "which command" already prints error message when command was not found, so additional error output is strictly speaking redundant.

It doesn't.

[email protected]:08:48:40:~$ which ttt
[email protected]:08:48:41:~$
Quoted 6 lines

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#6 lore raw

В Sat, 11 May 2013 08:49:00 +0200
Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]> пишет:

Quoted 16 lines · Andrey Borzenkov
Quoted 15 lines

В Fri, 10 May 2013 16:57:38 +0200
Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]> пишет:

Quoted 10 lines · Leif Lindholm
Quoted 5 lines

When executed for an EFI target, grub-install checks for the path of efibootmgr - however, this utility is not required (or used) when installing to a removable media (with --removable).

This patch would simply ignore the problem. I comitted another fix which is cleaner.

Quoted 8 lines
Quoted 3 lines

Note that "which command" already prints error message when command was not found, so additional error output is strictly speaking redundant.

It doesn't.

[email protected]:08:48:40:~$ which ttt
[email protected]:08:48:41:~$

This is probably system dependent

bor@opensuse:~> which xxx
which: no xxx in (/home/bor/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games)

I guess in this case it is better to redirect stderr to /dev/null