Skip to content

Commit

Permalink
CA-375063: Mount efivarfs when calling efibootmgr
Browse files Browse the repository at this point in the history
If CONFIG_EFI_VARS is enabled, efibootmgr is able to use that deprecated
interface when inside a chroot. With newer kernels where that interface
is removed completely [1], it requires bind mounting efivarfs at the
correct path so that efibootmgr works inside a chroot.

[1] 0f5b2c69a4cb - efi: vars: Remove deprecated 'efivars' sysfs interface

Signed-off-by: Ross Lagerwall <[email protected]>
  • Loading branch information
rosslagerwall committed Feb 13, 2023
1 parent 4d465b1 commit cc21554
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,8 @@ def installBootLoader(mounts, disk, boot_partnum, primary_partnum, target_boot_m
# prepare extra mounts for installing bootloader:
util.bindMount("/dev", "%s/dev" % mounts['root'])
util.bindMount("/sys", "%s/sys" % mounts['root'])
if target_boot_mode == TARGET_BOOT_MODE_UEFI:
util.bindMount("/sys/firmware/efi/efivars", "%s/sys/firmware/efi/efivars" % mounts['root'])
util.bindMount("/proc", "%s/proc" % mounts['root'])

try:
Expand Down Expand Up @@ -1138,6 +1140,8 @@ def installBootLoader(mounts, disk, boot_partnum, primary_partnum, target_boot_m
finally:
# done installing - undo our extra mounts:
util.umount("%s/proc" % mounts['root'])
if target_boot_mode == TARGET_BOOT_MODE_UEFI:
util.umount("%s/sys/firmware/efi/efivars" % mounts['root'])
util.umount("%s/sys" % mounts['root'])
util.umount("%s/dev" % mounts['root'])

Expand Down

0 comments on commit cc21554

Please sign in to comment.