Bug 1030612 - rhts_post snippet doesn't preserve full existing EFI boot order
rhts_post snippet doesn't preserve full existing EFI boot order
Product: Beaker
Classification: Community
Component: scheduler (Show other bugs)
All Linux
medium Severity high (vote)
: 0.14.4
: ---
Assigned To: Dan Callaghan
: Reopened
Depends On: 889509
  Show dependency treegraph
Reported: 2013-11-14 14:38 EST by Bill Peck
Modified: 2013-12-19 00:09 EST (History)
24 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 889509
Last Closed: 2013-12-19 00:09:24 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Comment 2 Nick Coghlan 2013-11-15 02:58:17 EST
The Beaker rhts_post snippet aims to ensure systems are always reverted to using network boot by default (allowing Beaker to reprovision them), without altering which mechanism will be used for the *next* boot operation. Currently, this relies on the command:

  BOOT=$(/usr/sbin/efibootmgr -v | grep BootOrder | awk '{print $2}' | awk -F, '{print $1}')

This only reports the *first* element in the boot order, rather than the entire current boot order.

Unfortunately, this causes problems with some UEFI firmware that will *add* boot entries for all possibilities not listed in the boot order, even if such entries already exist. If such systems are reprovisioned many times, then the number of duplicated boot entries may grow to the point where the system's firmware can no longer handle it.

While that's a firmware bug, it's prevalence (and the fact that efibootmgr doesn't include an implicit workaround) means that Beaker *must* ensure the entire boot order is preserved - it can't rely on the firmware and/or efibootmgr filling in the missing entries. That means the extraction of the next boot setting and the extraction of the current boot order need to be separated in the rhts_post snippet:

# If efibootmgr exists then re-order boot options
if [ -x '/usr/sbin/efibootmgr' ]; then
    BOOT=$(/usr/sbin/efibootmgr -v | grep BootOrder | awk '{print $2}')
    PXE_SLOT=$(/usr/sbin/efibootmgr -v | grep -i BootCurrent | awk '{print $2}')
    # This will put the boot order back to what it was before the install.
    # When first setting up a system make sure you put the netboot entry first.
    if [ ! -z $PXE_SLOT ]; then
       # Remove PXE entry from the boot order and add it to the front
       NEWBOOT=$(echo $BOOT| sed -e 's/$PXE_SLOT,//')
       NEWBOOT=$(echo $NEWBOOT| sed -e 's/,$PXE_SLOT,//')
       NEWBOOT=$(echo $NEWBOOT| sed -e 's/,$PXE_SLOT//')
       /usr/sbin/efibootmgr -o $PXE_SLOT,$NEWBOOT
       # Ensure next boot still uses previous head of the boot order
       NEXTBOOT=$(awk -F, '{print $1}' $BOOT)
       /usr/sbin/efibootmgr -n $NEXTBOOT
Comment 4 Dan Callaghan 2013-11-21 00:42:18 EST
This will be fixed with the patch for bug 1031876.


Note You need to log in before you can comment on or make changes to this bug.