8

After regular update (apt update && apt dist-upgrade) of my desktop computer to Linux Kernel 5.15.0-37-generic two days ago, syslog started filling with the following error:

modprobe: FATAL: Module nvidia not found in directory /lib/modules/5.15.0-37-generic

Any ideas?

More info about my system:

# dkms status
fwts-efi-runtime-dkms/22.03.00, 5.15.0-35-generic, x86_64: installed (WARNING! Diff between built and installed module!)
fwts-efi-runtime-dkms/22.03.00, 5.15.0-37-generic, x86_64: installed (WARNING! Diff between built and installed module!)
virtualbox/6.1.32, 5.15.0-35-generic, x86_64: installed
virtualbox/6.1.32, 5.15.0-37-generic, x86_64: installed

uname -rv

5.15.0-37-generic #39-Ubuntu SMP Wed Jun 1 19:16:45 UTC 2022

ubuntu-drivers devices

== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 == modalias : pci:v000010DEd00001C8Dsv00001D05sd00001042bc03sc00i00 vendor : NVIDIA Corporation model : GP107M [GeForce GTX 1050 Mobile] driver : nvidia-driver-470 - distro non-free driver : nvidia-driver-450-server - distro non-free driver : nvidia-driver-418-server - distro non-free driver : nvidia-driver-510-server - distro non-free driver : nvidia-driver-390 - distro non-free driver : nvidia-driver-470-server - distro non-free driver : nvidia-driver-510 - distro non-free recommended driver : xserver-xorg-video-nouveau - distro free builtin

ll /lib/modules/5.15.0-3[57]-generic/kernel/

/lib/modules/5.15.0-35-generic/kernel/: total 92 drwxr-xr-x 23 root root 4096 Jun 3 12:32 ./ drwxr-xr-x 6 root root 4096 Jun 11 16:43 ../ drwxr-xr-x 3 root root 4096 Jun 3 12:32 arch/ drwxr-xr-x 2 root root 4096 Jun 3 12:32 block/ drwxr-xr-x 4 root root 4096 Jun 3 12:32 crypto/ drwxr-xr-x 111 root root 4096 Jun 3 12:32 drivers/ drwxr-xr-x 60 root root 4096 Jun 3 12:32 fs/ drwxr-xr-x 2 root root 4096 Jun 3 12:32 kernel/ drwxr-xr-x 10 root root 4096 Jun 3 12:32 lib/ drwxr-xr-x 2 root root 4096 Jun 3 12:32 mm/ drwxr-xr-x 61 root root 4096 Jun 3 12:32 net/ drwxr-xr-x 3 root root 4096 Jun 3 12:32 nvidia-390/ drwxr-xr-x 3 root root 4096 Jun 3 12:32 nvidia-418srv/ drwxr-xr-x 3 root root 4096 Jun 3 12:32 nvidia-450srv/ drwxr-xr-x 3 root root 4096 Jun 3 12:32 nvidia-470/ drwxr-xr-x 3 root root 4096 Jun 3 12:32 nvidia-470srv/ drwxr-xr-x 3 root root 4096 Jun 11 16:43 nvidia-510/ drwxr-xr-x 3 root root 4096 Jun 3 12:32 nvidia-510srv/ drwxr-xr-x 4 root root 4096 Jun 3 12:32 samples/ drwxr-xr-x 16 root root 4096 Jun 3 12:32 sound/ drwxr-xr-x 3 root root 4096 Jun 3 12:32 ubuntu/ drwxr-xr-x 2 root root 4096 Jun 3 12:32 v4l2loopback/ drwxr-xr-x 2 root root 4096 Jun 3 12:32 zfs/

