Kmod Nvidia kernel module unavailable | Fedora 40 |

In the recent days, my laptop (Lenovo X1 Extreme 2nd gen) falls back to noveau. Secureboot is disabled. When I boot with the 6.9.5-200.fc40.x86_64 kernel, the nvidia driver is loaded, but not with the 6.9.6 kernel.

I think it’s because the kernel module isn’t available for that kernel version. dnf search kmod-nvidia shows:

Last metadata expiration check: 1:10:58 ago on Mo 01 Jul 2024 18:06:44 CEST.
============================ Name Matched: kmod-nvidia ============================
kmod-nvidia-6.9.4-200.fc40.x86_64.x86_64 : nvidia kernel module(s) for
                                         : 6.9.4-200.fc40.x86_64
kmod-nvidia-6.9.5-200.fc40.x86_64.x86_64 : nvidia kernel module(s) for
                                         : 6.9.5-200.fc40.x86_64

Is there any fix for that?

Added f40 and removed lenovo

Have you checked here akmods . Having a quick look showed me that sometimes waiting ist the best remedy to solve an issue like this.

2 Likes

What if you type nvidia-smi does it say something can’t find Nvidia or talk Nvidia?

If so I had similar and what helped for me was this

sudo kmod remove 'kmod-nvidia-*' and sudo akmods --force

After all done wait still that 5 minutes and then restart usually after running those nvidia-smi works

1 Like

sudo kmod remove 'kmod-nvidia-*' says invalid command 'remove'. I’m currently booted into the older kernel, so nvidia-smi works. I’ll try the newer kernel tomorrow.

Added akmods, kmod, rpmfusion

That was posted as an erroneous command.
It should have been simply sudo akmods --force since the kmod-nvidia-6.9.6… package was not shown with the dnf search command.

It would appear that the reboot after the update which installed the 6.9.6 kernel may have been done too soon after the update completed and thus interrupted the normal build and install of the related kmod-nvidia package.

If the sudo akmods --force command does not build and install the ‘kmod-nvidia-6.9.6…’ package then try it as sudo akmods --force --rebuild.

Should have been sudo dnf remove kmod-nvidia-\* to remove those packages. However, since the kmod-nvidia-6.9.6… package was not installed, the removal of the other packages for older kernels was not warranted.

1 Like

Thanks didint even see my typo sudo dnf remove kmod-nvidia-\* I must been posting lately on couple post with same typo :disappointed:

Thanks for correcting

1 Like

FYI if you run akmods yourself then you do not need to wait 5 minutes.
The 5 minute advice is to allow a background build to complete when you do an update. Which is not the case here.

2 Likes

It could take longer than 5 minutes to complete if the machine has a single or dual core, or much less if you have 16 cores :grinning:

Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/leigh/development/rpmbuild/BUILDROOT/nvidia-kmod-555.58-1.fc40.x86_64
Wrote: /home/leigh/development/rpmbuild/RPMS/x86_64/kmod-nvidia-6.9.6-200.fc40.x86_64-555.58-1.fc40.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.kCDxPm
+ umask 022
+ cd /home/leigh/development/rpmbuild/BUILD
+ cd nvidia-kmod-555.58
+ /usr/bin/rm -rf /home/leigh/development/rpmbuild/BUILDROOT/nvidia-kmod-555.58-1.fc40.x86_64
+ RPM_EC=0
++ jobs -p
+ exit 0
Executing(rmbuild): /bin/sh -e /var/tmp/rpm-tmp.KuXFpz
+ umask 022
+ cd /home/leigh/development/rpmbuild/BUILD
+ rm -rf /home/leigh/development/rpmbuild/BUILD/nvidia-kmod-555.58-SPECPARTS
+ rm -rf nvidia-kmod-555.58 nvidia-kmod-555.58.gemspec
+ RPM_EC=0
++ jobs -p
+ exit 0

