Bug 4448

Summary: akmods on previous kernel doesn't build for the latest kernel-devel
Product: Fedora Reporter: Nicolas Chauvet <kwizart>
Component: akmodsAssignee: Nicolas Chauvet <kwizart>
Status: RESOLVED EXPIRED    
Severity: enhancement CC: kwizart, leigh123linux, sergio
Priority: P1    
Version: unspecified   
Hardware: x86_64   
OS: GNU/Linux   
namespace:

Description Nicolas Chauvet 2017-02-08 16:10:28 CET
This was on el7, but it should be the same on fedora.
Using yum install kernel-devel akmod-VirtualBox
In this case the kernel is updated to a newer version. But only next kernel-devel is installed, so akmods cannot build as the "uname -r" kernel-devel isn't available:

# akmods --force
Checking kmods exist for 3.10.0-514.el7.x86_64             [  OK  ]
Files needed for building modules against kernel
3.10.0-514.el7.x86_64 could not be found as the following
directories are missing:
/usr/src/kernels/3.10.0-514.el7.x86_64/
/usr/lib/modules/3.10.0-514.el7.x86_64/build/Is the correct kernel-devel package installed?


Intead akmods should use "grubby --default-kernel" to try to guess the next kernel to build against (if the appropriate kernel-devel is installed).
Comment 1 Sérgio Basto 2017-03-01 15:08:41 CET
yeah, on Fedora we got many kernel-devel packages installed while in el7 we just have one kernel-devel installed, using the same philosophy of /usr/sbin/akmods-shutdown script, it even more simple in el7 just choose the only one kernel in /usr/src/kernels/ (or run akmods-shutdown :) ): 

echo "Building modules for all installed kernels."
for kernel in /usr/src/kernels/*; do
        kernel=$(basename $kernel)
        /usr/sbin/akmods --force --kernels $kernel
done
Comment 2 Sérgio Basto 2017-03-17 10:52:30 CET
Why not also built it on Fedora builders  ? , I was thinking also move it to Fedora .
Comment 3 Sérgio Basto 2017-03-17 10:56:35 CET
Why not also built it on Fedora builders  ? , I was thinking also move it to Fedora ( akmods on epel7 ) .
Comment 4 Nicolas Chauvet 2017-07-31 11:27:27 CEST
I've recently hit this problem again. Here is a more accurate description:

When the installed kernel is not the latest and the (lasted) kernel-devel is installed, akmods cannot build the kmod because it checks for kernel/kernel-devel match.

It should technically be possible to bypass the verification and still build the kmod, but this last will be built for a newer kernel, so it won't be possible to install it on an older kernel having --disablerepo=* (which akmods uses to install the resulting kmod).
And we cannot just remove the  --disablerepo=* because can't be sure that:
- the workstation still has network
- the repo that has the matching kernel is enabled by default (it could be a non-default kernel from a dedicated repo).

Of course, forcing will not solve anything here. It will just fail everywhere.

What would fix the situation is:
- Users have a fully updated system "before" they are  going to install any given akmod.
- It should be possible to enforce kernel version if a kernel is installed. This would requires changes to the (fedora) kernel package.
Comment 5 Sérgio Basto 2020-09-30 23:27:16 CEST
(In reply to Sérgio Basto from comment #1)
> yeah, on Fedora we got many kernel-devel packages installed while in el7 we
> just have one kernel-devel installed, using the same philosophy of
> /usr/sbin/akmods-shutdown script, it even more simple in el7 just choose the
> only one kernel in /usr/src/kernels/ (or run akmods-shutdown :) ): 
> 
> echo "Building modules for all installed kernels."
> for kernel in /usr/src/kernels/*; do
>         kernel=$(basename $kernel)
>         /usr/sbin/akmods --force --kernels $kernel
> done

seems centos7 is fixed 
sergio@vm_epel7:~#rpm -q kernel-devel
kernel-devel-3.10.0-1127.10.1.el7.x86_64
kernel-devel-3.10.0-1127.13.1.el7.x86_64
kernel-devel-3.10.0-1127.19.1.el7.x86_64