RHEL7: leapp upgrade crashes during reboot phase with "Failed to retrieve kernel command line to save for future installed kernels"

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 7
    • leapp

Issue

  • After leapp upgraded the system for real (reboot phase), the emergency prompt is shown and the following error can be seen on the console

    [...]
    [...] upgrade[17860]: ====> * kernelcmdlineconfig
    [...] upgrade[17860]:         Append extra arguments to the target RHEL kernel command line
    [...] upgrade[20186]: ... ERROR    PID: 2328 leapp.workflow.Finalization.kernelcmdlineconfig: Failed to retrieve kernel command line to save for future installed kernels: root=None, args=$kernelopts $tuned_params ...
    [...] upgrade[20186]: Process Process-299:
    [...] upgrade[20186]: Traceback (most recent call last):
    [...]
    
  • After rebooting, the RHEL7 kernel is started (there is no RHEL8 kernel entry in the Grub menu) and the system is upgraded to RHEL8

Resolution

Follow the procedure described in the Diagnostic Steps section.
If this is a match, proceed further, otherwise or if in doubt, open a case on the Customer Portal referencing this solution and provide a sosreport along with /var/log/leapp/leapp-upgrade.log file for review.

Solution: rebuild the Grub menu then reboot

# grub2-mkconfig -o /etc/grub2$(test -e /sys/firmware/efi && echo "-efi").cfg
# reboot

If you are reading this document and didn't upgrade yet

Make sure to delete GRUB_ENABLE_BLSCFG=xxx stanza from /etc/default/grub prior to rebooting the system to upgrade it for real.

Root Cause

When GRUB_ENABLE_BLSCFG=xxx stanza is already present in /etc/default/grub prior to the upgrade to RHEL8, some special code doesn't execute when upgrading the kernel during the reboot phase, which leads to not being able for grubby to retrieve the kernel command line.

Having GRUB_ENABLE_BLSCFG=xxx stanza in /etc/default/grub on a RHEL7 system is considered as a configuration issue, the stanza should NOT be present.

Diagnostic Steps

  1. Confirm that the BLS entry contains $kernelopts

    # grep ^options /boot/loader/entries/*-4.18.0*.conf
    options $kernelopts $tuned_params ...
    
  2. If you have a sosreport of the system prior to upgrading, confirm that GRUB_ENABLE_BLSCFG was present in /etc/default/grub

    $ cd path/to/sosreport
    $ grep ^GRUB_ENABLE_BLSCFG etc/default/grub
    GRUB_ENABLE_BLSCFG=true
    
SBR
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.