EFI support: fix for grub-install usage with efivarfs
authorMichael Prokop <mika@grml.org>
Mon, 16 Aug 2021 19:19:20 +0000 (21:19 +0200)
committerMichael Prokop <mika@grml.org>
Mon, 23 Aug 2021 14:14:41 +0000 (16:14 +0200)
commit1ca3ec59aeb6d70c7621bebe7ba2bf2fd38bbbf1
tree813961cf305f50091d565677194f3b88df3f42e1
parent86f83aa4b5047fafa74ef003d2da70bf1eeb50a7
EFI support: fix for grub-install usage with efivarfs

We had to apply fixes due to efivars vs efivarfs in Debian kernel
versions >=5.10, and addressed them in commit d91d9f3ef.

Those changes were incomplete though: while efibootmgr was invoked in
the according and expected environment, invocation of grub-install
doesn't reliably work (as at that time /sys/firmware/efi/efivars is no
longer accessible).

GRUB installation on EFI systems without /sys/firmware/efi/efivars
present warns with (also see https://sources.debian.org/src/grub2/2.04-20/debian/patches/efi-variable-storage-minimise-writes.patch/?hl=650#L650):

| EFI variables are not supported on this system

But it returns with exit code 0. This leaves us with an incomplete and
therefore not booting GRUB EFI environment. Fix it by unmounting
/sys/firmware/efi/efivars only from within our final stage.
chroot-script