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)
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
    
  • 2
    Thank you so much Alexandre, that force overwrite worked perfectly! I can now move on to the next stage of installing the Deep Learning package CUDNN – DeepExplorer May 24 '18 at 9:45
  • I tried that and it still does not work – thebeancounter May 24 '18 at 12:27
  • @thebeancounter At which step does it fail? What error message are you getting? – Alexandre Godard May 24 '18 at 14:21
  • @the second stage failes, with the error: The following packages have unmet dependencies. cuda-drivers : Depends: nvidia-396 (>= 396.26) but it is not going to be installed libcuda1-396 : Depends: nvidia-396 (note: same) nvidia-396-dev : Depends: nvidia-396 (>= 396.26) but it is not going to be installed nvidia-opencl-icd-396 : Depends: nvidia-396 (>= 396.26) but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). when I try to use --fix-broken i get: dpkg returned an error code (1) – thebeancounter May 24 '18 at 18:31
  • I have the same issue but I'm stuck on step 1 of this solution: ~$ sudo dpkg -i --force-overwrite /var/cuda-repo-9-2-local/./nvidia-396_396.26-0ubuntu1_amd64.deb dpkg: error: cannot access archive '/var/cuda-repo-9-2-local/./nvidia-396_396.26-0ubuntu1_amd64.deb': No such file or directory. So the deb file doesn't exist locally, is that to be expected? I've been using the Cuda package from developer.download.nvidia.com/compute/cuda/repos/ubuntu1710/… – Ivar Jun 30 '18 at 20:29
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.

  • That is to say, if you can get the ppa build of 396.26, and install it, and then use the deb(network) 9.2 installer, perform the first three steps, but then perform the final install with synaptic, it will work. – B Student May 23 '18 at 8:30
  • 396.26 is pre-built into CUDA 9.2, so it should install automatically. But mine hits the 396.24 I installed previously and fails with error. Do you know how in Ubuntu to de-install the PPA driver 396.24? – DeepExplorer May 23 '18 at 21:01
  • It's not a matter of 396.26 /396.24 per se - roll back to 390 and the same thing happens. It's because ubuntu has their own packaging of nvidia drivers, and it is the various interdependencies that conflict with nvidia's packaging. Why? Because somewhere out there are people using open source graphics programs that depend on features found only in the open-source nouveau nvidia driver and its ecosystem - the same way that scientific / machine-learning types use CUDA, which depends on the very-metal nvidia drivers. So the o/s graphics person is screwed if Ubuntu uses all nvidia drivers. – B Student May 24 '18 at 5:02
  • Thanks for your comment B Student - understood! I am new and am just getting used to this environment of suppliers and their brands. – DeepExplorer May 24 '18 at 9:50
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.