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 1108166 - weak-modules fails to update initramfs for weak linked kernels
Summary: weak-modules fails to update initramfs for weak linked kernels
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: kmod
Version: 7.0
Hardware: All
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: David Shea
QA Contact: Shaohui Deng
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-11 13:47 UTC by Phil Perry
Modified: 2016-04-22 05:12 UTC (History)
7 users (show)

Fixed In Version: kmod-20-5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 03:31:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2119 0 normal SHIPPED_LIVE kmod bug fix and enhancement update 2015-11-19 07:40:52 UTC

Description Phil Perry 2014-06-11 13:47:33 UTC
Description of problem:

Weak-modules fails to update the initramfs of weak linked kernels.

For example, kmod-nvidia provides the nvidia kernel module(s), but in order to load, the package must first blacklist the distro nouveau kernel driver to prevent that driver first binding the device.

To achieve this, kmod-nvidia installs /usr/lib/modprobe.d/blacklist-nouveau.conf which blacklists the nouveau kernel module.

This issue affects any/all kmods that attempt to blacklist another kernel module from loading.

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

kmod-14-9.el7.x86_64

How reproducible:

Always

Steps to Reproduce:
1. Install a kmod package that contains a blacklist on RHEL 7.0 with more than one kernel installed.

An example of such a kmod is kmod-nvidia from elrepo.org, but any kmod that blacklists a kernel module will illustrate the issue.

# rpm -q kernel
kernel-3.10.0-123.el7.x86_64
kernel-3.10.0-123.1.2.el7.x86_64

# rpm -q kmod-nvidia
kmod-nvidia-331.79-2.el7.elrepo.x86_64


2. Show the driver is kABI compatible (weak linked) with other kernels:

# find /lib/modules -name nvidia.ko
/lib/modules/3.10.0-123.1.2.el7.x86_64/weak-updates/nvidia/nvidia.ko
/lib/modules/3.10.0-123.el7.x86_64/extra/nvidia/nvidia.ko 

3. See if the initramfs has been updated to incorporate the blacklist for all kABI compatible kernels.

Actual results:

The initramfs for the kernel the module was built against has been correctly updated, as shown by the presence of the blacklist-nouveau.conf blacklist:

# lsinitrd -k 3.10.0-123.el7.x86_64 | grep nouveau
-rw-r--r--   1 root     root          208 Jun 11 11:22 usr/lib/modprobe.d/blacklist-nouveau.conf
drwxr-xr-x   2 root     root            0 Jun 11 11:34 usr/lib/modules/3.10.0-123.el7.x86_64/kernel/drivers/gpu/drm/nouveau
-rw-r--r--   1 root     root      1525977 May  5 16:46 usr/lib/modules/3.10.0-123.el7.x86_64/kernel/drivers/gpu/drm/nouveau/nouveau.ko

but the initramfs for the other weak linked kernel has not been updated:

# lsinitrd | grep nouveau
drwxr-xr-x   2 root     root            0 Jun 11 00:30 usr/lib/modules/3.10.0-123.1.2.el7.x86_64/kernel/drivers/gpu/drm/nouveau
-rw-r--r--   1 root     root      1526009 Jun  4 20:55 usr/lib/modules/3.10.0-123.1.2.el7.x86_64/kernel/drivers/gpu/drm/nouveau/nouveau.ko

Expected results:

We would expect the initramfs for all weak linked kernels to be updated.

Additional info:

If we manually run dracut on that kernel we then see the expected results:

# dracut -f /boot/initramfs-3.10.0-123.1.2.el7.x86_64.img 3.10.0-123.1.2.el7.x86_64

# lsinitrd | grep nouveau
-rw-r--r--   1 root     root          208 Jun 11 11:22 usr/lib/modprobe.d/blacklist-nouveau.conf
drwxr-xr-x   2 root     root            0 Jun 11 12:07 usr/lib/modules/3.10.0-123.1.2.el7.x86_64/kernel/drivers/gpu/drm/nouveau
-rw-r--r--   1 root     root      1526009 Jun  4 20:55 usr/lib/modules/3.10.0-123.1.2.el7.x86_64/kernel/drivers/gpu/drm/nouveau/nouveau.ko

Comment 2 David Shea 2014-06-11 21:41:31 UTC
The weak-modules script isn't updating the initramfs because it's only comparing the list of modules before and after to determine whether to install a new initramfs. This can be fixed to look for blacklist files, but it also reveals a chicken-and-egg problem with installing blacklist files in kmod packages.

dracut uses the currently loaded modules to determine which kernel modules to include in an initramfs. In the case of the nvidia driver, the nouveau driver will usually be loaded before the kmod package is installed, so the nouveau driver will be included in the updated initramfs and the nvidia driver will not (because it's not loaded). So, regardless of what weak-modules is doing, you'll probably want to add an explicit dracut invocation to the kmod package's %post, using --add-drivers nvidia --omit-drivers nouveau.

Comment 3 Phil Perry 2014-06-16 14:20:25 UTC
Hi David,

Thank you for your comments.

Having had the chance to review the weak-modules script more closely, I'm still not overly clear why the initramfs of the "release kernel" (the kernel the module is built against) gets updated whereas the initramfs for other kABI compatible kernels are not updated. i.e, why dracut is run for the release kernel as the list of modules hasn't changed??

If you can also check blacklists (/usr/lib/modprobe.d/*.conf) for kABI compatible kernels and update the initramfs where a new blacklist exists then I think that would be beneficial (and would resolve this issue).

From a packaging perspective, I'm not sure we want to be adding or removing drivers from the initramfs, as I don't believe it's necessary. If the blacklist is correctly incorporated into the initramfs image then that should be sufficient to stop the module loading, which is all we require from a packaging POV.

BTW, another example of a package that blacklists another driver is kmod-r8168 Realtek ethernet driver:

http://elrepo.org/linux/elrepo/el7/x86_64/RPMS/kmod-r8168-8.038.00-1.el7.elrepo.x86_64.rpm

In this case the package provides an alternative driver to the ubiquitous r8169 kernel driver which needs to be blacklisted (or otherwise prevented from loading).

Comment 8 errata-xmlrpc 2015-11-19 03:31:00 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://rhn.redhat.com/errata/RHBA-2015-2119.html


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