/lib/modules/5.15.0-37-generic/kernel/: total 64 drwxr-xr-x 16 root root 4096 Jun 9 21:16 ./ drwxr-xr-x 6 root root 4096 Jun 11 17:26 ../ drwxr-xr-x 3 root root 4096 Jun 9 21:16 arch/ drwxr-xr-x 2 root root 4096 Jun 9 21:16 block/ drwxr-xr-x 4 root root 4096 Jun 9 21:16 crypto/ drwxr-xr-x 111 root root 4096 Jun 9 21:16 drivers/ drwxr-xr-x 60 root root 4096 Jun 9 21:16 fs/ drwxr-xr-x 2 root root 4096 Jun 9 21:16 kernel/ drwxr-xr-x 10 root root 4096 Jun 9 21:16 lib/ drwxr-xr-x 2 root root 4096 Jun 9 21:16 mm/ drwxr-xr-x 61 root root 4096 Jun 9 21:16 net/ drwxr-xr-x 4 root root 4096 Jun 9 21:16 samples/ drwxr-xr-x 16 root root 4096 Jun 9 21:16 sound/ drwxr-xr-x 3 root root 4096 Jun 9 21:16 ubuntu/ drwxr-xr-x 2 root root 4096 Jun 9 21:16 v4l2loopback/ drwxr-xr-x 2 root root 4096 Jun 9 21:16 zfs/

dpkg --list | grep -E "^ii.*linux-(headers|image|hwe|modules)"

ii linux-headers-5.15.0-35 5.15.0-35.36 all Header files related to Linux kernel version 5.15.0 ii linux-headers-5.15.0-35-generic 5.15.0-35.36 amd64 Linux kernel headers for version 5.15.0 on 64 bit x86 SMP ii linux-headers-5.15.0-37 5.15.0-37.39 all Header files related to Linux kernel version 5.15.0 ii linux-headers-5.15.0-37-generic 5.15.0-37.39 amd64 Linux kernel headers for version 5.15.0 on 64 bit x86 SMP ii linux-headers-generic 5.15.0.37.39 amd64 Generic Linux kernel headers ii linux-image-5.15.0-35-generic 5.15.0-35.36 amd64 Signed kernel image generic ii linux-image-5.15.0-37-generic 5.15.0-37.39 amd64 Signed kernel image generic ii linux-image-generic 5.15.0.37.39 amd64 Generic Linux kernel image ii linux-modules-5.15.0-35-generic 5.15.0-35.36 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP ii linux-modules-5.15.0-37-generic 5.15.0-37.39 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP ii linux-modules-extra-5.15.0-35-generic 5.15.0-35.36 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP ii linux-modules-extra-5.15.0-37-generic 5.15.0-37.39 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP

Update 1:

I tried to reinstall nvidia-driver-510 (proprietary, tested) using Ubuntu's /usr/bin/software-properties-gtk tool. After the update:

# dkms status
fwts-efi-runtime-dkms/22.03.00, 5.15.0-35-generic, x86_64: installed (WARNING! Diff between built and installed module!)
fwts-efi-runtime-dkms/22.03.00, 5.15.0-37-generic, x86_64: installed (WARNING! Diff between built and installed module!)
nvidia/510.73.05, 5.15.0-37-generic, x86_64: installed
virtualbox/6.1.32, 5.15.0-35-generic, x86_64: installed
virtualbox/6.1.32, 5.15.0-37-generic, x86_64: installed

But /usr/bin/software-properties-gtk and ll /lib/modules/5.15.0-3[57]-generic/kernel/ outputs stay the same.

However, it seems that the error message has gone away.

Update 2:

I did apt remove fwts-efi-runtime-dkms and now:

# dkms status
nvidia/510.73.05, 5.15.0-37-generic, x86_64: installed
virtualbox/6.1.32, 5.15.0-35-generic, x86_64: installed
virtualbox/6.1.32, 5.15.0-37-generic, x86_64: installed
FedKad
  • 13,420

5 Answers5

17

