欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

【Ubuntu 18.04 LTS】NVIDIA-SMI has failed because it couldn‘t communicate with the NVIDIA driver.

程序员文章站 2022-07-15 09:40:08
...

【Ubuntu 18.04 LTS】NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver.

前言

末日,起床之后,突然发现我的Ubuntu 18.04没有了调节屏幕亮度的条条,也就是下面这个Screen Brightness,本来我的这个系统每次开机就会把亮度调到最大,这已经很气人了,可现在居然连亮度都没法调了,其的我都不打一处来。
【Ubuntu 18.04 LTS】NVIDIA-SMI has failed because it couldn‘t communicate with the NVIDIA driver.

1.问题查找

我的笔记本是没有集显的,9900KF+2080,所以我感觉,大概率和显卡有关,切换到Windows发现显卡工作正常,那这应该就是显卡驱动的问题了。终端输入:

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.

显卡驱动八成是出了问题了,重装一下试试。

2.卸载现有显卡驱动

终端执行:

sudo apt-get remove --purge nvidia*

3.英伟达官网下载显卡驱动

4.安装

给驱动软件安装包赋可执行权限:

sudo chmod a+x NVIDIA-Linux-x86_64-440.100.run

安装:

sudo ./NVIDIA-Linux-x86_64-440.100.run -no-x-check -no-nouveau-check -no-opengl-files

安装过程中的选项:(这是copy别人的,自己的没记住,我也是尝试选择了好多遍才安装好)
The distribution-provided pre-install script failed! Are you sure you want to continue? 选择 yes 继续。
Would you like to register the kernel module souces with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later? 选择 No 继续。
问题没记住,选项是:install without signing
问题大概是:Nvidia’s 32-bit compatibility libraries? 选择 No 继续。
Would you like to run the nvidia-xconfigutility to automatically update your x configuration so that the NVIDIA x driver will be used when you restart x? Any pre-existing x confile will be backed up. 选择 Yes 继续

5. 挂载显卡驱动:

终端执行:

modprobe nvidia

6.检查一下:

nvidia-smi

终于又回来了:

aaa@qq.com:~$ nvidia-smi
Sun Aug  9 14:10:11 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.100      Driver Version: 440.100      CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce RTX 2080    Off  | 00000000:01:00.0  On |                  N/A |
| N/A   45C    P8    11W /  N/A |    507MiB /  7973MiB |      2%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1483      G   /usr/lib/xorg/Xorg                            18MiB |
|    0      1632      G   /usr/bin/gnome-shell                          57MiB |
|    0      2067      G   /usr/lib/xorg/Xorg                           154MiB |
|    0      2202      G   /usr/bin/gnome-shell                         132MiB |
|    0      3146      G   ...AAAAAAAAAAAACAAAAAAAAAA= --shared-files   140MiB |
+-----------------------------------------------------------------------------+