Bug 1450577

Summary: [RFE] Enforce kernel-devel >= uname-r if any kernel-devel
Product: [Fedora] Fedora Reporter: Nicolas Chauvet (kwizart) <kwizart>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: gansalmon, ichavero, itamar, jonathan, kernel-maint, madhu.chinakonda, mchehab, projects.rg, robatino
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-07-02 13:08:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 661442, 1294173    
Attachments:
Description Flags
Current WIP suggested patch none

Description Nicolas Chauvet (kwizart) 2017-05-13 10:53:25 UTC
Description of problem:
When compiling out of tree kernel modules one can run into a situation where there is a version miss-match from any kernel and the related kernel-devel.

Version-Release number of selected component (if applicable):
long standing issue on fedora (so all version up to now).

How reproducible:
all version on fedora kernel (where a strict ABI is enforced based on exact uname -r).

Steps to Reproduce:
1. Install systemtap-devel (akmods, dkms, or any OOT modules).
2. Install the needed kernel-devel
3. Fetch "only" an updated kernel using updates-testing or fedora-rawhide-kernel-nodebug

Actual results:
The kernel is missing the needed kernel-devel at the right version.

Expected results:
The kernel-devel should be installed along the kernel to satisfy the condition:
"kernel-devel-uname-r == $(uname -r)"
Where uname -r is the last kernel installed.

Additional info:
This was initially tough to have a yum/dnf plugin to handle this:
https://bugzilla.rpmfusion.org/show_bug.cgi?id=3386

But with the rpm boolean dependencies I expect it should be possible to fix this issue in two steps:

First step is to have dkms/akmods to install the appropriate kernel-devel variant based on kernel package name.

Second step is to have the kernel package enable a boolean dependency to enforce  the right version when a given kernel-devel variant is installed:

Suggests: (kernel-devel-uname-r == %{KVERREL}%{?variant}%{?1:+%{1}} if kernel-devel-uname-r)

Comment 1 Nicolas Chauvet (kwizart) 2017-05-13 10:57:34 UTC
Created attachment 1278409 [details]
Current WIP suggested patch

This patch is yet un-tested, but should implement the suggested idea.

Comment 2 Nicolas Chauvet (kwizart) 2017-05-13 14:19:27 UTC
FYI, using boolean deps for installing the appropriate kernel-devel variant was initially suggested here: https://bugzilla.redhat.com/show_bug.cgi?id=1420754#c0

I'm currently working on this solution for akmods (untested yet).
For arched packages (systemtap), it's probably possible to %ifarch as appropriate

----
Requires: kernel-devel-uname-r
%if 0{?fedora:
Suggests: (kernel-devel if kernel)
Suggests: (kernel-debug-devel if kernel-debug)
Suggests: (kernel-PAE-devel if kernel-PAE)
Suggests: (kernel-PAEdebug-devel if kernel-PAEdebug)
Suggests: (kernel-lpae-devel if kernel-lpae)
Suggests: (kernel-rt-devel if kernel-rt)
}
----
But I wonder if kernel-rt implements kernel-devel-uname-r

Comment 3 Nicolas Chauvet (kwizart) 2017-07-24 13:23:23 UTC
Updated patch in the kernel mailing list:
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org/thread/6KCGSOP77VEGRC5UNC2FMRFEPEY2WSQ5/

This patch does not handle: 
- The installation of the appropriate variant. 
This can be handled elsewhere by using Requires: (kernel-devel if kernel) , etc.
- The case where the installed kernel-devel-uname-r is already higher than the kernel package been installed.

The reason is that I need to use >= instead of = for the dependency to avoid having the 3 kernel (last + 2 failbacks) to emit each one a dependency on a kernel-devel-uname when only the last one is installed. (the older ones are likely not available anymore from the repos).

Comment 4 Nicolas Chauvet (kwizart) 2017-12-18 20:53:46 UTC
*** Bug 1298126 has been marked as a duplicate of this bug. ***

Comment 5 Nicolas Chauvet (kwizart) 2019-07-02 13:08:40 UTC
FYI, I'm dropping this RFE, despite the current patch works fine in most common cases, it's way too much a problem in few corner cases (IIRC, like downgrading kernel, switching to kernel-rt or else...)

Comment 6 Raphael Groner 2019-07-03 17:31:32 UTC
Indeed, this request doesn't seem relevant any more due to VirtualBox (see bug #1294173, now EOL) made its dependency to DKMS as optional.