Score:0

Getting fix-broken-install and can't install anything (CUDA libs)

kz flag

I have attempted to install Sox with apt-get install sox, and I get the following error:

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.
 nvidia-cuda-toolkit : Depends: nvidia-cuda-dev (= 9.1.85-3ubuntu1) but it is not going to be installed
 sox : Depends: libsox-fmt-alsa (= 14.4.2-3ubuntu0.18.04.1) but it is not going to be installed or
                libsox-fmt-ao (= 14.4.2-3ubuntu0.18.04.1) but it is not going to be installed or
                libsox-fmt-oss (= 14.4.2-3ubuntu0.18.04.1) but it is not going to be installed or
                libsox-fmt-pulse (= 14.4.2-3ubuntu0.18.04.1) but it is not going to be installed
       Depends: libsox-fmt-base (= 14.4.2-3ubuntu0.18.04.1) but it is not going to be installed
       Depends: libsox3 (= 14.4.2-3ubuntu0.18.04.1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

I have seen this type of error discussed quite a bit, and I'm pretty sure in my case it's caused by a faulty nvidia install. Running apt --fix-broken install as suggested gives me:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  libnvidia-common-440 libnvidia-extra-440
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  nvidia-cuda-dev
Recommended packages:
  libnvcuvid1
The following NEW packages will be installed
  nvidia-cuda-dev
0 to upgrade, 1 to newly install, 0 to remove and 431 not to upgrade.
48 not fully installed or removed.
Need to get 0 B/263 MB of archives.
After this operation, 734 MB of additional disk space will be used.
Do you want to continue? [Y/n]

But when I continue it gives:

(Reading database ... 196302 files and directories currently installed.)
Preparing to unpack .../nvidia-cuda-dev_9.1.85-3ubuntu1_amd64.deb ...
Unpacking nvidia-cuda-dev (9.1.85-3ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/nvidia-cuda-dev_9.1.85-3ubuntu1_amd64.deb (--unpack):
 trying to overwrite '/usr/include/cublas.h', which is also in package libcublas-dev 10.2.2.89-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nvidia-cuda-dev_9.1.85-3ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Currently I am unable to install anything, even using the desktop. I have two Titan RTX cards, and run TensorFlow, which I installed according to the instructions on the TensorFlow site here (although I used CUDA 10.1). But I suspect (I can't really remember) I initially installed nvidia-cuda-toolkit using apt, and then forgot about it. I do recall having some issues with the install, but the cards have worked so far without problem.

From searching I came up with this as a possible best answer:

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

Or possibly:

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

But I wanted to check before running this command. It looks like the root of the problem is the absence of nvidia-cuda-dev, and indeed when I run

apt list --installed | grep nvidia-cuda-toolkit

it locates the toolkit, but the same with nvidia-cuda-dev fails to find anything. So I guess I just need to remove nvidia-cuda-toolkit (but do I need it?).

user535733 avatar
cn flag
In your output: `dpkg: error processing archive A.deb (--unpack): trying to overwrite 'File_B', which is also in package C`. A and C *conflict*. You have two choices: 1) Uninstall C in order to install A, or 2) Look up the manpage to learn how to use the apt `--force` flag properly so you don't cause damage.
kz flag
Thanks very much. Given that I want to update the drivers and upgrade to CUDA 11, I am minded to just remove all CUDA/NVIDIA packages with `sudo rm /etc/apt/sources.list.d/cuda*` followed by `sudo apt remove --autoremove nvidia-cuda-toolkit` and `sudo apt remove --autoremove nvidia-*`.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.