Syslog 错误:“modprobe:FATAL:在目录 /lib/modules/5.15.0-37-generic 中未找到模块 nvidia”

Syslog 错误:“modprobe:FATAL:在目录 /lib/modules/5.15.0-37-generic 中未找到模块 nvidia”

两天前,apt update && apt dist-upgrade在我的台式计算机定期更新()到 Linux 内核后,开始出现以下错误:5.15.0-37-genericsyslog

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

有任何想法吗?

有关我的系统的更多信息:

# 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

更新 1:

我尝试nvidia-driver-510 (proprietary, tested)使用 Ubuntu 的/usr/bin/software-properties-gtk工具重新安装。更新后:

# 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

/usr/bin/software-properties-gtk输出ll /lib/modules/5.15.0-3[57]-generic/kernel/保持不变。

不过,错误信息似乎已经消失。

更新 2:

我做到了apt remove fwts-efi-runtime-dkms,现在:

# 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

答案1

重启后我遇到了这个问题。为了帮助其他人找到这个答案,我还将描述我的主要症状:

  • nvidia-settings不会显示除 和 之外的任何其他Application Profiles选项nvidia-settings Configuration
  • 我的 2 台显示器中只有 1 台似乎被检测到并正常运行
  • nvidia-xconfig --query-gpu-info将会回归Unable to query GPU information
  • sudo systemctl status display-manager正在运行modprobe: FATAL: Module nvidia not found in directory /lib/modules/5.17.0-1020-oem
  • 运行modprobe nvidia也产生了与上述相同的消息

这些都表明驱动程序安装有故障或缺失。以下是我尝试过的但无法解决问题的方法:

  • 使用软件和更新在驱动程序版本之间切换(随后重新启动)
  • 切换到 Nouveau 驱动程序,清除 nvidia,然后重新安装 nvidiaubuntu-drivers autoinstall
  • 安装专门挑选的驱动程序ubuntu-drivers devices
  • 通过上述任何一种方法降级到以前的驱动程序版本
  • 降级到以前可用的内核版本

最终奏效了

具体安装模块包这是我最近安装的 Nvidia 驱动程序版本 + Linux 内核版本。我安装的 nvidia 驱动程序版本是510,而我的内核版本uname -r5.17.0-1020-oem,因此我运行了:

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

(此时我还被警告说缺少头文件,所以我也安装了linux-headers-5.17.0-1020-oem——我不确定这是怎么发生的)

安装上述模块后,我将其添加为modprobe

sudo modprobe nvidia

我的显示器刷新了,然后瞧——两个显示器都被检测到了,我又可以继续工作了。

答案2

我的猜测是:
您安装了多个内核版本;这就是其效果。

使用以下命令检查已安装的内核相关软件包:
$ dpkg --list | grep -E "^ii.*linux-(headers|image|hwe|modules)"

...并与输出进行比较uname -rv

只有一个内核版本必需的,实际上,如果存在某种相关问题(例如启动),那么保留旧一步的内核可能是有益的。

答案3

我遇到了同样的错误,但在升级到后kernel 5.15.0-46,这导致 nvidia-driver 未加载错误。我跟着更新 1从问题来看,虽然安装nvidia-驱动程序-515相反,它运行得非常完美。

对于那些不知道的人,你可以使用 查看启动日志journalctl -b,然后 grep nvidia 可能有助于在日志中找到错误,如下所示:

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

如果可以的话,我会将此作为评论发布;我希望这可以帮助其他人在最近的内核中搜索相同的错误。

答案4

对于那些想要寻找可以运行的命令的人来说,你可以在这里找到:

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

它执行以下操作:

  1. 使用以下方式查询驱动程序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. 推荐使用过滤器的驱动程序grep
driver   : nvidia-driver-535-server-open - distro non-free recommended
  1. 使用以下方法捕获 nvidia 驱动程序的名称grep
nvidia-driver-535
  1. 使用以下方法将该部分替换-driver为空字符串awk
nvidia-535
  1. 创建中提到的安装命令miend 的回答$xnvidia-535这儿)。
{ read -d '' x; echo "sudo apt install linux-modules-$x-$(uname -r)"; }
  1. 将命令传输至bash

相关内容