6

During installation of CUDA 9.2 on my Ubuntu 18.04 desktop machine it reports an error on finding the already installed driver 396.24 I got from PPA. It is trying to install driver 396.26. How can I get rid of the 396.24? I have tried several times using various syntaxes of remove or purge, but I'm obviously not expert enough to get it right.

This is the text of the error message:

Unpacking nvidia-396 (396.26-0ubuntu1) ...
dpkg: error processing archive /var/cuda-repo-9-2-local/./nvidia-396_396.26-0ubuntu1_amd64.deb (--unpack):
 trying to overwrite '/lib/udev/rules.d/71-nvidia.rules', which is also in package nvidia-kernel-common-396 396.24-0ubuntu0~gpu18.04.1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cuda-repo-9-2-local/./nvidia-396_396.26-0ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Thomas
  • 6,433
DeepExplorer
  • 81
  • 1
  • 5

3 Answers3

6

I ran into the same problem, and fixed it by doing this:

  1. Fix the broken package

    sudo dpkg -i --force-overwrite /var/cuda-repo-9-2-local/./nvidia-396_396.26-0ubuntu1_amd64.deb
    
  2. Reinstall the whole thing while passing the --force-overwrite option to the underlying Dpkg when running the install command (based on this answer)

    sudo apt-get -o Dpkg::Options::="--force-overwrite" install cuda
    
1

There was a prerelease build of 396.26 on an ubuntu launchpad.net ppa, and I was able to successfully build and run CUDA 9.2 from that. The package is no longer on that ppa, which belonged to an individual. Hopefully it will get pushed forward.

1

The Alexabdre Godardn's answer doesn't work for me.
I fix this issue only with this:

sudo apt-get -o Dpkg::Options::="--force-overwrite" install --fix-broken
iamtodor
  • 818