20.04 上的 Nvidia 驱动程序问题

20.04 上的 Nvidia 驱动程序问题

更新:首先看看这个是否相关?Nvidia 驱动程序 460 无法与 Ubuntu 18.04 中的 5.4.0-64 内核配合使用

nvidia-settings 460 已安装无论你使用哪个版本的驱动程序这些版本的东西有可能全部损坏吗?而且软件包仓库导致这个问题无法修复?

以下操作无效:https://linuxconfig.org/how-to-install-the-nvidia-drivers-on-ubuntu-20-04-focal-fossa-linux

它也没有提到测试结果是否有效。

这是我的测试:

$ 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 和 cuda 之间的联系。

我只是在命令行上运行,所以我只关心最少的命令行指令。

我想知道 20.04 中的路径是否发生了变化。有一个奇怪的文件

cat /usr/lib/nvidia/alternate-install-available
The NVIDIA driver provided by Ubuntu can be installed by launching the "Software & Updates" application, and by selecting the NVIDIA driver from the "Additional Drivers" tab.

我应该提到,我运行的是无头模式(没有连接显示器),因此如果显示器使用时碰巧触发了任何奇怪的触发器,那么了解这些触发器会很有用。以前我安装在服务器上时,情况并非如此。

我有一台 GeForce RTX 2070……也许这就是问题所在。目前还不确定。

更新:插入显示器并重新启动后,什么都没有出现。屏幕变暗。我仍然可以通过 ssh 进入盒子。

inxi
CPU: 6-Core Intel Core i7-8700 (-MT MCP-) speed/min/max: 800/800/4600 MHz Kernel: 5.4.0-65-generic x86_64 Up: 5m
Mem: 1631.7/32075.2 MiB (5.1%) Storage: 465.76 GiB (54.9% used) Procs: 406 Shell: bash 5.0.17 inxi: 3.0.38
(38) $ inxi -F
System:    Host: xxx Kernel: 5.4.0-65-generic x86_64 bits: 64 Console: tty 1 Distro: Ubuntu 20.04.2 LTS (Focal Fossa)
Machine:   Type: Desktop Mobo: Micro-Star model: Z370-A PRO (MS-7B48) v: 1.0 serial: <superuser/root required>
           UEFI: American Megatrends v: 2.40 date: 03/08/2018
CPU:       Topology: 6-Core model: Intel Core i7-8700 bits: 64 type: MT MCP L2 cache: 12.0 MiB
           Speed: 800 MHz min/max: 800/4600 MHz Core speeds (MHz): 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 800
           9: 800 10: 800 11: 800 12: 800
Graphics:  Device-1: NVIDIA TU106 [GeForce RTX 2070] driver: N/A
           Display: server: X.org 1.20.9 driver: fbdev,nouveau unloaded: modesetting,vesa tty: 181x44
           Message: Advanced graphics data unavailable in console. Try -G --display
Audio:     Device-1: Intel 200 Series PCH HD Audio driver: snd_hda_intel
           Device-2: NVIDIA TU106 High Definition Audio driver: snd_hda_intel
           Sound Server: ALSA v: k5.4.0-65-generic
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169
           IF: enp3s0 state: down mac: 30:9c:23:d0:bb:05
           Device-2: TP-Link TL-WN722N v2 type: USB driver: rtl8812au
           IF: enx503eaa4de20b state: up speed: N/A duplex: N/A mac: 50:3e:aa:4d:e2:0b
           IF-ID-1: docker0 state: down mac: 02:42:f8:2b:a8:df
Drives:    Local Storage: total: 465.76 GiB used: 255.67 GiB (54.9%)
           ID-1: /dev/nvme0n1 vendor: Samsung model: SSD 970 EVO 500GB size: 465.76 GiB
Partition: ID-1: / size: 456.96 GiB used: 255.66 GiB (55.9%) fs: ext4 dev: /dev/nvme0n1p2
Sensors:   System Temperatures: cpu: 35.0 C mobo: N/A
           Fan Speeds (RPM): N/A
Info:      Processes: 416 Uptime: 5m Memory: 31.32 GiB used: 1.60 GiB (5.1%) Init: systemd runlevel: 5 Shell: bash
           inxi: 3.0.38

更新:设法安装了一些 nvidia 驱动程序,现在显示器可以工作,但分辨率太低。

一些新组合出现了严重问题。我该如何恢复到以前的状态?太多可移动部件了。

更新:

sudo gpu-manager 
last_boot_file: /var/lib/ubuntu-drivers-common/last_gfx_boot
new_boot_file: /var/lib/ubuntu-drivers-common/last_gfx_boot
can't access /run/u-d-c-nvidia-was-loaded file
can't access /opt/amdgpu-pro/bin/amdgpu-pro-px
Looking for nvidia modules in /lib/modules/5.4.0-65-generic/updates/dkms
Looking for amdgpu modules in /lib/modules/5.4.0-65-generic/updates/dkms
Is nvidia loaded? no
Was nvidia unloaded? no
Is nvidia blacklisted? no
Is intel loaded? no
Is radeon loaded? no
Is radeon blacklisted? no
Is amdgpu loaded? no
Is amdgpu blacklisted? no
Is amdgpu versioned? no
Is amdgpu pro stack? no
Is nouveau loaded? no
Is nouveau blacklisted? yes
Is nvidia kernel module available? no
Is amdgpu kernel module available? no
Vendor/Device Id: 10de:1f02
BusID "PCI:1@0:0:0"
Is boot vga? yes
Error: can't access /sys/bus/pci/devices/0000:01:00.0/driver
The device is not bound to any driver.
Error : Failed to open /dev/dri
Error : Failed to open /dev/dri
Error : Failed to open /dev/dri
Error : Failed to open /dev/dri
Does it require offloading? no
last cards number = 1
Has amd? no
Has intel? no
Has nvidia? yes
How many cards? 1
Has the system changed? No
Single card detected
Nothing to do

想知道这是否相关:Nvidia-173 驱动程序包附带错误且无用的 nvidia-settings 应用程序

答案1

以下似乎有效。也许 nvidia 驱动程序 460 不适用于 Ubuntu 18.04 中的 5.4.0-64 内核

sudo apt-get purge '*nvidia*' -y
sudo apt-get autoremove -y
sudo apt list --installed | grep nvidia
sudo ppa-purge ppa:graphics-drivers/ppa
sudo apt auto-clean
sudo apt install gcc-8
sudo update-alternatives --remove-all gcc
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 10
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-8 10
sudo apt-get install --reinstall linux-headers-$(uname -r)
sudo apt-get install nvidia-driver-460
# reboot

一定要看看

dpkg --list | grep nvidia

对于任何奇怪的版本分歧,nvidia-settings 在所有情况下都以某种方式固定在 460。

相关内容