Recently I got CUDA upgraded to version 9.2 and nvidia driver to nvidia-396 with a regular auto-update on my Ubuntu 16.04 Optimus-enabled laptop, with Intel video adapter active by default and NVidia accessed via bumblebee. Shortly after, I've tried to run a CUDA apllication (using optirun <command>
), and found it doesn't work.
First thing I did was replacing all the entries of "nvidia-390" (if I remember right it was 390) in /etc/bumblebee/bumblebee.conf
to "nvidia-396" - this helped me before more than once.
Still doesn't work (Cannot access secondary GPU - error: Could not load GPU driver
). dmesg
, and there is a reason:
[ 314.733284] NVRM: The NVIDIA GeForce GT 520M GPU installed in this system is
NVRM: supported through the NVIDIA 390.xx Legacy drivers. Please
NVRM: visit http://www.nvidia.com/object/unix.html for more
NVRM: information. The 396.26 NVIDIA driver will ignore
NVRM: this GPU. Continuing probe...
Yes, my laptop is quite old, but with SSD and 12 Gb RAM I still don't feel much need to replace it. OK, looks like then I must live with nvidia-390:
sudo apt install nvidia-390
Was told that a lot of dependent packages will be uninstalled, including, it seems, all of CUDA 9.2. Damn. So likely I'm stuck with CUDA 9.0 as well. So, after uninstalling everything (and checkin in synaptic no packages from nvidia-396 or cuda-9.2 are left) I've tried to get it back:
sudo dpkg -i cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda
Three commands ok, but the last one... Houston, we have a problem!
$ sudo apt install cuda
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package cuda
I've tried the solution from an answer on this Installing CUDA 8 on Ubuntu 16: Unable to locate package cuda question, that is:
dpkg -l | grep '^rc' | awk '{print $2}' | sudo xargs dpkg --purge
It did clean indeed lots of stuff, including some from cuda-9.2 related packages. However, the problem is still there - I can't install CUDA again, no matter I'm trying 9.0 or another version.
Any ideas?
This is a new problem:
IF you can get your hands on a pre-release of the ubuntu 396.26 driver package THEN
sudo apt-get install cuda
go into synaptic, search for lower-case cuda (it exists!), mark it to be installed, and update its dependencies.https://launchpad.net/~bstudent/+archive/ubuntu/nvidia-graphics-drivers-396.26-copy-of-staging-ppa-20180522
Here is an older workaround of NVIDIA and CUDA as solution for entire recognition of Optimus cards.
You have to un-install first the installed nvidia-drivers, reboot without nvidia-drivers. Then to proceed like here is described in following link. It is humblesome, but this works as solution for your older chipset.:
How can I Install Nvidia Driver GT 520 and Cuda 5.0 in Ubuntu13.04?
Well, after a while I was able to work around this problem. What exactly I did:
cuda
in Synaptic.cuda-drivers
package version to 390.xx in Synaptic.Did
apt update
thendpkg --configure -a
to resolve broken dependencies, thenapt update
again.Then
sudo apt install cuda
did work but still offered me to install cuda 9.2 and upgrade tonvidia-396
in the process, despite I've locked the driver. Butsudo apt install cuda-9-1
didn't compain and allowed me to install CUDA 9.1 withnvidia-390
(I've found that 9.1 driver also works withnvidia-390
, that's why not 9.0).After that (and a reboot), all my CUDA apps do work with
optirun
until now. :)The only minor annoyance I've encountered later is that
apt dist-upgrade
still offered me to upgradenvidia-390
(but regularapt upgrade
didn't). Resolved that problem withapt-mark hold nvidia-390
, and the package appears now as "locked" in Synaptic as well. Moreover, even if I try to runapt install cuda
manually, now it throws an error:but there are no broken packages packages in fact, so it looks like now I'm also safe from installing the wrong CUDA version accidentally.