无法加载 NVIDIA 驱动程序(Ubuntu)

无法加载 NVIDIA 驱动程序(Ubuntu)

我在 Ubuntu 21.04 上加载 NVIDIA 驱动程序时遇到问题。结果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.

结果是nvidia-settings

ERROR: NVIDIA driver is not loaded
ERROR: Unable to load info from any available system

我尝试重新安装最新的 NVIDIA 驱动程序 470.57.02(我当前的内核是5.14.2-051402-generic)。使用 进行安装时sudo apt-get update出现sudo apt-get install nvidia-driver-470此错误:

    INFO:Enable nvidia
    DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
    DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
    DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
    Loading new nvidia-470.57.02 DKMS files...
    Building for 5.14.2-051402-generic 5.14.3-051403-generic
    Building for architecture x86_64
    Building initial module for 5.14.2-051402-generic
    ERROR (dkms apport): kernel package linux-headers-5.14.2-051402-generic is not supported
    Error! Bad return status for module build on kernel: 5.14.2-051402-generic (x86_64)
    Consult /var/lib/dkms/nvidia/470.57.02/build/make.log for more information.
    dpkg: error processing package nvidia-dkms-470 (--configure):
     installed nvidia-dkms-470 package post-installation script subprocess returned error exit status 10
    dpkg: dependency problems prevent configuration of nvidia-driver-470:
     nvidia-driver-470 depends on nvidia-dkms-470 (= 470.57.02-0ubuntu1); however:
      Package nvidia-dkms-470 is not configured yet.
    
    dpkg: error processing package nvidia-driver-470 (--configure):
     dependency problems - leaving unconfigured
    Setting up libnvidia-encode-470:amd64 (470.57.02-0ubuntu1) ...
    No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                              Processing triggers for desktop-file-utils (0.26-1ubuntu1) ...
    Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
    Processing triggers for libc-bin (2.33-0ubuntu5) ...
    Processing triggers for man-db (2.9.4-2) ...
    Processing triggers for mailcap (3.68ubuntu1) ...
    Processing triggers for initramfs-tools (0.139ubuntu3) ...
    update-initramfs: Generating /boot/initrd.img-5.14.3-051403-generic
    Errors were encountered while processing:
     nvidia-dkms-470
     nvidia-driver-470
    E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试用 清除所有 NVIDIA 软件包sudo apt-get purge nvidia-*sudo apt-get autoremove然后重复该过程,但没有成功。我还尝试在以前的内核(5.11)上安装它,安装以前的驱动程序(nvidia-driver-460),但没有任何效果。

卡被正确检测到。这是输出lspci | grep NVIDIA

01:00.0 VGA compatible controller: NVIDIA Corporation GA106M [GeForce RTX 3060 Mobile / Max-Q] (rev a1)
01:00.1 Audio device: NVIDIA Corporation Device 228e (rev a1)

我也尝试过以下解决方案无法安装 nvidia 驱动程序 - 无法找到软件包, 和NVIDIA-SMI 失败,因为它无法与 NVIDIA 驱动程序通信。请确保已安装并运行最新的 NVIDIA 驱动程序,还是没有成功。

有什么建议吗?谢谢!

答案1

我终于成功解决了这个问题。问题确实与安全启动有关。我已经禁用了它,但在此过程中我将启动模式设置为UEFI with CSM而不是普通UEFI。这造成了麻烦。

(w-sky 的回答NVIDIA-SMI 失败,因为它无法与 NVIDIA 驱动程序通信。请确保已安装并运行最新的 NVIDIA 驱动程序给了我提示)

这些是解决我的问题的步骤:

  • 在附加驱动程序中,选择 x.org (nouveau) 以停用 NVIDIA 驱动程序。重新启动。
  • 启动菜单,选择UEFI(不是UEFI with CSM!!)并禁用Secure Boot
  • 在附加驱动程序中,再次激活 NVIDIA 驱动程序并再次重新启动。

您可能可以保持安全启动处于启用状态。在这种情况下,设置 NVIDIA 驱动程序时,系统会要求您注册一个新的 MOK 密钥,重新启动后,系统会要求您再次输入该密钥,以授予驱动程序硬件访问权限。我并没有这样做,因为启用安全启动也会阻止 iwlwifi 驱动程序访问我笔记本电脑中的 AX210 wifi 卡。

祝你好运!

相关内容