Ubuntu20.04开机黑屏左上角光标闪烁,以及移除Nvidia驱动后造成的无法启动docker容器问题Error response from daemon: could not select device driver "" with capabilities: [[gpu]]

  • Ubuntu20.04开机黑屏左上角光标闪烁,以及移除Nvidia驱动后造成的无法启动docker容器问题Error response from daemon: could not select device driver "" with capabilities: [[gpu]]已关闭评论
  • 38 次浏览
  • A+
所属分类:linux技术
摘要

  这几天系统更新,显卡驱动由525.147.05升级到了535.171.04(tested),终端运行watch -n 1 nvidia-smi 实时显示显卡占用情况时,偶尔出现 Failed to initialize NVML: Driver/library version mismatch 问题, 于是将驱动切换成open kernal版本,重启后黑屏左上角光标闪烁,于是尝试使用命令行移除open kernal 版本

 

 

这几天系统更新,显卡驱动由525.147.05升级到了535.171.04(tested),终端运行watch -n 1 nvidia-smi 实时显示显卡占用情况时,偶尔出现 Failed to initialize NVML: Driver/library version mismatch 问题,于是将驱动切换成open kernal版本,重启后黑屏左上角光标闪烁,于是尝试使用命令行移除open kernal 版本

1、首先 Ctrl+Alt+F2 切到命令行,输入usrname,password登录

2、然后移除当前的nvidia驱动,并更新一下

sudo apt-get purge nvidia*
sudo apt-get update

3、reboot 重启电脑,这时系统使用默认自带的驱动,然后打开Software & Updates, 从Additional Drivers再切换到之前的535(tested)版本。

可是前面的移除驱动操作导致docker无法启动容器了,这是因为NVIDIA Container Toolkit 被卸载了,所以命令行切换显卡驱动不建议使用上面方法,可以使用其他非移除的方式来切换驱动。

解决当前无法启动docker容器问题,查看一下,输入   ls -al /usr/bin/nvidia-container*  ,可以看见仅有一行

Ubuntu20.04开机黑屏左上角光标闪烁,以及移除Nvidia驱动后造成的无法启动docker容器问题Error response from daemon: could not select device driver "" with capabilities: [[gpu]]

4、尝试重新安装NVIDIA Container Toolkit, 出错:Could not handshake: Error in the pull function

Ubuntu20.04开机黑屏左上角光标闪烁,以及移除Nvidia驱动后造成的无法启动docker容器问题Error response from daemon: could not select device driver "" with capabilities: [[gpu]]

5、尝试直接在NVIDIA github下载 deb包,下载错误提示中的版本有关的6个包, https://github.com/NVIDIA/libnvidia-container/tree/gh-pages/stable/ubuntu18.04/amd64

(1)libnvidia-container1_1.13.5-1_amd64.deb

(2)libnvidia-container-tools_1.13.5-1_amd64.deb

(3)nvidia-container-toolkit-base_1.13.5-1_amd64.deb

(4)nvidia-container-toolkit_1.13.5-1_amd64.deb

(5)nvidia-docker2_2.13.0-1_all.deb

(6)nvidia-container-runtime_3.13.0-1_all.deb

6、按顺序依次安装

Ubuntu20.04开机黑屏左上角光标闪烁,以及移除Nvidia驱动后造成的无法启动docker容器问题Error response from daemon: could not select device driver "" with capabilities: [[gpu]]

Ubuntu20.04开机黑屏左上角光标闪烁,以及移除Nvidia驱动后造成的无法启动docker容器问题Error response from daemon: could not select device driver "" with capabilities: [[gpu]]

安装无误后更新一下

Ubuntu20.04开机黑屏左上角光标闪烁,以及移除Nvidia驱动后造成的无法启动docker容器问题Error response from daemon: could not select device driver "" with capabilities: [[gpu]]

最后重启docker

Ubuntu20.04开机黑屏左上角光标闪烁,以及移除Nvidia驱动后造成的无法启动docker容器问题Error response from daemon: could not select device driver "" with capabilities: [[gpu]]

再次查看,出现了nvidia-container-toolkit

Ubuntu20.04开机黑屏左上角光标闪烁,以及移除Nvidia驱动后造成的无法启动docker容器问题Error response from daemon: could not select device driver "" with capabilities: [[gpu]]

OK,容器可以启动了,问题解决。

 

 

Enjoy it!