如何删除冲突的 NVIDIA 包和未满足的依赖项?

如何删除冲突的 NVIDIA 包和未满足的依赖项?

我的 ubuntu 中有一个与 libnvidia 软件包有关的问题。我想可能是安装了 2 个不同的驱动程序?

我尝试了几个故障排除步骤,例如

sudo dpkg --configure -a

sudo apt-get install -f

sudo apt remove libnvidia-compute-440

sudo apt-get remove --purge '^nvidia-.*'

sudo apt autoremove

sudo rm /var/cache/apt/archives/libnvidia-compute-440_440.118.02-0ubuntu1_amd64.deb

这是错误

sudo apt-get upgrade

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies.
 libnvidia-decode-440 : Depends: libnvidia-compute-440 (= 440.118.02-0ubuntu1) but 440.100-0ubuntu0.18.04.1 is installed
 nvidia-driver-440 : Depends: libnvidia-compute-440 (= 440.118.02-0ubuntu1) but 440.100-0ubuntu0.18.04.1 is installed
                     Recommends: libnvidia-compute-440:i386 (= 440.118.02-0ubuntu1)
                     Recommends: libnvidia-decode-440:i386 (= 440.118.02-0ubuntu1)
                     Recommends: libnvidia-encode-440:i386 (= 440.118.02-0ubuntu1)
                     Recommends: libnvidia-ifr1-440:i386 (= 440.118.02-0ubuntu1)
                     Recommends: libnvidia-fbc1-440:i386 (= 440.118.02-0ubuntu1)
                     Recommends: libnvidia-gl-440:i386 (= 440.118.02-0ubuntu1)

看来我需要删除440.100-0ubuntu0.18.04.1。对吗?我该怎么做?

答案1

我遇到了同样的问题,并通过清除所有未满足的依赖项解决了这个问题。以下是我的步骤:

1.检查nvidia相关的依赖项

$ dpkg -l | grep nvidia
ii  libnvidia-cfg1-440:amd64                           440.118.02-0ubuntu1                              amd64        NVIDIA binary OpenGL/GLX configuration library
ii  libnvidia-common-418                               418.165.02-0ubuntu1                              all          Shared files used by the NVIDIA libraries
ii  libnvidia-common-440                               440.118.02-0ubuntu1                              all          Shared files used by the NVIDIA libraries
ii  libnvidia-common-455                               455.32.00-0ubuntu1                               
...

2. 尝试清除第一个包

$ sudo apt purge libnvidia-cfg1-440:amd64
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libnvidia-decode-440 : Depends: libnvidia-compute-440 (= 440.118.02-0ubuntu1) but 440.100-0ubuntu0.18.04.1 is to be installed
 nvidia-driver-440 : Depends: libnvidia-compute-440 (= 440.118.02-0ubuntu1) but 440.100-0ubuntu0.18.04.1 is to be installed
                     Depends: libnvidia-cfg1-440 (= 440.118.02-0ubuntu1) but it is not going to be installed
                     Recommends: libnvidia-compute-440:i386 (= 440.118.02-0ubuntu1)
                     Recommends: libnvidia-decode-440:i386 (= 440.118.02-0ubuntu1)
                     Recommends: libnvidia-encode-440:i386 (= 440.118.02-0ubuntu1)
                     Recommends: libnvidia-ifr1-440:i386 (= 440.118.02-0ubuntu1)
                     Recommends: libnvidia-fbc1-440:i386 (= 440.118.02-0ubuntu1)
                     Recommends: libnvidia-gl-440:i386 (= 440.118.02-0ubuntu1)
 xserver-xorg-video-nvidia-440 : Depends: libnvidia-cfg1-440 (= 440.118.02-0ubuntu1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

(或与上述类似的错误信息)

3. 添加具有未满足依赖关系的已清除包

libnvidia-decode-440错误消息,并尝试删除该包,

$ sudo apt purge libnvidia-decode-440
...skipped same message
The following packages have unmet dependencies:
 cuda-drivers : Depends: libnvidia-decode-440 (>= 440.64.00) but it is not going to be installed
 libnvidia-encode-440 : Depends: libnvidia-decode-440 but it is not going to be installed
 nvidia-driver-440 : Depends: libnvidia-compute-440 (= 440.118.02-0ubuntu1) but 440.100-0ubuntu0.18.04.1 is to be installed
                     Depends: libnvidia-decode-440 (= 440.118.02-0ubuntu1) but it is not 
...skipped same message

错误消息中未满足的依赖项已更改libnvidia-encode-440,因此尝试了两个包,

$ sudo apt purge libnvidia-encode-440 libnvidia-decode-440
...
The following packages have unmet dependencies:
 cuda-drivers : Depends: libnvidia-decode-440 (>= 440.64.00) but it is not going to be installed
                Depends: libnvidia-encode-440 (>= 440.64.00) but it is not going to be installed
 nvidia-driver-440 : Depends: libnvidia-compute-440 (= 440.118.02-0ubuntu1) but 440.100-0ubuntu0.18.04.1 is to be installed
                     Depends: libnvidia-decode-440 (= 440.118.02-0ubuntu1) but it is not going to be installed
                     Depends: libnvidia-encode-440 (= 440.118.02-0ubuntu1) but it is not going to be installed
...

似乎libnvidia-encode-440 libnvidia-decode-440已经解决了。所以我继续尝试修复所有未满足的依赖项,就像这个步骤一样。所以我的最终命令是

$ sudo apt purge -f libnvidia-encode-440 libnvidia-decode-440 cuda-drivers nvidia-driver-440 cuda-runtime-10-1 cuda-10-1 cuda-demo-suite-10-1

并且成功了。删除 nvidia 和 cuda 包后,我重新安装了 gpu 驱动程序...

祝你好运!

相关内容