Bug 1228897

Summary: dnf installs the wrong kernel variant subpackages
Product: [Fedora] Fedora Reporter: Neal Gompa <ngompa13>
Component: dnfAssignee: rpm-software-management
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: alain.thiaville, bitlord0xff, breebreebran, btrzcinski, bugzilla, charles_rose, edgar.hoch, fedora, giacecco, jeremy9856, johannespfrang+redhat, kparal, kwizart, mario_limonciello, mluscon, negativo17, packaging-team-maint, rjones, robatino, samuel-rhbugs, satellitgo, sergio, tcallawa, vmukhame
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugzilla.rpmfusion.org/show_bug.cgi?id=3386
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On: 1420754    
Bug Blocks:    

Description Neal Gompa 2015-06-06 08:20:47 EDT
Description of problem:
When dkms is installed on a system that doesn't have kernel-devel, it gets kernel-debug-devel instead. It grabs the right kernel-headers, but not the right devel package for the kernel.

Version-Release number of selected component (if applicable):
2.2.0.3-30.git.7c3e7c5.fc22

How reproducible:
Always

Steps to Reproduce:
1. Set up a Fedora system without kernel-devel installed already running on a non-debug kernel
2. Install dkms through dnf (or yum on Fedora 21)

Actual results:
kernel-debug-devel is pulled in as a dependency and installed

Expected results:
kernel-devel should be installed as a dependency on a system that's not running a debug kernel

Additional info:
This issue also appears to have cropped up recently in Fedora 21, too. It didn't always happen, which makes me think it is something related to the 4.0.x kernel release to Fedora 21, but I am not sure of that. Obviously, this breaks DKMS managed kernel modules because now they cannot build properly...
Comment 1 Sergio Monteiro Basto 2015-06-09 15:22:19 EDT
In RPMFusion  we got the same problem with akmods ...
Comment 2 Branko Grubić (bitlord) 2015-07-05 07:53:35 EDT
As I understand this, this is not only 'dkms' issue, or packaging issue, it is hard/impossible to fix currently I guess without low_level changes which will solve this in some way.

also other packages which require 'kernel-devel', pull in 'kernel-debug-devel', which is most likely wrong for them (like in https://bugzilla.redhat.com/show_bug.cgi?id=1047041#c6 ), as I'm told in #yum @ irc.freenode.net, this is because both 'kernel-devel' and 'kernel-debug-devel' provide 'kernel-devel', and yum/dnf resolves that and satisfies the dependency. 


[root@fedora ~]# dnf --enablerepo updates-testing repoquery --whatprovides kernel-devel
Last metadata expiration check performed 1:26:11 ago on Sun Jul  5 12:23:43 2015.
kernel-debug-devel-0:4.0.4-301.fc22.x86_64
kernel-devel-0:4.0.4-301.fc22.x86_64
kernel-debug-devel-0:4.0.7-300.fc22.x86_64
kernel-devel-0:4.0.7-300.fc22.x86_64
kernel-devel-0:4.0.6-300.fc22.x86_64
kernel-debug-devel-0:4.0.6-300.fc22.x86_64


So this should be moved to some other component, but I don't know which one (yum/dnf,rpm)?
Comment 3 Neal Gompa 2015-07-05 09:46:31 EDT
This problem is two parts, really:

1) AFAIK, there is no virtual provides or other kind of thing that ensures that kernel-devel matching running kernel is installed

2) If said thing does exist (in rpm or yum/dnf), DKMS isn't using it (it just Requires kernel-devel).
Comment 4 Simone Caronni 2015-07-06 07:06:00 EDT
(In reply to Neal Gompa from comment #3)
> This problem is two parts, really:
> 
> 1) AFAIK, there is no virtual provides or other kind of thing that ensures
> that kernel-devel matching running kernel is installed
> 
> 2) If said thing does exist (in rpm or yum/dnf), DKMS isn't using it (it
> just Requires kernel-devel).

There is also "kernel-devel-uname-r" that you can use to match your current kernel, but that again breaks installation while there are updates pending etc. 

So only the first point is relevant, unfortunately. Otherwise I would have added it. I have the same problems on DKMS and aKMODs packages that I maintain.

There has been a discussion on devel a few weeks ago exactly about this:

