尝试安装 cuda 后 apt 崩溃

w1n*_*ter 2 package-management apt nvidia cuda

Ubuntu版本:18.04 Apt版本:1.6.13

我尝试安装不同的 cuda 工具包,这样做可能会导致 apt 无法挽回地损坏。我相信这个问题与 cuda 无关,而 apt 在这里出了问题。

如果我运行sudo apt-get install *anything*(或 apt remove 或 apt purge),我会收到错误:

Reading package lists... Done Building dependency tree Reading state information... Done cuda is already the newest version (11.2.2-1). You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies. cuda-drivers-460 : Depends: libnvidia-common-460 (>= 460.32.03) but it is not going to be installed libnvidia-gl-460 : Depends: libnvidia-common-460 but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

所以我尝试sudo apt --fix-broken install

Get:1 file:/var/cuda-repo-ubuntu1804-11-2-local libnvidia-common-460 460.32.03-0ubuntu1 [10.2 kB] Err:1 file:/var/cuda-repo-ubuntu1804-11-2-local libnvidia-common-460 460.32.03-0ubuntu1 File not found - /var/cuda-repo-ubuntu1804-11-2-local/./libnvidia-common-460_460.32.03-0ubuntu1_all.deb (2: No such file or directory) E: Failed to fetch file:/var/cuda-repo-ubuntu1804-11-2-local/./libnvidia-common-460_460.32.03-0ubuntu1_all.deb File not found - /var/cuda-repo-ubuntu1804-11-2-local/./libnvidia-common-460_460.32.03-0ubuntu1_all.deb (2: No such file or directory) E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

确实/var/cuda-repo-ubuntu1804-11-2-local不存在,更不用说里面的文件了。

运行sudo apt-get update产量:

E: The repository 'file:/var/cuda-repo-10-1-local-10.1.105-418.39 Release' no longer has a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'file:/var/cuda-repo-ubuntu1804-11-2-local Release' no longer has a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.

这又可能源于没有/var/cuda-repo-ubuntu1804-11-2-local(或/var/cuda-repo-10-1-local-10.1.105-418.39)

按照https://forums.linuxmint.com/viewtopic.php?t=281922的建议 我也尝试过: sudo su for FILE in $(dpkg-divert --list | grep nvidia-440 | awk '{print $3}'); do dpkg-divert --remove $FILE; done exit

但输入行开头不会执行任何操作(替换为 450 或 460for FILE...也不会执行任何操作)nvidia-440

我正在使用 apt 版本 1.6.13,我尝试通过运行重新安装sudo dpkg -i apt_1.6.13_amd64.deb(从http://archive.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.6.13_amd64.deb下载 ),但我仍然得到运行上述任何内容时出现同样的错误

任何建议将不胜感激 - 我真的很想避免重新安装 ubuntu。

w1n*_*ter 9

这是对 @ubfan1 的回复,但问题是我无法重新启动/删除系统上任何残留的 cuda。如何在 Ubuntu 中安装 NVIDIA 和 CUDA 驱动程序

提供了魔力:sudo rm /etc/apt/sources.list.d/cuda* 然后允许我运行更新,然后修复损坏的安装