如何修复 nvidia 驱动程序以使其工作?

如何修复 nvidia 驱动程序以使其工作?

打开 nvidia 设置时出现以下错误:

$ sudo nvidia-smi
ERROR: Unable to load info from any available system
(nvidia-settings:7395): GLib-GObject-CRITICAL **: 19:20:22.799: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
** Message: 19:20:22.801: PRIME: Requires offloading
** Message: 19:20:22.801: PRIME: is it supported? yes
** Message: 19:20:22.837: PRIME: Usage: /usr/bin/prime-select nvidia|intel|on-demand|query
** Message: 19:20:22.837: PRIME: on-demand mode: "1"
** Message: 19:20:22.837: PRIME: is "on-demand" mode supported? yes

在打开的弹出窗口中选择“NVIDIA On-Demand”选项

以下是一些系统信息

$ uname -a
Linux legion 5.4.0-135-generic #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.5 LTS
Release:    20.04
Codename:   focal

$ echo $XDG_SESSION_TYPE
x11

$ mokutil --sb-state
EFI variables are not supported on this system

$ test -d /sys/firmware/efi && echo efi || echo "Legacy(bios)"
Legacy(bios)

$ dkms status
nvidia, 515.86.01, 5.4.0-135-generic, x86_64: installed

$ lsmod | grep nvidia
nvidia_uvm           1163264  0
nvidia_drm             61440  0
nvidia_modeset       1146880  1 nvidia_drm
nvidia              40820736  11 nvidia_uvm,nvidia_modeset
drm_kms_helper        184320  2 nvidia_drm,i915
drm                   495616  15 drm_kms_helper,nvidia,nvidia_drm,i915


$ sudo lshw -c video
  *-display                 
       description: VGA compatible controller
       product: GP106M [GeForce GTX 1060 Mobile]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: irq:138 memory:a3000000-a3ffffff memory:90000000-9fffffff memory:a0000000-a1ffffff ioport:4000(size=128) memory:a4080000-a40fffff
  *-display
       description: VGA compatible controller
       product: HD Graphics 630
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 04
       width: 64 bits
       clock: 33MHz
       capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:135 memory:a2000000-a2ffffff memory:b0000000-bfffffff ioport:5000(size=64) memory:c0000-dffff

$ lspci -k | grep -A 2 -E "(VGA|3D)"
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
    Subsystem: Lenovo HD Graphics 630
    Kernel driver in use: i915
--
01:00.0 VGA compatible controller: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile] (rev a1)
    Subsystem: Lenovo GeForce GTX 1060 Max-Q 3GB
    Kernel driver in use: nvidia

$ nvidia-smi
Mon Dec 19 19:23:22 2022       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.86.01    Driver Version: 515.86.01    CUDA Version: 11.7     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   42C    P8     4W /  N/A |      2MiB /  3072MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

尝试重新安装 nvidia-driver-460 - 没有帮助。

另一个症状 - VLC 也停止工作(通过终端打开并尝试播放 mkv/mp4)

$ vlc
VLC media player 3.0.9.2 Vetinari (revision 3.0.9.2-0-gd4c1aefe4d)
[00005591dce9a670] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[00005591dcf38080] main playlist: playlist is empty
[00005591dcf6ef00] main audio output error: too low audio sample frequency (0)
[00007f8954d05160] main decoder error: failed to create audio output
[00005591dcf6ef00] vlcpulse audio output error: digital pass-through stream connection failure: Not supported
[00005591dcf6ef00] main audio output error: module not functional
[00007f8954d05160] main decoder error: failed to create audio output
libva info: VA-API version 1.7.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0
Killed

但是 Parole media Player 可以正常工作,ffmpeg 也可以正常工作

答案1

  1. 假设您没有使用从 nvidia 网页下载的任何东西(通过运行带有附加 <space> 的安装程序来删除任何此类内容--uninstall
  2. 按下 Win 键,开始输入software,然后会出现一个粉红色的图标;单击它。
  3. 查找Additional drivers(顶部的标签)并单击它。
  4. 应该有一组可用的 nvidia 驱动程序版本。在未选择的版本左侧打勾。
  5. 等待它完成,然后重新启动并查看是否运行良好。

现在注意(1):我认为改变驱动程序确实会清除之前的内容。如果没有,则需要手动清除。直到您全部删除后,
才能完成此操作。PACKAGENAME 至少是第二列中的一项 ...即仍安装的 nvidia 软件包。$ sudo apt purge PACKAGENAME

dpkg --list | grep -E '^ii.*nvidia.*'

笔记2): $ nvidia-smi通常不需要sudo(?)

相关内容