https://lists.fedoraproject.org/pipermail/devel/2015-June/211248.html

Last post here:

https://lists.fedoraproject.org/pipermail/devel/2015-June/211445.html
Comment 5 Kamil Páral 2015-07-10 10:07:14 EDT
Can this be solved somehow using recently-approved weak dependencies?
https://fedoraproject.org/wiki/Packaging:WeakDependencies
Comment 6 Neal Gompa 2015-07-19 08:44:24 EDT
Not really, because the problem is that the kernel package people are using could be quite arbitrary.
Comment 7 Thorsten Leemhuis 2015-07-24 10:04:55 EDT
Did anyone check if "Boolean Dependencies" in RPM 4.13 can solve this bug? For Background see: 
https://lists.fedoraproject.org/pipermail/devel/2015-July/212672.html
http://rpm.org/wiki/PackagerDocs/BooleanDependencies
Comment 8 Simone Caronni 2015-08-10 04:00:55 EDT
Sorry for the late reply.

(In reply to Thorsten Leemhuis from comment #7)
> Did anyone check if "Boolean Dependencies" in RPM 4.13 can solve this bug?
> For Background see: 
> https://lists.fedoraproject.org/pipermail/devel/2015-July/212672.html
> http://rpm.org/wiki/PackagerDocs/BooleanDependencies

Will try, thanks. The problem is that I would really like to fix this for RHEL 7+ and Fedora 21+ alike. This is only for rawhide.

akmods in RPMFusion has simply an added "Conflicts: kernel-debug-devel" in the SPEC file but I don't think it's correct.

Maybe kernel-debug-devel should not provide kernel-devel at all?
Comment 9 Neal Gompa 2015-08-11 06:53:54 EDT
The virtual provides screw up everything, because from DNF and RPM's perspective, they're _all_ kernel-devel. Likewise with kernel-debug indicating it's also "kernel".

AFAICT, rich dependencies could solve it if we renamed kernel-* packages to kernel-release, removed the virtual provides for kernel and kernel-devel, and created virtual packages for kernel and kernel-devel that contained rich dependencies to Require kernel-release* or kernel-debug* things properly.

But the issue with that is that we would need to change how our release composition process would work in order to properly select the right kernel, unless we can bake in the proper logic in the virtual packages' Requires to handle that aspect too.
Comment 10 Neal Gompa 2016-01-14 10:53:20 EST
This issue is present in Fedora 23, and is more accurately a depsolver issue. Reassigning to "DNF".
Comment 11 Honza Silhan 2016-01-19 08:47:47 EST
(In reply to Kamil Páral from comment #5)
> Can this be solved somehow using recently-approved weak dependencies?
> https://fedoraproject.org/wiki/Packaging:WeakDependencies

Yes, we will talk with kernel team how it should be packaged.
Comment 12 Simone Caronni 2016-04-03 16:33:54 EDT
*** Bug 1323445 has been marked as a duplicate of this bug. ***
Comment 13 Sergio Monteiro Basto 2016-04-03 17:29:23 EDT
One thing which, seems to me, is not right, is kernel-devel not require kernel, and we could install kernel-debug-devel without install kernel-debug .
Comment 14 Sergio Monteiro Basto 2016-04-03 20:23:15 EDT
*** Bug 1047041 has been marked as a duplicate of this bug. ***
Comment 15 Thorsten Leemhuis 2016-04-04 01:28:49 EDT
(In reply to Sergio Monteiro Basto from comment #13)
> One thing which, seems to me, is not right, is kernel-devel not require
> kernel

Please explain. You don't need kernel-12.34 if you want to build a module for it, you only need kernel-devel-12.34; so why should kernel-devel require kernel?
Comment 16 Neal Gompa 2016-04-30 19:26:51 EDT
(In reply to Jan Silhan from comment #11)
> (In reply to Kamil Páral from comment #5)
> > Can this be solved somehow using recently-approved weak dependencies?
> > https://fedoraproject.org/wiki/Packaging:WeakDependencies
> 
> Yes, we will talk with kernel team how it should be packaged.

Did this ever happen? It would be nice if this issue was solved so that installing kernel subpackages works correctly. Because of this, netinstalls of Fedora 23 and 24 wind up installing kernel-debug-modules-* instead of the proper one, which breaks all kinds of functionality.
Comment 17 Honza Silhan 2016-05-02 12:02:34 EDT
If it's breaking functionality then netinstalls should require the right one.

Adding `Suggests: kernel-modules*` to `kernel` and `Suggests: kernel-debug-modules*` to `kernel-debug` would probably solve it.
Comment 18 Neal Gompa 2016-05-17 06:41:50 EDT
Can you even put wildcards in Suggests and expect them to be processed properly? I didn't think that even worked...
Comment 19 Sergio Monteiro Basto 2016-07-03 21:01:20 EDT
(In reply to Thorsten Leemhuis from comment #15)
> Please explain. You don't need kernel-12.34 if you want to build a module
> for it, you only need kernel-devel-12.34; so why should kernel-devel require
> kernel?

why we want build a module for a kernel that I don't run or even install ? this is even more strange , akmods or dkms want build modules automatically , but if kernel-devel doesn't match with kernel , it want build and it is a big mess error, end user have many difficulties  to understand what happen  look for example for http://forums.fedoraforum.org/showthread.php?t=308358

Conclusion even if it is possible create an module with kernel-devel and without kernel , it is not a good idea  , kernel-devel shour require kernel , as first step to solve this problem .
Comment 20 Sergio Monteiro Basto 2016-07-03 21:03:51 EDT
(In reply to Neal Gompa from comment #16)
> (In reply to Jan Silhan from comment #11)
> > (In reply to Kamil Páral from comment #5)
> > > Can this be solved somehow using recently-approved weak dependencies?
> > > https://fedoraproject.org/wiki/Packaging:WeakDependencies
> > 
> > Yes, we will talk with kernel team how it should be packaged.
> 
> Did this ever happen? It would be nice if this issue was solved so that
> installing kernel subpackages works correctly. Because of this, netinstalls
> of Fedora 23 and 24 wind up installing kernel-debug-modules-* instead of the
> proper one, which breaks all kinds of functionality.

Fist I prefer summary: dkms pulls in kernel-debug-devel instead of kernel-devel of the running kernel 

I don't find a way with WeakDependencies to solve this problem
Comment 21 Neal Gompa 2016-07-04 22:22:33 EDT
We could set a distro wide preference for the non-debug flavor if DNF had libsolv's preference list stuff hooked up. Alternatively, it might be possible using Suggests in the fedora-repos package to prefer the non-debug variants of all the kernel packages. That depends on whether libsolv uses all existing recorded Suggests as part of its decision logic for new transactions.

Another solution might be to use rich dependencies. If kernel, kernel-modules, kernel-modules-extra, kernel-devel, etc. were all empty packages that resolved the correct variant with rich dependencies, then it might work better.

Essentially, it'd be the same trick that allows us to handle languages/locales now in Fedora 24.

But, that would involve quite a bit of refactoring of how the kernel package is set up, and may have unexpected side-effects. For example, we currently rely on packages calling themselves "kernel" to be able to be multiversion installable, and that may not work anymore...

I'm not sure how this can be solved...
Comment 22 Fedora Admin XMLRPC Client 2016-07-08 05:32:16 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 23 Luca Weiss 2016-12-28 14:47:57 EST
Is there any workaround which is possible for Fedora 25? If you just install a package requiring "kernel-devel", dnf will automatically pull in kernel-debug-devel which then breaks the dkms compilation.
Comment 24 Edgar Hoch 2016-12-28 16:28:19 EST
(In reply to Luca Weiss from comment #23)
> Is there any workaround which is possible for Fedora 25? If you just install
> a package requiring "kernel-devel", dnf will automatically pull in
> kernel-debug-devel which then breaks the dkms compilation.

First install package kernel-devel, then (in an later dnf run) install the packages that require "kernel-devel".
Comment 25 Luca Weiss 2016-12-28 16:33:10 EST
I tried and it's also possible to install them simultaneously (in one command) but it's still not a good solution for people to do. I actually meant something which I can implement in the package spec because people installing this package will surely forget to follow the instructions and install the wrong kernel-devel package... Thanks anyways.
Comment 26 Nicolas Chauvet (kwizart) 2017-02-10 06:20:16 EST
I'm suggesting to drop the kernel-devel virtual provides in the kernel package
See rhbz#1228897