起因是发现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.
然后以为把驱动卸载掉重新装一下就行了。
sudo apt-get remove --purge nvidia* //卸载原有显卡驱动
sudo apt install nvidia-driver-550 //根据自己的需要安装特定版本的显卡驱动
但是无论是卸载还是安装都失败了,报错:
Loading new nvidia-550.54.14 DKMS files...
Building for 5.15.0-113-generic
Building for architecture x86_64
Building initial module for 5.15.0-113-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/nvidia-kernel-source-550.0.crash'
Error! Bad return status for module build on kernel: 5.15.0-113-generic (x86_64)
Consult /var/lib/dkms/nvidia/550.54.14/build/make.log for more information.
dpkg: 处理软件包 nvidia-dkms-550 (--configure)时出错:
已安装 nvidia-dkms-550 软件包 post-installation 脚本 子进程返回错误状态 10
dpkg: 依赖关系问题使得 nvidia-driver-550 的配置工作不能继续:
nvidia-driver-550 依赖于 nvidia-dkms-550 (<= 550.54.14-1);然而:
软件包 nvidia-dkms-550 尚未配置。
nvidia-driver-550 依赖于 nvidia-dkms-550 (>= 550.54.14);然而:
软件包 nvidia-dkms-550 尚未配置。
dpkg: 处理软件包 nvidia-driver-550 (--configure)时出错:
依赖关系问题 - 仍未被配置
因为错误消息指示这是由于上一个问题导致的错误,没有写入 apport 报告。
正在处理用于 initramfs-tools (0.136ubuntu6.7) 的触发器 ...
update-initramfs: Generating /boot/initrd.img-5.15.0-113-generic
I: The initramfs will attempt to resume from /dev/nvme0n1p2
I: (UUID=3993b239-0f78-49e6-a4a3-ef842762172c)
I: Set the RESUME variable to override this.
在处理时有错误发生:
nvidia-dkms-550
nvidia-driver-550
E: Sub-process /usr/bin/dpkg returned an error code (1)
每次报错都有关键词“依赖关系问题“,上网查到说要把gcc升级到12
不过我没升级到12,试试把gcc版本升高,从6升到9
sudo update-alternatives --config gcc //配置不同版本gcc
查看当前gcc版本:
gcc -v
然后再安装驱动,成功!
标签:Ubuntu20.04,gcc,卸载,driver,550,5.15,nvidia,显卡,dkms From: https://blog.csdn.net/weixin_43370319/article/details/140122813