I encountered this issue after a reboot. To help others find this answer, I'll describe my primary symptoms as well:

  • nvidia-settings would not show any options other than Application Profiles and nvidia-settings Configuration
  • Only 1 of my 2 displays seemed to be detected and functioning
  • nvidia-xconfig --query-gpu-info would return Unable to query GPU information
  • Running sudo systemctl status display-manager produced modprobe: FATAL: Module nvidia not found in directory /lib/modules/5.17.0-1020-oem
  • Running modprobe nvidia produced the same message as above as well

These all pointed to faulty or missing driver installations. Here's what I tried that did not work to resolve the issue:

  • Using Software & Updates to switch between driver versions (subsequently rebooting)
  • Switching to Nouveau drivers, purging nvidia, and reinstalling nvidia with ubuntu-drivers autoinstall
  • Installing drivers specifically picked from ubuntu-drivers devices
  • Downgrading to previous driver versions via any of the above methods
  • Downgrading to previous kernel versions I had available

What finally worked

Specifically installing the module package for my last installed version of the Nvidia driver + linux kernel version. My installed nvidia driver version was 510, and my kernel version according to uname -r is 5.17.0-1020-oem, therefore I ran:

sudo apt install linux-modules-nvidia-510-5.17.0-1020-oem

(At this point I was also warned that I was missing header files, so I also installed linux-headers-5.17.0-1020-oem -- I'm not sure how this happened)

After having installed the module above, I added it with modprobe:

sudo modprobe nvidia

My displays refreshed, and presto -- both displays were detected, and I was back in business.

miend
  • 171
2

My guess:
You have more than one kernel version installed; this is an effect of that.

Check for installed kernel-related packages with:
$ dpkg --list | grep -E "^ii.*linux-(headers|image|hwe|modules)"

... and compare to the output of uname -rv

Only one kernel version is required, a kernel one step older might be good to keep, in practice; if there would be some kind of related problem (i.e. booting).

Hannu
  • 6,605
  • 1
  • 28
  • 45
1

I got the same error, but after upgrading to kernel 5.15.0-46, which was leading to nvidia-driver not being loaded error. I followed Update 1 from the question, though installing nvidia-driver-515 instead. It worked flawlessly.

For those who don't know, you can see boot logs with journalctl -b, and then grep nvidia may help find the error on the logs, like this:

$ journalctl -b | grep nvidia
modprobe: FATAL: Module nvidia not found in directory /lib/modules/5.15.0-46-generic

I would have posted this as a comment If I could; I hope this may help others searching for the same error with a recent kernel.

0

I have a custom kernel from linux-surface, and after failing with all the GUI methods, I was able to get it to work via apt using the latest dkms version for nvidia:

sudo apt install nvidia-driver-530 nvidia-dkms-530
0

For anyone looking for a command they can just run, here you go:

ubuntu-drivers devices | grep recommended | grep -oP nvidia-driver-[0-9]* | awk '{sub(/driver-/,""); print}' | { read -d '' x; echo "sudo apt install linux-modules-$x-$(uname -r)"; } | bash

It does the following:

  1. queries the drivers using ubuntu-drivers
➜  ~ ubuntu-drivers devices
== /sys/devices/pci0000
modalias : pci:v0000
vendor   : NVIDIA Corporation
model    : TU106 [GeForce]
driver   : nvidia-driver-525 - distro non-free
driver   : nvidia-driver-450-server - distro non-free
driver   : nvidia-driver-535-server-open - distro non-free recommended
driver   : nvidia-driver-435 - distro non-free

  1. filters for the recommended driver using grep
driver   : nvidia-driver-535-server-open - distro non-free recommended
  1. captures the name of the nvidia driver using grep
nvidia-driver-535
  1. replaces the -driver part with an empty string using awk
nvidia-535
  1. creates the installation command mentioned in miend's answer ($x is nvidia-535 here).
{ read -d '' x; echo "sudo apt install linux-modules-$x-$(uname -r)"; }
  1. pipes the command to bash
forgetso
  • 123