Linux重装显卡驱动

参照:https://blog.csdn.net/wtlll/article/details/115998058
1、删除原有驱动:

sudo apt-get remove --purge nvidia*


2、关闭nouveau:

echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf


3、重启服务器:

sudo shutdown -r now


4、重启后重连服务器并进入root权限
5、下载新驱动并将下载好的新驱动放在对应服务器的任意目录下(一般不需要):
网址:https://www.nvidia.cn/Download/index.aspx?lang=cn
按照GPU型号选择(以00为例):


6、验证nouveau是否已禁用:

lsmod | grep nouveau

(没有信息显示,说明nouveau已被禁用,接下来可以安装nvidia的显卡驱动)
7、获取Kernel source:
① sudo apt-get install linux-source
② 通过uname -r查看相应版本号(系统内核版本):目前是5.4.0-122
③ 输入:sudo apt-get install linux-headers-x.x.x-x-generic(x.x.x-x用版本号替换)
即sudo apt-get install linux-headers-5.4.0-122-generic
8、安装NVIDIA驱动:
① 关闭图形界面,不执行会出错:sudo service lightdm stop
② 给驱动run文件赋予执行权限: sudo chmod 777 NV然后按Tab键会自动补全
即chmod 777 NVIDIA-Linux-x86_64-515.65.01.run
③ 安装:sudo ./NV然后按Tab键会自动补全后再输入-no-x-check -no-nouveau-check -no-opengl-files 即:

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


④ 接下来安装过程中的选项:
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 youinstall a different kernel later? 
选择 No 继续。
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 继续
9、验证是否安装成功:nvidia-smi或gpustat

猜你喜欢

转载自blog.csdn.net/qq_42019881/article/details/131457651