real	1m14.671s
user	6m34.131s
sys	1m6.360s
1 Like

No akmod packages found, nothing to do. [ OK ]

Umm
That seems to indicate you may not have the drivers installed from rpmfusion, or that the drivers are not installed at all.

Which command did you use to receive that message? I provided the command in 2 different forms and suggested using the second if the first failed.

Please post the output of dnf list installed \*nvidia\*.

Both sudo akmods --force and sudo akmods --force --rebuild output that.

dnf list installed \*nvidia\* shows:

Installed Packages
kmod-nvidia-6.9.4-200.fc40.x86_64.x86_64
                                   3:550.67-1.fc40 @@commandline                   
kmod-nvidia-6.9.5-200.fc40.x86_64.x86_64
                                   3:550.67-1.fc40 @@commandline                   
nvidia-gpu-firmware.noarch         20240610-1.fc40 @updates                        
nvidia-modprobe.x86_64             3:550.67-1.fc39 @rpmfusion-nonfree-nvidia-driver
nvidia-persistenced.x86_64         3:550.67-1.fc39 @rpmfusion-nonfree-nvidia-driver
nvidia-settings.x86_64             3:550.67-1.fc39 @rpmfusion-nonfree-nvidia-driver
xorg-x11-drv-nvidia.x86_64         3:550.67-1.fc39 @rpmfusion-nonfree-nvidia-driver
xorg-x11-drv-nvidia-cuda.x86_64    3:550.67-1.fc39 @rpmfusion-nonfree-nvidia-driver
xorg-x11-drv-nvidia-cuda-libs.i686 3:550.67-1.fc39 @rpmfusion-nonfree-nvidia-driver
xorg-x11-drv-nvidia-cuda-libs.x86_64
                                   3:550.67-1.fc39 @rpmfusion-nonfree-nvidia-driver
xorg-x11-drv-nvidia-libs.i686      3:550.67-1.fc39 @rpmfusion-nonfree-nvidia-driver
xorg-x11-drv-nvidia-libs.x86_64    3:550.67-1.fc39 @rpmfusion-nonfree-nvidia-driver
xorg-x11-drv-nvidia-power.x86_64   3:550.67-1.fc39 @rpmfusion-nonfree-nvidia-driver

Why isn’t akmod-nvidia listed as installed?
Maybe try updating your driver to the latest in the nvidia repo, see

https://mirror.netsite.dk/rpmfusion/nonfree/fedora/nvidia-driver/39/x86_64/x/

You need to install akmod-nvidia as that builds the new module for 6.9.6 kernel

1 Like

This command dnf remove kmod-nvidia* is awful, don’t use that it will break your system as will also remove kmod-nvidia and likely akmod-nvidia

This will be enough:

sudo akmods --force --rebuild

This is likely the cause of the reported error.

1 Like

Never broke anything for me opposite it always fixes my end when Nvidia is not found or loaded

Forcing the akomds build is cleaner and will not have surprise side effects that removing packages may have.

2 Likes

Yes, it would remove kmod-nvidia. The kmod-nvidia package should not be installed anyway since the user should only install akmod-nvidia (and its dependencies) or kmod-nvidia, and kmod-nvidia seems not intended for fedora anyway but for the older kernels on RHEL or Centos.

No, it would not remove akmod-nvidia.
I have used that command numerous times and since kmod-nvidia-N.N.N… is a package that is locally compiled it removes nothing except the named packages.

The reported error seems to be caused by not having the akmod-nvidia package so the new kernel modules cannot be compiled.

Personally, I always try to suggest removing only the kmod-nvidia-N.N.N… package for the kernel that is having the problem then running the akmods command. It is only recently that I became aware of the --rebuild option that should remove existing modules and rebuild them. The man page is extremely sparse on information on what akmods does and how to use it.

For some reason, the unfree repo wasn’t added on my machine. (I don’t understand how I got the installed drivers without it.) I’m rebuilding now.