I am not able to install anything in ubuntu

13,436

Solution 1

Okay, to back out of this, run the following commands:

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

This will uninstall the nvidia repo you downloaded and installed and hopefully the system will fix itself now. If not, we can fix it manually fairly easily by following the error messages.

You may need to do some more purging and we may have to use dpkg to do that manually so please post any more errors. Thanks!

Solution 2

In my case, removing packages causing collision solved the problem.

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

Solution 3

I had to comment out the following line in the file /etc/apt/sources.list

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

and then run

sudo apt --fix-broken install

That resolved the broken package manager problem created by trying to install CUDA Toolkit 10.2 Download on Ubuntu 18.04 by following Nvidia instructions

Share:
13,436

Related videos on Youtube

Sreram
Author by

Sreram

Updated on September 18, 2022

Comments

  • Sreram
    Sreram over 1 year

    The following is the message I get when trying to install anything on Ubuntu, right now.

    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).
    

    I tried apt --fix-broken install, I tried purge, I tried sudo apt install -f, and also sudo apt-get remove --purge '^nvidia-.*' and I am not able to get anything done. It all fails.

    I tired rebooting in recovery mode to try and uninstall the drivers.

    This is my output for 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)
    

    Can someone please help me? I've been spending hours trying to fix this. I tried installing cuda 10.1 along with an already present installation of cuda 9.1. This turned out to be a mistake. My older cuda installation works fine, but dpkg completely broke, and it is not working anymore.

    Without uninstalling the previous version of cuda, I directly tried installing the 10.1 version (by mistake). I tried installing by following the link given here: https://developer.nvidia.com/cuda-downloads. I selected: Linux -> x86_64 -> Ubuntu -> 18.04 -> deb(network) And I followed the instructions over there.

    I am not able to install anything, because of this.

  • Sreram
    Sreram about 5 years
    Thank you very much!!! I was now able to completely remove Nvidia! I used purge and uninstalled everything.
  • mchid
    mchid about 5 years
    @Sreram Awesome, that was easier than I thought.
  • mchid
    mchid about 5 years
    @Sreram Please let me know if you have trouble re-installing nvidia and cuda9.1.
  • Sreram
    Sreram about 5 years
    Yes sure! Thanks a lot!!
  • mchid
    mchid about 4 years
    You can delete the line by using the -r or --remove option with: sudo add-apt-repository -r "deb http://developer.download.nvidia.com/compute/cuda/repos/ubun‌​tu1804/x86_64/ /"
  • Meto
    Meto almost 4 years
    I am using a DELL laptop which has an 1050ti. I have already encountered numerous problems with this particular laptop and graphical drivers. This answer surely deserves credit since it allowed me to fix update related issues. Thanks a lot.