最近想着更新到最新的cuda11,不想重装系统,就约摸着能不能更新一下显卡驱动,当然linux系统的显卡驱动不像windows那样,点点点就行了,需要做一些配置,现在将更新过程记录如下。
因为我之前就安装了nvidia的闭源驱动,所以不用禁用nouveau,使用开源方案的同学需要先禁用nouveau :
sudo gedit /etc/modprobe.d/blacklist-nouveau.conf
deepin用的是dde桌面,使用的是dedit,ubuntu用的是gedit,之后使用同样的方法可以更新独显驱动,首先修改配置文件:
blacklist nouveau
options nouveau modeset=0
执行:
sudo update-initramfs -u #刷新内核
重启后使用下面这个命令验证是否禁用成功(无输出即为成功)
lsmod | grep nouveau
sudo apt-get remove --purge nvidia*
安装的是老版本Nvidia官网驱动的可以不用卸载,直接安装新驱动会覆盖老驱动,如果这一步出现了问题或者安装完新驱动之后有问题的可以尝试下面两种方式卸载
sudo apt-get remove nvidia-driver nvidia-kernel-dkms glx-alternative-nvidia
或者
sudo nvidia-uninstall
sudo nvidia-installer --uninstall
重启,或者注销系统进入登录界面,使用 Ctrl + Alt + F2进入控制台界面,用用户名和密码登录.
sudo service lightdm stop
sudo service gdm stop
sudo service gdm3 stop
也可以使用这个命令
sudo telinit 3
sudo chmod a+x NVIDIA-Linux-x86_64-450.51.05.run(名字和安装包一致)
sudo sh ./NVIDIA-Linux-x86_64-450.51.05.run
进入nvidia显卡驱动安装界面,如果报错x server说明未关闭图形界面。根据提示选择需要的安装。
之后重启查看驱动版本
此时显卡驱动已更新成功,这样我们就可以愉快地安装最新的CUDA11了。
An NVIDIA kernel module 'nvidia-drm' appears to already be loaded in your kernel. This may be because it is in use (for example, by an X server, a CUDA program, or the NVIDIA Persistence Daemon), but this may also happen if your kernel was configured without support for module unloading. Please be sure to exit any programs that may be using the GPU(s) before attempting to upgrade your driver. If no GPU-based programs are running, you know that your kernel supports module unloading, and you still receive this message, then an error may have occured that has corrupted an NVIDIA kernel module's usage count, for which the simplest remedy is to reboot your computer.
解决方式:关闭所有装置,并停止载入NVIDIA驱动程序:
sudo systemctl isolate multi-user.target
sudo modprobe -r nvidia-drm
参考来源:https://zhuanlan.zhihu.com/p/135875408