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 1591664 - The posttrans step of the RPM microcode_ctl executes dracut -f which generate broken initramfs
Summary: The posttrans step of the RPM microcode_ctl executes dracut -f which generate...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: microcode_ctl
Version: 7.5
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: rc
: ---
Assignee: Eugene Syromiatnikov
QA Contact: Jiri Dluhos
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-15 09:00 UTC by Welterlen Benoit
Modified: 2022-03-13 15:07 UTC (History)
5 users (show)

Fixed In Version: microcode_ctl-2.1-44.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 09:45:55 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:3097 0 None None None 2018-10-30 09:48:04 UTC

Description Welterlen Benoit 2018-06-15 09:00:41 UTC
Description of problem:
the posttrans step of the microcode_ctl spec is:

8< ---------------- 8< ---------------- 8< --------
%posttrans
# We only want to regenerate the initramfs for a fully booted
# system; if this package happened to e.g. be pulled in as a build
# dependency, it is pointless at best to regenerate the initramfs,
# and also does not work with rpm-ostree:
# https://bugzilla.redhat.com/show_bug.cgi?id=1199582
if [ -d /run/systemd/system ]; then
        dracut -f
fi
8< ---------------- 8< ---------------- 8< --------


Thus if the running kernel is not installed (for example, a PXE installation with the kernel of the ISO but newer kernel in the repository), dracut -f will build a broken initramfs (without any module).
Then, the later use of weak-modules will generate error messages:
8< ---------------- 8< ---------------- 8< --------
/lib/modules/3.10.0-862.el7.x86_64//modules.dep is missing. Did you run depmod?
/sbin/weak-modules: line 132: /boot/initramfs-3.10.0-862.el7.x86_64.tmp: No such file or directory
/sbin/weak-modules: line 148: /boot/initramfs-3.10.0-862.el7.x86_64.tmp: No such file or directory
/sbin/weak-modules: line 153: /boot/initramfs-3.10.0-862.el7.x86_64.tmp: No such file or directory
Unable to decompress /boot/initramfs-3.10.0-862.el7.x86_64.tmp: Unknown format
/sbin/weak-modules: line 191: /tmp/weak-modules.pDpibs/new_initramfs.img: No such file or directory
rm: cannot remove '/tmp/weak-modules.pDpibs/new_initramfs.img': No such file or directory
mv: cannot stat '/boot/initramfs-3.10.0-862.el7.x86_64.tmp': No such file or directory
8< ---------------- 8< ---------------- 8< --------


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

How reproducible:
Easy

Steps to Reproduce:
1. boot an installation with a kernel different than the one which will be installed
2. finish the installation (dracut -f will be executed)
3. install a RPM that needs weak-modules

Actual results:
Broken initramfs in /boot and error messages in case of weak-module call.

Expected results:
No error message/ no initramfs build for not installed kernels

Additional info:

Comment 2 Eugene Syromiatnikov 2018-07-20 15:36:25 UTC
I would say it's a bug in dracut, but it can indeed be worked around in the microcode_ctl package.

Comment 7 Welterlen Benoit 2018-09-24 14:25:56 UTC
Hello,

Thank you for the test.
And is there a broken initramfs in /boot ?
Are you using weak modules ?

Regards,

Comment 8 Jiri Dluhos 2018-09-25 16:13:03 UTC
The machine rebooted properly with the newly installed initrd, so it was OK.
Regarding weak modules, I will need to check - please stay tuned.

Comment 16 Welterlen Benoit 2018-10-11 12:00:36 UTC
Hello,

I'm now able to reproduce the issue:

It is due to this part in the %script of the kmod-nvidia rpm: 

modules=( $(find /lib/modules/3.10.0-862.el7.x86_64/extra/nvidia | grep '\.ko$') )
printf '%s\n' "${modules[@]}"  | /sbin/weak-modules --verbose --add-modules

And the fact that a file named /boot/initramfs-3.10.0-862.el7.x86_64.img exists and that there is no data in /lib/modules/3.10.0-862.el7.x86_64/.

Thus, this code in /usr/sbin/weak-modules fails:
8<---------- 8< ---------------- 8< ---------------- 8< --------
# check_initramfs:
# check and possibly also update the initramfs for changed kernels
check_initramfs() {
    local kernel=$1

    # If there is no initramfs already we will not make one here.
    if [ -e "$initramfs_prefix/initramfs-$kernel.img" ];
    then
        old_initramfs="$initramfs_prefix/initramfs-$kernel.img"
        tmp_initramfs="$initramfs_prefix/initramfs-$kernel.tmp"
        new_initramfs="$initramfs_prefix/initramfs-$kernel.img"

        echo $dracut -f "$tmp_initramfs" "$kernel"
        $dracut -f "$tmp_initramfs" "$kernel"

        if ! compare_initramfs_modules "$old_initramfs" "$tmp_initramfs";
        then
            doit mv "$tmp_initramfs" "$new_initramfs"
        else
            rm -f "$tmp_initramfs"
        fi
    fi
}
8<---------- 8< ---------------- 8< ---------------- 8< --------

because dracut fails fails to generate a new initramfs of the required kernel because there is no /lib/modules/3.10.0-862.el7.x86_64//modules.dep

The kernel 3.10.0-862.el7.x86_64 is market to be managed by dracut because it is the kernel on which the module has been built against.

The issue may be fixed by weak-modules to check the presence of modules.dep for the kernel.

Benoit

Comment 20 Jiri Dluhos 2018-10-23 12:20:42 UTC
As from my side it seems working, closing as VERIFIED.

Welterlen, can you please add a BZ number to this bug so that the case with nvidia can be traced through this bug history? Thanks! :-)

Comment 21 Welterlen Benoit 2018-10-23 15:38:37 UTC
Hello

It's not specific to the nvidia package.
The issue is also visible with kmod-redhat-megaraid_sas.
You should have a initramfs of the kernel against which the new module has been build (initramfs-3.10.0-862.el7.x86_64.img - can be empty) and nothing regarding this kernel in /lib/modules/

But the easier way to fix it should be in dracut directly.

Comment 23 Jiri Dluhos 2018-10-23 19:43:19 UTC
After discussing, we came to this conclusion:

The original problem is solved; see this commit: http://pkgs.devel.redhat.com/cgit/rpms/microcode_ctl/commit/?h=rhel-7.6&id=cf283d63d208

Please clone this bug or open a new BZ for the new problem you've found with kmod-nvidia (+ kmod-redhat-megaraid_sas), and flag the new bug for RHEL 7.7.

Comment 25 errata-xmlrpc 2018-10-30 09:45:55 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/RHEA-2018:3097


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