anaconda: workaround efibootmgr bug (SIGABRT while removing entries)
This commit is contained in:
parent
447ba8ab42
commit
bdba0f99d0
@ -1641,12 +1641,22 @@ class EFIGRUB(GRUB2):
|
|||||||
|
|
||||||
def remove_efi_boot_target(self):
|
def remove_efi_boot_target(self):
|
||||||
buf = self.efibootmgr(capture=True)
|
buf = self.efibootmgr(capture=True)
|
||||||
|
bootorder = None
|
||||||
for line in buf.splitlines():
|
for line in buf.splitlines():
|
||||||
try:
|
try:
|
||||||
(slot, _product) = line.split(None, 1)
|
(slot, _product) = line.split(None, 1)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Workaround for bug in efibootmgr that causes abort() when
|
||||||
|
# removing an entry not present in BootOrder.
|
||||||
|
# This is already fixed in efibootmgr-0.12, so can be removed when
|
||||||
|
# we upgrade it one day
|
||||||
|
# The fix (with bug details):
|
||||||
|
# https://github.com/rhinstaller/efibootmgr/commit/f575bf87
|
||||||
|
if slot == "BootOrder:":
|
||||||
|
bootorder = _product
|
||||||
|
|
||||||
if _product == productName:
|
if _product == productName:
|
||||||
slot_id = slot[4:8]
|
slot_id = slot[4:8]
|
||||||
# slot_id is hex, we can't use .isint and use this regex:
|
# slot_id is hex, we can't use .isint and use this regex:
|
||||||
@ -1654,6 +1664,11 @@ class EFIGRUB(GRUB2):
|
|||||||
log.warning("failed to parse efi boot slot (%s)", slot)
|
log.warning("failed to parse efi boot slot (%s)", slot)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if bootorder.count(slot_id) == 0:
|
||||||
|
rc = self.efibootmgr("-o", bootorder + "," + slot_id)
|
||||||
|
if rc:
|
||||||
|
raise BootLoaderError("failed to update BootOrder while removing old boot entry")
|
||||||
|
|
||||||
rc = self.efibootmgr("-b", slot_id, "-B",
|
rc = self.efibootmgr("-b", slot_id, "-B",
|
||||||
root=ROOT_PATH)
|
root=ROOT_PATH)
|
||||||
if rc:
|
if rc:
|
||||||
|
Loading…
Reference in New Issue
Block a user