我无法在 ubuntu 中安装任何东西

我无法在 ubuntu 中安装任何东西

以下是我现在尝试在 Ubuntu 上安装任何东西时收到的消息。

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:
 cuda-libraries-dev-10-1 : Depends: libcublas-dev (>= 10.1.0.105) but it is not going to be installed
 cuda-samples-10-1 : Depends: libcublas-dev (>= 10.1.0.105) but it is not going to be installed
 cuda-visual-tools-10-1 : Depends: libcublas-dev (>= 10.1.0.105) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

我试了又试apt --fix-broken install,但还是没能成功。一切都失败了。purgesudo apt install -fsudo apt-get remove --purge '^nvidia-.*'

我尝试在恢复模式下重新启动以卸载驱动程序。

这是我的输出apt --fix-broken install

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
  libnvidia-common-390
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  libcublas-dev
The following NEW packages will be installed:
  libcublas-dev
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
8 not fully installed or removed.
Need to get 0 B/39.9 MB of archives.
After this operation, 115 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 735451 files and directories currently installed.)
Preparing to unpack .../libcublas-dev_10.1.0.105-1_amd64.deb ...
Unpacking libcublas-dev (10.1.0.105-1) ...
dpkg: error processing archive /var/cache/apt/archives/libcublas-dev_10.1.0.105-1_amd64.deb (--unpack):
 trying to overwrite '/usr/include/cublas_v2.h', which is also in package nvidia-cuda-dev 9.1.85-3ubuntu1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libcublas-dev_10.1.0.105-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

有人能帮我吗?我花了好几个小时试图解决这个问题。我尝试cuda 10.1与已经存在的安装一起安装cuda 9.1。结果发现这是一个错误。我以前的 cuda 安装运行良好,但dpkg完全坏了,不再工作了。

我没有卸载以前版本的 cuda,而是直接尝试安装 10.1 版本(错误)。我尝试按照此处给出的链接进行安装:https://developer.nvidia.com/cuda-downloads。我选择了:Linux -> x86_64 -> Ubuntu -> 18.04 -> deb(network)然后我按照那边的说明进行操作。

由于这个原因,我无法安装任何东西。

答案1

好的,要退出,请运行以下命令:

sudo rm /etc/apt/sources.list.d/cuda.list
sudo apt-get clean
sudo apt-get update
sudo apt install -f

这将卸载您下载并安装的 nvidia repo,希望系统现在可以自行修复。如果没有,我们可以按照错误消息相当轻松地手动修复它。

您可能需要进行更多清除,我们可能必须手动dpkg执行此操作,因此请发布更多错误。谢谢!

答案2

就我而言,移除引起碰撞的包裹解决了问题。

dpkg -P nvidia-cuda-toolkit nvidia-cuda-dev
apt --fix-broken install

答案3

我必须注释掉文件中的以下行/etc/apt/sources.list

deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /

然后运行

sudo apt--fix-broken 安装

这解决了尝试安装时导致的包管理器损坏的问题CUDA 工具包 10.2 下载在 Ubuntu 18.04 上Nvidia 说明

相关内容