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 2149232 - dracut-initramfs-restore always fails
Summary: dracut-initramfs-restore always fails
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: dracut
Version: 9.1
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Pavel Valena
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-11-29 09:56 UTC by Renaud Métrich
Modified: 2023-05-09 10:38 UTC (History)
4 users (show)

Fixed In Version: dracut-057-20.git20221213.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-09 08:24:17 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github redhat-plumbers dracut-rhel9 pull 54 0 None open fix(dracut-initramfs-restore.sh): initramfs detection not working 2022-11-30 11:32:23 UTC
Red Hat Issue Tracker RHELPLAN-140759 0 None None None 2022-11-29 10:01:52 UTC
Red Hat Product Errata RHBA-2023:2547 0 None None None 2023-05-09 08:24:29 UTC

Description Renaud Métrich 2022-11-29 09:56:48 UTC
Description of problem:

With new release of dracut, dracut-initramfs-restore always fails to unpack the initramfs because it searches for a non-existing file on RHEL.
It's selecting line 35 because we have /boot/loader/entries directory, but it should select line 42 instead.

New release:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
 28 mount -o ro /boot &> /dev/null || true
 29 
 30 if [[ -d /efi/loader/entries ]] || [[ -L /efi/loader/entries ]] \
 31     || [[ -d /efi/$MACHINE_ID ]] || [[ -L /efi/$MACHINE_ID ]]; then
 32     IMG="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
 33 elif [[ -d /boot/loader/entries ]] || [[ -L /boot/loader/entries ]] \
 34     || [[ -d /boot/$MACHINE_ID ]] || [[ -L /boot/$MACHINE_ID ]]; then
 35     IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
 36 elif [[ -d /boot/efi/loader/entries ]] || [[ -L /boot/efi/loader/entries ]] \
 37     || [[ -d /boot/efi/$MACHINE_ID ]] || [[ -L /boot/efi/$MACHINE_ID ]]; then
 38     IMG="/boot/efi/$MACHINE_ID/$KERNEL_VERSION/initrd"
 39 elif [[ -f /lib/modules/${KERNEL_VERSION}/initrd ]]; then
 40     IMG="/lib/modules/${KERNEL_VERSION}/initrd"
 41 elif [[ -f /boot/initramfs-${KERNEL_VERSION}.img ]]; then
 42     IMG="/boot/initramfs-${KERNEL_VERSION}.img"
 43 elif mountpoint -q /efi; then
 44     IMG="/efi/$MACHINE_ID/$KERNEL_VERSION/initrd"
 45 elif mountpoint -q /boot/efi; then
 46     IMG="/boot/efi/$MACHINE_ID/$KERNEL_VERSION/initrd"
 47 else
 48     echo "No initramfs image found to restore!"
 49     exit 1
 50 fi
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Previous release is correct because of the checks on line 25-26 which do not apply to RHEL9.

Previous release (055-45.git20220404.el9_0):
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
 22 mount -o ro /boot &> /dev/null || true
 23 
 24 if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
 25     && [[ $MACHINE_ID ]] \
 26     && [[ -d /efi/${MACHINE_ID} || -L /efi/${MACHINE_ID} ]]; then
 27     IMG="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
 28 elif [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
 29     && [[ $MACHINE_ID ]] \
 30     && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]]; then
 31     IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
 32 elif [[ -f /boot/initramfs-${KERNEL_VERSION}.img ]]; then
 33     IMG="/boot/initramfs-${KERNEL_VERSION}.img"
 34 elif [[ -f /lib/modules/${KERNEL_VERSION}/initrd ]]; then
 35     IMG="/lib/modules/${KERNEL_VERSION}/initrd"
 36 else
 37     echo "No initramfs image found to restore!"
 38     exit 1
 39 fi
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------


Additionally, but unrelated, the kernel always complains when the mount of /boot happens:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
kernel: sda2: Can't mount, would change RO state
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

This is due to /boot already been mounted (usually), and line 28 (in newer dracut) to fail.
It would be nice to check if /boot is already a mount point to avoid this message, which may the admin believe there is something wrong with /dev/sda2 (e.g. it would be corrupted).


Version-Release number of selected component (if applicable):

dracut-057-13.git20220816.el9.x86_64

How reproducible:

Always

Steps to Reproduce:
1. Reboot with persistent journal enabled

Actual results:

Failure to unpack the initramfs

Expected results:

No issue

Comment 13 errata-xmlrpc 2023-05-09 08:24:17 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 (dracut bug fix and enhancement update), 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-2023:2547


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