Updating the kernel of systems upgraded by Leapp doesn't generate the initramfs

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 8
    • leapp
    • grub2
    • kernel updates

Issue

  • On a system that was upgraded from RHEL7 to RHEL8 using leapp, kernel updates do not generate the corresponding initramfs in /boot

    # yum install kernel-4.18.0-240.15.1.el8_3
    [...]
    
    # ls -l /boot/initramfs-4.18.0-240.15.1.el8_3*
    ls: cannot access '/boot/initramfs-4.18.0-240.15.1.el8_3*': No such file or directory
    

Resolution

Follow the procedure described in the Diagnostic Steps section. If this is a match, proceed further.

  1. Remove the kernel-workaround package

    # yum -y remove kernel-workaround
    
  2. (Optional but recommended) Add GRUB_ENABLE_BLSCFG=true to /etc/default/grub

    echo "GRUB_ENABLE_BLSCFG=true" >> /etc/default/grub
    
  3. Reinstall the kernel-core package that failed to install properly

    # yum -y reinstall kernel-core-4.18.0-240.15.1.el8_3
    
  4. Verify that the initramfs now exists in /boot

    # ls -l /boot/initramfs-4.18.0-240.15.1.el8_3*
    -rw-------. 1 root root 26088063 Apr 29 15:27 /boot/initramfs-4.18.0-240.15.1.el8_3.x86_64.img
    

Root Cause

The issue happens when both conditions are met:

  1. GRUB_ENABLE_BLSCFG=true is not specified in /etc/default/grub
  2. system has been upgraded using leapp, resulting in having the kernel-workaround package installed

Under these conditions, the standard code used to create the initramfs doesn't execute because /usr/lib/kernel/install.d/20-grub.install executes /sbin/new-kernel-pkg script shipped by kernel-workaround package, which is a stub that does nothing at all.

The issue is tracked by This content is not included.BZ 1955099 - Updating the kernel on leapp'ed systems doesn't create the initramfs depending on Grub BLS state.

Diagnostic Steps

  1. Verify that the system was upgraded using leapp, this can be seen by checking for the presence of kernel-workaround package

    # rpm -qa kernel-workaround
    kernel-workaround-0.1-1.el8.noarch
    
  2. Verify that GRUB_ENABLE_BLSCFG isn't set to true or doesn't exist at all in /etc/default/grub

    # grep ^GRUB_ENABLE_BLSCFG /etc/default/grub
    --> nothing at all
    

    Note: by default GRUB_ENABLE_BLSCFG=true should be set, this is done by leapp itself.
    If it's not there, this means that the system must be updated using an automation tool relying on old templates for RHEL7 which need to be updated for RHEL8. Please consider updating the templates consequently.

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.