![尝试安装 nvidia 驱动程序时出现:E:无法纠正问题,您持有损坏的软件包](https://linux22.com/image/925803/%E5%B0%9D%E8%AF%95%E5%AE%89%E8%A3%85%20nvidia%20%E9%A9%B1%E5%8A%A8%E7%A8%8B%E5%BA%8F%E6%97%B6%E5%87%BA%E7%8E%B0%EF%BC%9AE%EF%BC%9A%E6%97%A0%E6%B3%95%E7%BA%A0%E6%AD%A3%E9%97%AE%E9%A2%98%EF%BC%8C%E6%82%A8%E6%8C%81%E6%9C%89%E6%8D%9F%E5%9D%8F%E7%9A%84%E8%BD%AF%E4%BB%B6%E5%8C%85.png)
我已经清除了 ubuntu 18.04 上所有与 nvidia 相关的驱动程序和依赖项。但是,在重新安装驱动程序时,运行时出现以下错误:sudo ubuntu-drivers autoinstall
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
nvidia-driver-440 : Depends: libnvidia-compute-440 (= 440.59-0ubuntu0.18.04.1) but 440.82-0ubuntu0~0.18.04.2 is to be installed
Depends: libnvidia-decode-440 (= 440.59-0ubuntu0.18.04.1) but it is not going to be installed
Depends: libnvidia-encode-440 (= 440.59-0ubuntu0.18.04.1) but it is not going to be installed
Recommends: nvidia-settings but it is not going to be installed
Recommends: nvidia-prime (>= 0.8) but it is not going to be installed
Recommends: libnvidia-compute-440:i386 (= 440.59-0ubuntu0.18.04.1)
Recommends: libnvidia-decode-440:i386 (= 440.59-0ubuntu0.18.04.1)
Recommends: libnvidia-encode-440:i386 (= 440.59-0ubuntu0.18.04.1)
Recommends: libnvidia-ifr1-440:i386 (= 440.59-0ubuntu0.18.04.1)
Recommends: libnvidia-fbc1-440:i386 (= 440.59-0ubuntu0.18.04.1)
Recommends: libnvidia-gl-440:i386 (= 440.59-0ubuntu0.18.04.1)
E: Unable to correct problems, you have held broken packages.
有办法修复这个问题吗?谢谢。
我认为这可能会有帮助:
$dpkg -l | grep -i nvidia
rc cuda-nvtx-10-1 10.1.243-1 amd64 NVIDIA Tools Extension
rc libnvidia-compute-435:amd64 435.21-0ubuntu0.18.04.2 amd64 NVIDIA libcompute package
ii libnvidia-compute-440:amd64 440.82-0ubuntu0~0.18.04.2 amd64 NVIDIA libcompute package
这些是我的附加存储库:
答案1
我遇到了同样的问题,我通过尝试直接安装依赖项解决了这个问题。我从顶部开始,一直到找到可以安装的依赖项。
以下是我所拥有的:
nvidia-driver-440 : Depends: libnvidia-gl-440 (= 440.82-0ubuntu0~0.18.04.2) but it is not going to be installed
Depends: nvidia-kernel-source-440 (= 440.82-0ubuntu0~0.18.04.2) but it is not going to be installed
Depends: libnvidia-decode-440 (= 440.82-0ubuntu0~0.18.04.2) but it is not going to be installed
Depends: libnvidia-encode-440 (= 440.82-0ubuntu0~0.18.04.2) but it is not going to be installed
Depends: nvidia-utils-440 (= 440.82-0ubuntu0~0.18.04.2) but it is not going to be installed
Depends: xserver-xorg-video-nvidia-440 (= 440.82-0ubuntu0~0.18.04.2) but it is not going to be installed
Depends: libnvidia-cfg1-440 (= 440.82-0ubuntu0~0.18.04.2) but it is not going to be installed
Depends: libnvidia-ifr1-440 (= 440.82-0ubuntu0~0.18.04.2) but it is not going to be installed
Recommends: libnvidia-decode-440:i386 (= 440.82-0ubuntu0~0.18.04.2)
Recommends: libnvidia-encode-440:i386 (= 440.82-0ubuntu0~0.18.04.2)
Recommends: libnvidia-ifr1-440:i386 (= 440.82-0ubuntu0~0.18.04.2)
Recommends: libnvidia-fbc1-440:i386 (= 440.82-0ubuntu0~0.18.04.2)
Recommends: libnvidia-gl-440:i386 (= 440.82-0ubuntu0~0.18.04.2)
E: Unable to correct problems, you have held broken packages.
首先我尝试安装libnvidia-gl-440
(列表中的第一个项目):
sudo apt install libnvidia-gl-440
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libnvidia-gl-440 : Depends: libnvidia-compute-440 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
这失败了,但只libnvidia-compute-440
列出了一个依赖项。
安装libnvidia-compute-440
:
sudo apt install libnvidia-compute-440
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libnvidia-cfg1-390 libnvidia-common-390 libnvidia-fbc1-390 libnvidia-fbc1-390:i386 libnvidia-gl-390 libnvidia-gl-390:i386 libnvidia-ifr1-390 libnvidia-ifr1-390:i386 libwayland-client0:i386
libwayland-server0:i386 nvidia-dkms-390 nvidia-kernel-common-390 nvidia-kernel-source-390 nvidia-prime nvidia-settings postgresql-client-9.3 screen-resolution-extra xserver-xorg-video-nvidia-390
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
libcuda1-361 libcuda1-367 libcuda1-375 libcuda1-384 libnvidia-compute-390 libnvidia-compute-390:i386 libnvidia-decode-390 libnvidia-decode-390:i386 libnvidia-encode-390 libnvidia-encode-390:i386
nvidia-352 nvidia-361 nvidia-367 nvidia-375 nvidia-384 nvidia-compute-utils-390 nvidia-driver-390 nvidia-headless-390 nvidia-headless-no-dkms-390 nvidia-opencl-icd-361 nvidia-opencl-icd-367
nvidia-opencl-icd-375 nvidia-opencl-icd-384 nvidia-utils-390
The following NEW packages will be installed:
libnvidia-compute-440
0 upgraded, 1 newly installed, 24 to remove and 0 not upgraded.
Need to get 20.9 MB of archives.
After this operation, 73.4 MB disk space will be freed.
这个被接受了。安装完成后,我重试了libnvidia-gl-440
,然后nvidia-driver-440
两个都被接受了,没有任何问题。
因此,只需逐步检查每个依赖项并遵循它们的依赖关系。
答案2
删除 cuda repos 存储库。它很可能会破坏依赖关系。
nvidia-driver-440
该 repo 中的包需要错误的依赖项。