NVIDIA 驱动程序错误 -“无法确定支持级别”和“NVIDIA-SMI 失败,因为它无法与 NVIDIA 驱动程序通信”

NVIDIA 驱动程序错误 -“无法确定支持级别”和“NVIDIA-SMI 失败,因为它无法与 NVIDIA 驱动程序通信”

我买了一台新笔记本电脑,并在上面安装了 Ubuntu 20.04,我想在 GPU 而不是 CPU 上运行我的代码。不幸的是,我遇到了问题。我尝试安装驱动程序(nvidia-driver-470 和 nvidia-driver-510),但显然没有检测到它们。

当我输入命令时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.

使用以下命令ubuntu-drivers devices我得到:

WARNING:root:_pkg_get_support nvidia-driver-510: package has invalid Support PBheader, cannot determine support level

WARNING:root:_pkg_get_support nvidia-driver-510-server: package has invalid Support PBheader, cannot determine support level

== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00002520sv00001462sd000012F2bc03sc00i00
vendor : NVIDIA Corporation

driver : nvidia-driver-510 - third-party non-free

driver : nvidia-driver-510-server - distro non-free

driver : nvidia-driver-470 - distro non-free recommended

driver : nvidia-driver-470-server - distro non-free

driver : xserver-xorg-video-nouveau - distro free builtin

使用以下命令sudo lspci我得到:

00:00.0 Host bridge: Intel Corporation 10th Gen Core Processor Host Bridge/DRAM Registers (rev 02)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) (rev 02)
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics (rev 05)
00:12.0 Signal processing controller: Intel Corporation Comet Lake PCH Thermal Controller
00:14.0 USB controller: Intel Corporation Comet Lake USB 3.1 xHCI Host Controller
00:14.2 RAM memory: Intel Corporation Comet Lake PCH Shared SRAM
00:14.3 Network controller: Intel Corporation Wi-Fi 6 AX201
00:15.0 Serial bus controller [0c80]: Intel Corporation Comet Lake PCH Serial IO I2C Controller #0
00:15.2 Serial bus controller [0c80]: Intel Corporation Comet Lake PCH Serial IO I2C Controller #2
00:16.0 Communication controller: Intel Corporation Comet Lake HECI Controller
00:1d.0 PCI bridge: Intel Corporation Comet Lake PCI Express Root Port #9 (rev f0)
00:1d.4 PCI bridge: Intel Corporation Device 06b4 (rev f0)
00:1f.0 ISA bridge: Intel Corporation Comet Lake LPC Controller
00:1f.3 Audio device: Intel Corporation Comet Lake PCH cAVS
00:1f.4 SMBus: Intel Corporation Comet Lake PCH SMBus Controller
00:1f.5 Serial bus controller [0c80]: Intel Corporation Comet Lake PCH SPI Controller
01:00.0 VGA compatible controller: NVIDIA Corporation Device 2520 (rev a1)
01:00.1 Audio device: NVIDIA Corporation Device 228e (rev a1)
02:00.0 Non-Volatile memory controller: Micron Technology Inc Device 5404 (rev 03)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)

dkms status得到:

nvidia, 470.103.01, 5.13.0-39-generic, x86_64: installed

我对 Ubuntu 的经验很少,并且第一次想使用 GPU。

答案1

对我来说,主要问题出在 /etc/default/grub 中。我需要将此处的代码行更改GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pci=realloc"。之后,我从终端执行了该sudo update-grub命令,然后执行了该命令。reboot

相关内容