NVidia does not officially support 14.04 yet. So all efforts are at your own risk. But I just spent full day dealing with this so I’m going to document it.
Basically you can almost use nvidia-331 driver package that Nvidia provides on their repository, except some dependencies are broken. So the way to deal with it is either to rebuild that driver package (then you maintain proper APT tree of packages, this is what I did and what I will document below) or to install CUDA-6.0 from their tar/run and install nvidia-331 package from Ubuntu 14.04 (they will conflict in driver and one from Nvidia should be removed; you basically want to keep slightly lower version driver from Ubuntu and have /usr/local/cuda-6.0 directory from Nvidia install).
Since I want to make sure future packages Nvidia may provide in their repository work, I’m providing feedback here on how to fix it in “debian” way and will send email to someone at NVidia pointing to this thread.
Ok. So assuming you started fresh from Ubuntu 14.04, you may already have some nvidia driver installed (nvidia-304 or nvidia-311 or nvidia-common) but they will only support CUDA 5.5. To get CUDA 6.0 you want to first add Nvidia repository - this can be done by either downloading from Nvidia (select DEB from CUDA download site for Linux Ubuntu 13.04) cuda-repo-ubuntu1304_6.0-37_amd64.deb and installing it or by manually adding line:
deb Index of /compute/cuda/repos/ubuntu1304/x86_64 /
to /etc/apt/sources.list
All packages will install fine from that repository except the drivers nvidia-331 package. So that one you will need to rebuild and add to your local repository. You can get that package directly from Nvidia site:
http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1304/x86_64/nvidia-310_331.62-0ubuntu1_amd64.deb
You want to npack the debian file after download. There are better ways of doing it but I’m afraid I’m used to the most manual way - I unarchive it and untar what’s inside. Lets assume you’re in the directory where you downloaded nvidia-310_331.62-0ubuntu1_amd64.deb into. In there do:
mkdir nvidia-331
cd nvidia-331
ar x ../nvidia-310_331.62-0ubuntu1_amd64.deb
mkdir DEBIAN
cd DEBIAN
tar xf ../control.tar*
cd ..
tar xf data.tar*
rm * (you will get warnings here, ignore)
Now nvidia-331 has directory from which new debian package can be created. You want to modify the control file (in DEBIAN subdirectory) and fix the dependencies.
vi DEBIAN/control (obviously you can use something other than vi here)
You want to remove “xorg-video-abi-11 | xorg-video-abi-12 | xorg-video-abi-13 | xorg-video-abi-14” from Depends line and libopencl1 from Conflicts, Replaces, Provides (removing libopencl1 is optional if you just want CUDA6, but it is needed if you want to also install wine). You also want to increase the version number (actually its enough to just increase number before or after ubuntu in version line, I was debugging something else to increase version) and modify to indicate its your custom version. My control after modifications looks like this:
Package: nvidia-331
Source: nvidia-graphics-drivers-331
Version: 331.63-1ubuntu1-william-62to63
Architecture: amd64
Maintainer: Ubuntu Core Developers ubuntu-devel-discuss@lists.ubuntu.com
Installed-Size: 262008
Depends: x11-common (>= 1:7.0.0), make, sed (>> 3.0), dkms, linux-libc-dev, libc6-dev, patch, acpid, libc6 (>= 2.2.5), libgl1, libx11-6, libxext6, zlib1g (>= 1:1.1.4), xserver-xorg-core
Recommends: nvidia-settings-331, nvidia-persistenced
Conflicts: xorg-driver-binary
Replaces: xorg-driver-binary
Provides: libcuda-5.0-1, nvidia-driver-binary, opencl-icd, xorg-driver-binary, xorg-driver-video
Section: restricted/misc
Priority: optional
Good so if you have done as above you’re ready to create a new debian package. Do this with:
cd ..
dpkg-deb -b nvidia-331
Now you have new nvidia-331.deb file in the directory where you downloaded original file. You can if you want rename it to correspond to version string you chose.
We need to create custom repository to put this into. Normally you’d have .changes file for repository from Debian build. Having just .deb is not common and most repository tools can’d deal with it. But reprepro local repository package can. The documentation steps below on how to do it are based on http://www.porcheron.info/setup-your-debianubuntu-repository-with-reprepro/. So to create a repository do:
apt-get install reprepro
mkdir /usr/local/debian-archive
mkdir /usr/local/debian-archive/conf
mkdir /usr/local/debian-archive/dists
mkdir /usr/local/debian-archive/incoming
mkdir /usr/local/debian-archive/indices
mkdir /usr/local/debian-archive/logs
mkdir /usr/local/debian-archive/pool
mkdir /usr/local/debian-archive/project
mkdir /usr/local/debian-archive/tmp
echo “allow * by unsigned” > /usr/local/debian-archive/conf/uploaders
cat << EOF > /usr/local/debian-archive/conf/incoming
Name: default
IncomingDir: incoming
TempDir: tmp
Allow: trusty
Cleanup: on_deny on_error
EOF
cat << EOF > /usr/local/debian-archive/conf/distributions
Origin: Local
Label: Local
Suite: trusty
Codename: trusty
Version: 14.04
Architectures: i386 amd64 source
Components: main
Description: Locally modified (or backported) packages
DebOverride: ../indices/override.trusty.main
UDebOverride: ../indices/override.trusty.main.debian-installer
DscOverride: ../indices/override.trusty.main.src
DebIndices: Packages Release . .gz .bz2
UDebIndices: Packages . .gz .bz2
DscIndices: Sources Release .gz .bz2
Contents: . .gz .bz2
Log: packages.local.log
EOF
touch /usr/local/debian-archive/indices/override.trusty.main
touch /usr/local/debian-archive/indices/override.trusty.main.debian-installer
touch /usr/local/debian-archive/indices/override.trusty.main.src
reprepro -Vb /usr/local/debian-archive
Now you are going to add the custom nvidia-331 package to this repository:
reprepro -b /usr/local/debian-archive includedeb trusty nvidia-331.deb
Next step is adding local repository to apt, add this line to /etc/apt/sources.list
deb file:///usr/local/debian-archive dists/trusty/main/binary-amd64/
Update your apt cache after that:
apt-get update
If everything has been done right you can now finally add CUDA6 by just doing:
apt-get install cuda
Everything below is optional if you want to also install wine and if you want to use bumblebee. So wine has a conflict with drivers because of libopencl. We actually already fixed the conflict with changes to nvidia-331 but result is that if you just do “apt-get install wine” it will want to install different opencl library which may not be optimal or may lead to conflicts - but feel free to just do it because probably it is all ok and besides its probably not the case that you’re going to use opencl from wine anyway. In case you want setup proper Nvidia library you will need to create another custom package. You download nvidia-libopencl1-331_331.38-0ubuntu7_amd64.deb (and yes, I checked that library is exactly the same as in newer driver package) from http://packages.ubuntu.com/trusty/amd64/nvidia-libopencl1-331/download and then unpack:
mkdir nvidia-libopencl1-331
cd nvidia-libopencl1-331
ar x ../nvidia-libopencl1-331_331.38-0ubuntu7_amd64.deb
mkdir DEBIAN
cd DEBIAN
tar xf ../control.tar*
cd ..
tar xf data.tar*
rm *
vi DEBIAN/control
For modifications here you want to ensure it has the same version as cuda driver and you want to add
libopencl-1.1-1 to provides, add nvidia-331 to depends and add
Multi-Arch: foreign
line because otherwise wine will not install as it requires i386 support even for amd64 system (and nvidia-libopencl package does include i386 libraries in proper multiarch directories). My control looked like this:
Package: nvidia-libopencl1-331
Source: nvidia-graphics-drivers-331
Version: 331.63-1ubuntu8-william
Architecture: amd64
Maintainer: Ubuntu Core Developers ubuntu-devel-discuss@lists.ubuntu.com
Installed-Size: 85
Depends: libc6 (>= 2.2.5), nvidia-331
Suggests: nvidia-opencl-icd-331
Conflicts: libopencl1
Replaces: libopencl1
Provides: libopencl1, libopencl-1.1, libopencl-1.1-1
Section: restricted/misc
Priority: optional
Multi-Arch: foreign
Description: NVIDIA OpenCL Driver and ICD Loader library
Now you create a debian package and add it to your local repository:
cd ..
dpkg-deb -b nvidia-libopencl1-331
reprepro -b /usr/local/debian-archive includedeb trusty nvidia-libopencl1-331.deb
apt-get update
You install wine together with this package:
apt-get install wine nvidia-libopencl1-331:amd64
Last thing related to Nvidia to get to work for me was bumblebee. It will not work as is because with newest driver Nvidia added 2nd kernel module nvidia-uvm.ko in addition to just nvidia.ko. This is what I put in /etc/bumblebee/bumblebee.conf to make it work:
[driver-nvidia]
KernelDriver=nvidia-uvm
PMethod=auto
LibraryPath=/usr/lib/nvidia-331:/usr/lib32/nvidia-331
XorgConfFile=/etc/bumblebee/xorg.conf.nvidia
XorgModulePath=/usr/lib/nvidia-331/xorg,/usr/lib/xorg/modules
Also I put driver=nvidia in [bumblebeed] section because I don’t want fallback to nouveau (tested, it didnt work for me). The only problem is bumblebeed doesn’t know there are two kernel modules and not one and while it will load nvidia driver and run application with nvidia, it will not not unload it after its done. You can unload driver manually with “rmmod nvidia-uvm; rmmod nvidia” and if you want can just create a shell script for calling optirun that will do it.
Hope this is helpful!
William