总结:
Ubuntu 自动更新 linux-headers 后,我的 Nvidia GPU 驱动程序不工作。
如果我按照这个帖子,我能解决我的问题吗?或者您有更好的建议吗?
我之前在 BIOS 中将 GPU 设置为我的主显示器,现在我看不到 BIOS 也看不到 grub 菜单来在 grub 中选择前一个内核。(更新:我错了。我再试一次,我确实可以进入BIOS。)
我有过这样的经历:如果我对 nvidia 驱动程序做错了什么,我就必须重新安装操作系统,因为我不是 Linux 和 Ubuntu 的深度用户,所以我必须小心。
我不是 Linux 或 Ubuntu 的深度用户。上个月我买了一块 RTX 2060 12G,并把它安装在我的 Asus P8Z77-V LX2 上,系统是 Ubuntu 20.04.4 LTS。物理安装后,我通过软件和更新 > 附加驱动程序安装了 nvidia-driver-510;通过从 Nvidia 的官方网站添加 cuda-repo 和 apt-get install 安装了 cuda-tools-11-0,它们都工作正常。我用这张显卡学习机器学习。这个月一切正常,前几天我还用它来做 CUDA 计算,但我发现今天(2022 年 4 月 19 日)它不起作用,即使重启了几次。如下所示:
(base) asuspei@asus-pc:~$ nvidia-smi
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
我谷歌搜索了一些,这个帖子可能和我的情况类似。根据我对这篇文章的粗略理解,问题是更新的内核或更新的 linux-headers 导致 Nvidia 驱动程序无法工作,用户必须重新安装驱动程序。我不知道如何检查我的内核是否最近自动更新,但我根据关键字“linux-headers”搜索了下面的 dpkg.log 文件,似乎它确实在 2022 年 4 月 16 日自动更新过,就在几天前。而且确实显卡在更新之前是正常的,更新之后就不工作了。
如果我按照步骤操作这个帖子,我能解决我的问题吗?或者你有更好的建议吗?我有一个经验,如果我对 nvidia 驱动程序做错了什么,我就必须重新安装操作系统,因为我不是 Linux 和 Ubuntu 的深度用户,所以我必须小心。
你能帮助我吗?非常感谢!
---- 系统信息相关 ----
(base) asuspei@asus-pc:~$ uname -a
Linux asus-pc 5.13.0-39-generic #44~20.04.1-Ubuntu SMP Thu Mar 24 16:43:35 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
(base) asuspei@asus-pc:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
(base) asuspei@asus-pc:~$ apt list --installed | grep -i -e 'linux-headers'
linux-headers-5.13.0-35-generic/focal-updates,focal-security,now 5.13.0-35.40~20.04.1 amd64 [installed,automatic]
linux-headers-5.13.0-39-generic/focal-updates,focal-security,now 5.13.0-39.44~20.04.1 amd64 [installed,automatic]
linux-headers-generic-hwe-20.04/focal-updates,focal-security,now 5.13.0.39.44~20.04.24 amd64 [installed,automatic]
(base) asuspei@asus-pc:~$ apt list --installed | grep -i -e 'nvidia'
libnvidia-cfg1-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-common-510/focal-updates,focal-updates,focal-security,focal-security,now 510.54-0ubuntu0.20.04.1 all [installed,automatic]
libnvidia-compute-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-compute-510/now 510.47.03-0ubuntu0.20.04.1 i386 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-decode-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-decode-510/now 510.47.03-0ubuntu0.20.04.1 i386 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-encode-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-encode-510/now 510.47.03-0ubuntu0.20.04.1 i386 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-extra-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-fbc1-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-fbc1-510/now 510.47.03-0ubuntu0.20.04.1 i386 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-gl-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-gl-510/now 510.47.03-0ubuntu0.20.04.1 i386 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
linux-modules-nvidia-510-5.13.0-35-generic/focal-updates,focal-security,now 5.13.0-35.40~20.04.1 amd64 [installed,automatic]
linux-modules-nvidia-510-generic-hwe-20.04/now 5.13.0-35.40~20.04.1 amd64 [installed,upgradable to: 5.13.0-39.44~20.04.1]
linux-objects-nvidia-510-5.13.0-35-generic/focal-updates,focal-security,now 5.13.0-35.40~20.04.1 amd64 [installed,automatic]
linux-signatures-nvidia-5.13.0-35-generic/focal-updates,focal-security,now 5.13.0-35.40~20.04.1 amd64 [installed,automatic]
nvidia-compute-utils-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
nvidia-driver-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
nvidia-kernel-common-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
nvidia-kernel-source-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
nvidia-prime/now 0.8.16~0.20.04.1 all [installed,upgradable to: 0.8.16~0.20.04.2]
nvidia-settings/focal-updates,now 470.57.01-0ubuntu0.20.04.3 amd64 [installed,automatic]
nvidia-utils-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
xserver-xorg-video-nvidia-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
(base) asuspei@asus-pc:~$ apt list --installed | grep -i -e 'cuda'
cuda-command-line-tools-11-0/unknown,now 11.0.3-1 amd64 [installed,automatic]
cuda-compiler-11-0/unknown,now 11.0.3-1 amd64 [installed,automatic]
cuda-cudart-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-cudart-dev-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-cuobjdump-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-cupti-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-cupti-dev-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-documentation-11-0/unknown,now 11.0.228-1 amd64 [installed,automatic]
cuda-driver-dev-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-gdb-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-libraries-11-0/unknown,now 11.0.3-1 amd64 [installed,automatic]
cuda-libraries-dev-11-0/unknown,now 11.0.3-1 amd64 [installed,automatic]
cuda-memcheck-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-nsight-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-nsight-compute-11-0/unknown,now 11.0.3-1 amd64 [installed,automatic]
cuda-nsight-systems-11-0/unknown,now 11.0.3-1 amd64 [installed,automatic]
cuda-nvcc-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-nvdisasm-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-nvml-dev-11-0/unknown,now 11.0.167-1 amd64 [installed,automatic]
cuda-nvprof-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-nvprune-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-nvrtc-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-nvrtc-dev-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-nvtx-11-0/unknown,now 11.0.167-1 amd64 [installed,automatic]
cuda-nvvp-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-repo-ubuntu2004-11-0-local/now 11.0.3-450.51.06-1 amd64 [installed,local]
cuda-samples-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-sanitizer-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-toolkit-11-0/unknown,now 11.0.3-1 amd64 [installed]
cuda-tools-11-0/unknown,now 11.0.3-1 amd64 [installed,automatic]
cuda-visual-tools-11-0/unknown,now 11.0.3-1 amd64 [installed,automatic]
(base) asuspei@asus-pc:~$ grep -i -e 'linux-headers' /var/log/dpkg.log*
/var/log/dpkg.log.1:2022-02-23 08:49:56 install linux-headers-5.13.0-30-generic:amd64 <none> 5.13.0-30.33~20.04.1
/var/log/dpkg.log.1:2022-02-23 08:49:56 status half-installed linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log.1:2022-02-23 08:49:57 status unpacked linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log.1:2022-02-23 08:49:57 install linux-headers-generic-hwe-20.04:amd64 <none> 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-02-23 08:49:57 status half-installed linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-02-23 08:49:57 status unpacked linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-02-23 08:50:21 configure linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1 <none>
/var/log/dpkg.log.1:2022-02-23 08:50:21 status unpacked linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log.1:2022-02-23 08:50:21 status half-configured linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log.1:2022-02-23 08:50:21 status installed linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log.1:2022-02-23 08:50:23 configure linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17 <none>
/var/log/dpkg.log.1:2022-02-23 08:50:23 status unpacked linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-02-23 08:50:23 status half-configured linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-02-23 08:50:23 status installed linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-03-11 10:30:39 install linux-headers-5.13.0-35-generic:amd64 <none> 5.13.0-35.40~20.04.1
/var/log/dpkg.log.1:2022-03-11 10:30:39 status half-installed linux-headers-5.13.0-35-generic:amd64 5.13.0-35.40~20.04.1
/var/log/dpkg.log.1:2022-03-11 10:30:41 status unpacked linux-headers-5.13.0-35-generic:amd64 5.13.0-35.40~20.04.1
/var/log/dpkg.log.1:2022-03-11 10:30:41 upgrade linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17 5.13.0.35.40~20.04.20
/var/log/dpkg.log.1:2022-03-11 10:30:41 status half-configured linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-03-11 10:30:41 status unpacked linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-03-11 10:30:41 status half-installed linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-03-11 10:30:42 status unpacked linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20
/var/log/dpkg.log.1:2022-03-11 10:30:42 configure linux-headers-5.13.0-35-generic:amd64 5.13.0-35.40~20.04.1 <none>
/var/log/dpkg.log.1:2022-03-11 10:30:42 status unpacked linux-headers-5.13.0-35-generic:amd64 5.13.0-35.40~20.04.1
/var/log/dpkg.log.1:2022-03-11 10:30:42 status half-configured linux-headers-5.13.0-35-generic:amd64 5.13.0-35.40~20.04.1
/var/log/dpkg.log.1:2022-03-11 10:30:42 status installed linux-headers-5.13.0-35-generic:amd64 5.13.0-35.40~20.04.1
/var/log/dpkg.log.1:2022-03-11 10:30:42 configure linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20 <none>
/var/log/dpkg.log.1:2022-03-11 10:30:42 status unpacked linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20
/var/log/dpkg.log.1:2022-03-11 10:30:42 status half-configured linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20
/var/log/dpkg.log.1:2022-03-11 10:30:42 status installed linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20
/var/log/dpkg.log:2022-04-15 09:34:30 install linux-headers-5.13.0-39-generic:amd64 <none> 5.13.0-39.44~20.04.1
/var/log/dpkg.log:2022-04-15 09:34:30 status half-installed linux-headers-5.13.0-39-generic:amd64 5.13.0-39.44~20.04.1
/var/log/dpkg.log:2022-04-15 09:34:32 status unpacked linux-headers-5.13.0-39-generic:amd64 5.13.0-39.44~20.04.1
/var/log/dpkg.log:2022-04-15 09:34:32 upgrade linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20 5.13.0.39.44~20.04.24
/var/log/dpkg.log:2022-04-15 09:34:32 status half-configured linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20
/var/log/dpkg.log:2022-04-15 09:34:32 status unpacked linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20
/var/log/dpkg.log:2022-04-15 09:34:32 status half-installed linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20
/var/log/dpkg.log:2022-04-15 09:34:34 status unpacked linux-headers-generic-hwe-20.04:amd64 5.13.0.39.44~20.04.24
/var/log/dpkg.log:2022-04-15 09:34:35 configure linux-headers-5.13.0-39-generic:amd64 5.13.0-39.44~20.04.1 <none>
/var/log/dpkg.log:2022-04-15 09:34:35 status unpacked linux-headers-5.13.0-39-generic:amd64 5.13.0-39.44~20.04.1
/var/log/dpkg.log:2022-04-15 09:34:35 status half-configured linux-headers-5.13.0-39-generic:amd64 5.13.0-39.44~20.04.1
/var/log/dpkg.log:2022-04-15 09:34:53 status installed linux-headers-5.13.0-39-generic:amd64 5.13.0-39.44~20.04.1
/var/log/dpkg.log:2022-04-15 09:34:53 configure linux-headers-generic-hwe-20.04:amd64 5.13.0.39.44~20.04.24 <none>
/var/log/dpkg.log:2022-04-15 09:34:53 status unpacked linux-headers-generic-hwe-20.04:amd64 5.13.0.39.44~20.04.24
/var/log/dpkg.log:2022-04-15 09:34:54 status half-configured linux-headers-generic-hwe-20.04:amd64 5.13.0.39.44~20.04.24
/var/log/dpkg.log:2022-04-15 09:34:54 status installed linux-headers-generic-hwe-20.04:amd64 5.13.0.39.44~20.04.24
/var/log/dpkg.log:2022-04-16 19:18:45 status installed linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log:2022-04-16 19:18:45 remove linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1 <none>
/var/log/dpkg.log:2022-04-16 19:18:45 status half-configured linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log:2022-04-16 19:18:45 status half-installed linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log:2022-04-16 19:18:46 status config-files linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log:2022-04-16 19:18:46 status not-installed linux-headers-5.13.0-30-generic:amd64 <none>