重装显卡驱动,解决NVIDIA-SMI has failed问题

服务器的硬盘被热拔插了一次,虽然看起来没啥大问题,但是

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.

没办法,重装显卡驱动吧,参考 ubuntu16.04 重装显卡驱动(亲测有效)

ssh连接,进入root用户后

先卸载旧的驱动

apt-get remove nvidia-*
apt-get autoremove  (加上才能卸载干净原驱动)

下载驱动文件

大家需要在win下进入Nvidia官网下载 

根据显卡型号选择需要的驱动

实验室用的3090,所以选择3090的驱动

点击search,进入下载界面

右击下载,复制下载链接

进入命令行

wget https://www.nvidia.cn/content/DriverDownload-March2009/confirmation.php?url=/XFree86/Linux-x86_64/455.23.04/NVIDIA-Linux-x86_64-455.23.04.run&lang=cn&type=GeForce

赋上执行权限

chmod +x NVIDIA-Linux-x86_64-455.23.04.run

按他的资料里应该使用

service lightdm stop

关闭显示服务,lightdm是什么意思 LightDM is thedisplay manager running in Ubuntu. It starts the X servers, user sessions and greeter (login screen)。也就是说lightdm负责显示管理,现在我们要安装(更新)显卡驱动,等于说是在人家身上动刀子,所以先让它"睡一觉"

但是,大概因为我服务器上没接显示器。。。所以出现了

Failed to stop lightdm.service: Unit lightdm.service not loaded.

不管了,直接下一步

在驱动所在目录下执行

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

以下三个最好加上,否则还是可能循环登录
    -no-x-check安装驱动时关闭x服务;
    -no-nouveau-check 安装驱动时禁用Nouveau
    -no-opengl-files 安装时只装驱动文件,不安装Opengl

根据提示进行选择

这里注意三点

1、白色为选中,不是红色

2、Would you like to run the nvidia-xconfig utility to automatically update your X Configuration file so set the NVIDIA X driver will be used when you restart X?
建议选No,不要自动更新

3、如果提示了装32-Bit的库

选择No,我们是64位的Ubuntu

安装结束,我们没有接显示器

service lightdm restart(将自动跳转到桌面)

这个也用不上了

查看驱动是否安装成功

nvidia-smi

4张3090,真香!!

猜你喜欢

转载自blog.csdn.net/weixin_39518984/article/details/111867578
今日推荐