RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1450846 - autorelabel should set UEFI BootNext same as BootCurrent before rebooting
Summary: autorelabel should set UEFI BootNext same as BootCurrent before rebooting
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: initscripts
Version: 7.4
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: David Kaspar // Dee'Kej
QA Contact: Daniel Rusek
Sharon Moroney
URL:
Whiteboard:
Depends On:
Blocks: 1392968 1465901 1549689
TreeView+ depends on / blocked
 
Reported: 2017-05-15 09:40 UTC by Pavel Holica
Modified: 2021-02-12 10:36 UTC (History)
3 users (show)

Fixed In Version: initscripts-9.49.42-1.el7
Doc Type: Release Note
Doc Text:
The `rhel-autorelabel` service now acknowledges the `BootNext` setting of `efibootmgr` Previously, when `BootNext` was set using `efibootmgr`, the boot process did not work as expected in case it was interrupted by the `rhel-autorelabel` service. This update resolves the problem.
Clone Of:
Environment:
Last Closed: 2018-10-30 10:15:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3131 0 None None None 2018-10-30 10:17:17 UTC

Description Pavel Holica 2017-05-15 09:40:59 UTC
Description of problem:
In our beaker environment, UEFI systems depend on specific boot order where boot to system is typically at the end of the boot order (ensuring, that netboot has higher priority; sometimes after UEFI shell). For this purpose, "efibootmgr -n" is widely used to ensure that the system is correctly booted after reboot. /lib/systemd/rhel-autorelabel contains "systemctl --force reboot" but doesn't care about current boot and next boot. It should set nextboot to the same value as the current boot.

Version-Release number of selected component (if applicable):
initscripts-9.49.39-1.el7
RHEL-7.4-20170504.0 aarch64 Server

How reproducible:
always

Steps to Reproduce:
1. Put OS boot entry in boot order after UEFI shell (using efibootmgr -o)
2. Set OS boot entry as BootNext (using efibootmgr -n)
3. touch /.autorelabel
4. reboot

Actual results:
System starts relabeling filesystems and reboots once finished.
UEFI shell is started.

Expected results:
System starts relabeling filesystems and reboots once finished.
RHEL is started.

Additional info:
The issue is not only with UEFI shell, but with any boot entry that is before RHEL.

Comment 1 Pavel Holica 2017-05-15 11:23:58 UTC
Something like this should work:

if efibootmgr &>/dev/null; then
    CURRENT_BOOT=$(efibootmgr | awk -F": " '$1 == "BootCurrent" {print $2}')
    efibootmgr -n $CURRENT_BOOT
fi

Comment 2 David Kaspar // Dee'Kej 2017-05-15 12:49:47 UTC
Thank you for the report, Pavel.

This, however, will not make it into RHEL-7.4. I'm proposing this for RHEL-7.5.

Comment 5 David Kaspar // Dee'Kej 2018-05-14 12:57:27 UTC
Pavel, could you please check this is OK? Thanks!

https://github.com/fedora-sysv/initscripts/pull/195

Comment 7 Pavel Holica 2018-05-15 07:15:44 UTC
(In reply to David Kaspar [Dee'Kej] from comment #5)
> Pavel, could you please check this is OK? Thanks!
> 
> https://github.com/fedora-sysv/initscripts/pull/195

Following expression is always true:
[ -x /usr/sbin/efibootmgr ]
Instead, you should run the efibootmgr which fails on non UEFI systems, but has RC 0 on UEFI systems.

$ efibootmgr | grep -e 'BootCurrent' | sed -re 's/(^.+:[[:space:]]*)([[:xdigit:]]+)/\3/'
sed: -e expression #1, char 39: invalid reference \3 on `s' command's RHS


But \2 should work correctly :)
$ efibootmgr | grep -e 'BootCurrent' | sed -re 's/(^.+:[[:space:]]*)([[:xdigit:]]+)/\2/'
0016

Comment 8 David Kaspar // Dee'Kej 2018-05-16 15:51:03 UTC
I have updated the commit in the pull-request based on our today's discussion, so the BootNext is updated unless it is already set.

Comment 9 David Kaspar // Dee'Kej 2018-05-16 15:59:07 UTC
https://src.fedoraproject.org/rpms/policycoreutils/pull-request/5

Comment 16 errata-xmlrpc 2018-10-30 10:15:57 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3131


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