[grub2] System with ext4 /boot cannot boot due to a loop between the BIOS and the kernel, OR due to a kernel panic
Environment
- Red Hat Enterprise Linux 8.10
grub2(versions 2.0.2-162 and 2.0.2-164)
Issue
- The system cannot boot, due to a loop between the BIOS and the kernel
- The system cannot boot, due to a kernel panic:
Initramfs unpacking failed
Resolution
The issue has been fixed by the following errata:
https://access.redhat.com/errata/RHBA-2025:4024.
After updating the grub2* packages, you need to reinstall the bootloader:
Legacy:
# grub2-install <BOOTDEVICE>
Example: if your /boot resides on the /dev/sda2 partition, your <BOOTDEVICE> is /dev/sda.
NOTE: ensure you have a backup before performing this operation.
UEFI:
# yum reinstall grub2 grub2-efi-x64 shim-x64
# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
Root Cause
The issue happens with a fragmented kernel or initramfs (> 2 extents, see filefrag) on an ext4 /boot.
The offending commit was:
From: Michael Chang <mchang@suse.com>
Date: Fri, 31 May 2024 15:14:23 +0800
Subject: [PATCH] fs/ext2: Fix out-of-bounds read for inline extents
When inline extents are used, i.e. the extent tree depth equals zero,
a maximum of four entries can fit into the inode's data block. If the
extent header states a number of entries greater than four the current
ext2 implementation causes an out-of-bounds read. Fix this issue by
capping the number of extents to four when reading inline extents.
Applied to our source RPM by 0605-fs-ext2-Fix-out-of-bounds-read-for-inline-extents.patch on grub2 2.02-162 to 2.02-164.
This issue was tracked by the following Jira: https://issues.redhat.com/browse/RHEL-86553
Diagnostic Steps
To check whether your system is impacted, you can identify the binaries deployed on your system.
-
BIOS mode
# sha256sum /boot/grub2/i386-pc/ext2.mod c458a62a5de05a930e07259550639c58408bab18be504cec2d326d4e32ca09f5 -
EFI mode
# /boot/efi/EFI/redhat/grubx64.efi ec296773b97e07eb1ee7828c9eb6b40b75f34cc27a7061e61f5721aeb3c6ad41 (v.2.0.2-164) f691f439b32eec6f967b6e6a7857d7afb0521da1d1919071d1a7353bc9937304 (v.2.0.2-162)
NOTE: in EFI mode, the grubx64.efi binary being always updated by the grub2-efi-x64 package, the issue should not happen.
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.
Comments