Wednesday, December 11, 2019

apt - uninstall broken cuda installation


I downloaded and installed an application that uses CUDA 10.
When I run it, it says:


./main: error while loading shared libraries: libcublas.so.10.0: cannot open shared object file: No such file or directory

The documentation said, that it required CUDA 10 and cuDNN. So, I downloaded and installed both. (... Well, actually I installed CUDA 10.1). But none of that helped. I wasn't sure which one to install, so I installed both the dev and the runtime.


And because still that didn't help, I installed the nvidia-cuda-toolkit. I think that's when things really went wrong. The inevitable happened, I broke it.


I wanted to install one more package: i.e. "cuda-libraries", but it gives an unmet dependency error, refering back to the nvidia toolkit that I installed earlier.


user@dxxx:~/x$ sudo apt install cuda-libraries-10-0
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-10-0 : Depends: cuda-nvrtc-10-0 (>= 10.0.130) but it is not going to be installed
Depends: cuda-nvgraph-10-0 (>= 10.0.130) but it is not going to be installed
Depends: cuda-nvjpeg-10-0 (>= 10.0.130) but it is not going to be installed
Depends: cuda-cusolver-10-0 (>= 10.0.130) but it is not going to be installed
Depends: cuda-cublas-10-0 (>= 10.0.130) but it is not going to be installed
Depends: cuda-cufft-10-0 (>= 10.0.130) but it is not going to be installed
Depends: cuda-curand-10-0 (>= 10.0.130) but it is not going to be installed
Depends: cuda-cusparse-10-0 (>= 10.0.130) but it is not going to be installed
Depends: cuda-npp-10-0 (>= 10.0.130) but it is not going to be installed
Depends: cuda-cudart-10-0 (>= 10.0.130) but it is not going to be installed
Depends: cuda-license-10-0 (>= 10.0.130) but it is not going to be installed
nvidia-cuda-toolkit : Depends: nvidia-cuda-dev (= 9.1.85-3ubuntu1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

Right now, I can't go back nor forth. When I try to uninstall it gives errors.


user@xxx:~/x$ sudo apt autoremove
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 installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

Also, the broken-fix switch doesn't help.
It tries to install something, then goes in error again.


user@xxx:~/x$ sudo 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:
nvidia-cuda-dev
Recommended packages:
libnvcuvid1
The following NEW packages will be installed:
nvidia-cuda-dev
0 upgraded, 1 newly installed, 0 to remove and 142 not upgraded.
54 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] Y
(Reading database ... 205855 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.0.168-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)

How can I save my system? e.g. uninstalling all of it.



For a new beginning. sudo mv /usr/include/cublas.h /usr/include/cublas.h.bak



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.0.168-1



2 packages include the same file and dpkg do not override it without any --force option.


sudo dpkg --configure nvidia-cuda-dev and ` sudo dpkg --configure nvidia-cuda-toolkit`

Then try to remove the package that violate apt. sudo dpkg -P cuda-libraries-10-0 libnvidia-common-390


Next step


sudo dpkg --configure -a && sudo apt -f install

some packages need to upgrade. But only if you receive no error message before.


sudo apt update && sudo apt full-upgrade

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...