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

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the lat

程序员文章站 2022-03-05 12:58:53
...

Ubuntu18.04的系统,使用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.

重启了之后还是这样!!!

 

经过查找资料和实践验证,最后确定是:

是内核版本太高的问题,然后修改默认开机启动的内核版本;或者进入 grub菜单 ,选择advance option for Ubuntu查看子菜单  选择要进入的内核版;

 

一、问题描述:

Ubuntu18.04下已经成功搭建好了pycharm环境(包括cuda、NVIDIA驱动、cudnn、tensorflow-gpu等都已经安装成功了),并且测试程序已经通过。而且已经使用有一段时间了。但是突然有一天电脑一步一停真有型,一秒一卡好潇洒

然后,我执行了nvidia-smi 命令,出错:

$ 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.

 

(注:出现这种情况之前,系统有弹出窗口询问是否更新,具体更新什么忘记了,我直接关闭了该提示窗口。然后等下一次开机后就出现了该情况。)

 

二、解决问题过程:

https://blog.csdn.net/sinat_23619409/article/details/85220561

本人电脑win7+ubuntu18.04双系统

默认是启动Ubuntu

 

1、开机进入grub界面,选择默认选项Ubuntu,进入系统。

执行:

uname -a

nvidia-smi

结果如下:

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the lat

NVIDIA驱动出错:

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、开机进入grub引导界面,选择Advanced options for Ubuntu:

 

Ubuntu
Advanced options for Ubuntu
Windows 7 (loader) (on /dev/sda1)
system setup

挨个试之前的旧内核,进入系统验证nvidia-smi指令是否执行正确。

成功的话会出现如下图所示的显卡使用信息:

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the lat

记住此时进入的是哪个内核(可通过uname -a查看),在Advanced opetions for Ubuntu里面是第几项

 

3、问题总结:

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驱动是在低版本的时候安装,由于系统更新,内核版本升级导致NVIDIA无法应用在高内核版本

所以,说明是内核版本的问题,选择低版本的内核即可。

本人亲测可行!!!

 

4、修改Ubuntu默认开机启动的内核版本

http://forum.ubuntu.org.cn/viewtopic.php?t=486436

终端执行:

sudo gedit /etc/default/grub

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the lat

GRUB_DEFAULT=0

修改为:

GRUB_DEFAULT="1> 3"

(注:1 代表主菜单的第二项Advanced options for Ubuntu;3代表1项目下面对应的子菜单里面的第4项;注意>和3之间有空格)

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the lat

修改后保存退出,执行:

sudo update-grub

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the lat

重新启动,现在应该默认启动旧的内核版本。

查看内核版本

$ uname -r
4.15.0-42-generic

 

 

参考链接:

https://blog.csdn.net/weixin_42084747/article/details/84371079

http://forum.ubuntu.org.cn/viewtopic.php?t=486436 

http://s1nh.org/post/littlebug/

https://www.cnblogs.com/feifanrensheng/p/9974249.html