15

I tried to install a CUDA 5.5, following the steps on the Nvidia website, using the deb file for Ubuntu 12.10 (the latest version I could find on Nvidia website), but the installer fail to begin, telling me there are some dependency issues:

The following packages have unmet dependencies. 
  cuda : Depends: cuda-5-5 (= 5.5-22) but it is not going to be installed. 
E: Unable to correct problems, you have held broken packages.
1
  • I have the same problem, did you ever manage to get this to work? I am running Kubuntu 13.10 64bit Dec 1, 2013 at 18:45

7 Answers 7

13

I have successfully installed CUDA-5.5.22 on Ubuntu 13.10 64-bit.

$ uname -a
Linux bagchi62 3.11.0-14-generic #21-Ubuntu SMP Tue Nov 12 17:04:55 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

My GPU is GeForce GTX 650Ti. Below are the steps of my installation:

Step 1. Purge the existing NVIDIA driver installations. I had to install the latest NVIDIA driver (331.20) for CUDA-5.5 to work. [I later found that you need at least v319.37 for CUDA-5.5.22 - the toolkit that supports Ubuntu 12.10]

sudo apt-get purge nvidia*

Step 2. Download the latest NVIDIA driver from here: http://www.nvidia.com/Download/index.aspx, and the CUDA toolkit from here: https://developer.nvidia.com/cuda-downloads [I download the .run file for 64-bit Ubuntu 12.10]

Step 3. Create a blacklist for existing video drivers in /etc/modprobe.d. I created a file named /etc/modprobe.d/blacklist-file-drivers.conf with the following content:

blacklist nouveau
blacklist lbm-nouveau
blacklist amd76x_edac
blacklist vga16fb
blacklist rivatv
blacklist rivafb
blacklist nvidiafb
blacklist nvidia-173
blacklist nvidia-96
blacklist nvidia-current
blacklist nvidia-173-updates
blacklist nvidia-96-updates
alias nvidia nvidia_current_updates
alias nouveau off
alias lbm-nouveau off

Step 4. Install the dependencies. [Note: CUDA-5.5.22 needs gcc-v4.7.2 or below for compilation. If you install gcc-4.7, then v4.7.3 is pulled from the repositories, and you cannot install the toolkit. Hence, I used gcc-4.6]

sudo apt-get install freeglut3 freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev gcc g++ gcc-4.6 g++-4.6 linux-headers-generic linux-source
sudo ln -s /usr/lib/x86_64-linux-gnu/libglut.so.3 /usr/lib/libglut.so

Step 5. Configure your gcc for alternatives. You will need latest gcc for NVIDIA driver and gcc-4.6 for CUDA toolkit. [I have gcc-4.8 as the latest. You have to change accordingly]

sudo update-alternatives --remove-all gcc
sudo update-alternatives --config gcc
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50

Step 6. Prequisites done. Reboot and drop into a text console (Ctrl+Alt+F1). Kill your display manager. For un-tweaked Ubuntu 13.10, it is lightdm

sudo service lightdm stop

Step 7. Install NVIDIA driver. Navigate to your download directory, and choose your latest gcc. [Note: Do not copy-paste the following code. Change the name of your driver file accordingly]

sudo update-alternatives --config gcc          #choose 4.8
sudo chmod +x NVIDIA-Linux-x86_64-331.20.run
sudo ./NVIDIA-Linux-x86_64-331.20.run

Follow the text instructions. Initially, it would give warnings about unsupported distribution. Ignore and continue.

Step 8. Install CUDA toolkit. [Note: Do not copy-paste the following code. Change the name of your toolkit file accordingly]

sudo update-alternatives --config gcc          #choose 4.6
sudo chmod +x cuda_5.5.22_linux_64.run
sudo ./cuda_5.5.22_linux_64.run

Follow text instruction. Do NOT install the CUDA driver that comes with the toolkit.

Step 9. Add the binaries and lib files to your path. Reboot.

Step 10. Done! You can make the sample files now. Enjoy your CUDA.

1
  • 1
    Worked great (on Linux Mint 16). I didn't have to do all the blacklisting, but that's probably because I already had the newest NVIDIA drivers installed. If that's the case, the key steps are installing the dependencies, setting up gcc 4.6, and installing CUDA from the .run package. Don't forget to put gcc back to 4.8 when you're done!
    – hunse
    Jan 20, 2014 at 22:42
5

Courtesy of Mr. Aaron Haviland:

sudo apt-add-repository ppa:aaron-haviland/cuda-5.5
sudo apt-get install nvidia-cuda-toolkit

In case one would also like to install the (currently) latest NVIDIA drivers for ubuntu (NOTE: this is NOT a dependency of CUDA 5.5), an easy method…

Courtesy of the “xorg crack pushers team”:

sudo add-apt-repository ppa:xorg-edgers/ppa
sudo apt-get update
sudo apt-get install nvidia-331
5
  • 1
    Welcome to AskUbuntu. Your answer seems valid but could you please detail it a bit more? Jan 28, 2014 at 14:43
  • 1
    @LuísdeSousa I am not sure what further details would be helpful - the question was how to install CUDA 5.5 on ubuntu 13.10. Running the lines I wrote above worked for me. Please let me know what details are missing.
    – eldad-a
    Jan 28, 2014 at 19:00
  • 1
    @LuísdeSousa I feel like I am missing something... Do you find this helpful? launchpad.net/~aaron-haviland
    – eldad-a
    Jan 28, 2014 at 20:41
  • @eldad is nvidia-331 still the latest and greatest one to use? May 15, 2014 at 18:20
  • @NickolaiLeschov I apologise, I cannot provide any input of this
    – eldad-a
    Jun 29, 2014 at 13:14
2

My UBUNTU 13.10 64bits system (uname -a):

Linux gpia 3.11.0-18-generic #32-Ubuntu SMP Tue Feb 18 21:11:14 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

The way I've installed CUDA Toolkit 5.5:

1 - In System Settings -> Software & Updates -> Additional Drives, select:

SELECT: Using NVIDIA binary Xorg driver, kernel module and VDPAU library from nvidia-319-updates (proprietary)

This gave me NVIDIA driver version 319.60 (it needs to be >= 319.37).

2 - Install gcc-4.6:

sudo apt-get install gcc-4.6

3 - Use update-alternatives to handle gcc versions (as stated by banskt):

sudo update-alternatives --remove-all gcc
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 1
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 100
sudo update-alternatives --config gcc

and choose gcc-4.6.

4 - Install some sutff to avoid missing libraries from CUDA samples (libGLU.so, libX11.so, libXi.so, libXmu.so):

sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa-dev

5 - Install CUDA Toolkit, previously downloaded from NVIDIA site (RUN version 12.10 64 bits: developer.download.nvidia.com/compute/cuda/5_5/rel/installers/cuda_5.5.22_linux_64.run)

sudo sh cuda_5.5.22_linux_64.run

Answers: accept, y (unsupported), n (NVIDIA driver), y (install toolkit), enter (default location), y (samples), enter (default location)

6 - With update-alternatives, return to gcc-4.8:

sudo update-alternatives --config gcc

7 - Add the CUDA binaries and lib path to your PATH and LD_LIBRARY_PATH environment variables:

PATH: =======================================

cd /etc/profile.d
sudo vi cuda-5.5_bin.sh

#inside file:

export PATH=$PATH:/usr/local/cuda-5.5/bin

=============================================

LD_LIBRARY_PATH: ============================

cd /etc/ld.so.conf.d
sudo vi cuda-5.5.conf

#inside file:

/usr/local/cuda-5.5/lib
/usr/local/cuda-5.5/lib64

=============================================

8 - Log out your system and log in again. Test with nvcc --version or compile and run the following simple example codes: first.cu, sumvec.cu with nvcc filename.cu -o filename.exec.

Have a nice CUDA time :-D

3
  • Worked for me for CUDA 6.0 / Ubuntu 14.04. Thanks! May 9, 2014 at 15:44
  • Guess I’m the first one to actually read this answer!?! Look at step 7. The last #inside file: does not specify what file to add /usr/local/cuda-5.5/lib /usr/local/cuda-5.5/lib64 to. It might be a good idea to edit your answer. Fixing that “glitch” would make this incomplete answer complete.
    – e-sushi
    Oct 8, 2014 at 17:41
  • Dear e-sushi: everything you need is there. In step 7 you must create <<cuda-5.5_bin.sh>> and <<cuda-5.5.conf>> files, as it is shown by the "cd" and "vi" commands. Anyway, I'll include a subdivision between those two sub-steps.
    – iperetta
    Oct 9, 2014 at 17:52
0

I don't know if you have gotten this working yet, buthHave you tried following the guide here? http://installion.co.uk/ubuntu/saucy/multiverse/n/nvidia-cuda-toolkit/install.html It worked for me

The nustshell is, make sure you have multiverse repo enabled and then

sudo apt-get install nvidia-cuda-toolkit

Cheers!

3
  • 1
    This is not the 5.5 version of the CUDA toolkit but the 5.0 version... source Dec 11, 2013 at 16:22
  • I was not able to get this to work with the newest (nvidia-311) version of the drivers, which I had installed myself from the NVIDIA site. apt-get tried to install some updates to the nvidia-319 drivers (which I did not have installed), causing problems. Using the .run file to install as described by @banskt seems like a more generic alternative.
    – hunse
    Jan 20, 2014 at 22:47
  • Another link on how to install nvidia-cuda-toolkit
    – Eduardo
    Oct 29, 2016 at 10:51
0

I had some issues to in cuda installation. The best/simpler way to solve the errors that worked for me was use sudo aptitude install cuda instead of "sudo apt-get install cuda".

apt-get doesn't take care of the errors, aptitude suggest a way to solve the errors and everything worked!

-1

1) Install Ubuntu 12.04.3 64-bit

2) Update open terminal: sudo apt-get update && sudo apt-get upgrade sudo shutdown -r now # reboot machine

3) install compilation tools, mpi, nvidia-331 driver, gcc/g++ 4.6 (supported, as opposed to gcc/g++ 4.8 or 4.7.3) and set as default. Also, install other libraries needed for CUDA Toolkit Samples compilation and make the respective symbolic links to where the CUDA Toolkit installer will find them:

sudo add-apt-repository ppa:xorg-edgers/ppa # adds repository that has latest NVIDIA drivers for 12.04.3
sudo apt-get update # updates package lists
sudo apt-get install build-essential libcr-dev mpich2 mpich2-doc gcc-4.6 g++-4.6 nvidia-331 # build tools, compilers, gcc, nvidia
sudo apt-get install libX11-dev libglu1-mesa libXi-dev libXmu-dev freeglut3-dev # libraries needed for compiling CUDA samples
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
sudo ln -s /usr/lib/x86_64-linux-gnu/libXi.so /usr/lib/libXi.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/libGLU.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/libX11.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libXmu.so /usr/lib/libXmu.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libglut.so /usr/lib/libglut.so
sudo shutdown -r now # reboot machine

4) download & install CUDA 5.5 Toolkit 64-bit for Ubuntu 12.10 (RUN): download here: https://developer.nvidia.com/cuda-downloads

install -- open terminal in directory where downloaded:

chmod +x cuda_5.5.22_linux_64.run # This marks archive as an executable, archive name might be different
sudo ./cuda_5.5.22_linux_64.run

# step through license agreement, then type: accept
Confirm you are installing on unsupported configuration -- type: y
Installer will ask to install NVIDIA driver -- type: n
Installer will ask to install the CUDA 5.5 Toolkit -- type: y
Installer will ask toolkit location -- default is okay, hit Enter key to select default
Installer will ask to install CUDA 5.5 Samples -- type: y
Installer will ask samples location -- this can be changed, or left to default, I chose /opt/cuda_samples and later chown'ed that directory so that all could read/write to it

Installer should complete, saying:

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-5.5
Samples:  Installed in /opt/cuda_samples

Next:

gedit ~/.bashrc &

and place the following lines in the file:

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda/lib:/usr/lib/nvidia-331:$LD_LIBRARY_PATH

Also add a variable in .bashrc called CUDA_SAMPLES pointing to the directory where the CUDA samples were installed from above... i.e.:

export CUDA_SAMPLES=/home/username/NVIDIA_CUDA-5.5_Samples

Lastly, to compile all the CUDA Toolkit sources:

# needed to compile samples that depend on GL
cp /usr/local/cuda-5.5/extras/CUPTI/include/GL/glu.h ${CUDA_SAMPLES}/common/inc/GL/
cp /usr/local/cuda-5.5/extras/CUPTI/include/GL/gl.h ${CUDA_SAMPLES}/common/inc/GL/

One other thing, need to make a link to /usr/lib/nvidia-current to the driver files installed
by the nvidia-331 driver, as this is the location where CUDA looks for libraries in Ubuntu. Do this via:

sudo ln -s /usr/lib/nvidia-331 /usr/lib/nvidia-current

Finally, from a terminal in the directory that was chosen to install the samples type: make
All the samples should compile successfully.

For platforms with Optimus (laptops) refer to: http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html or look at http://bumblebee-project.org/

Source: http://pastebin.com/fDpqvSi5

3
  • next time, just paste the content here.
    – Braiam
    Dec 7, 2013 at 18:45
  • The question asked specifically for Ubuntu 13.10, the instructions for 12.04 are on the CUDA website and are much simpler. Dec 11, 2013 at 16:23
  • Install a new operating system is not an appropriate first step for a question like this
    – Anake
    Jan 15, 2014 at 20:59
-1

Courtesy of Mr. Aaron Haviland:

sudo apt-add-repository ppa:aaron-haviland/cuda-5.5
sudo apt-get install nvidia-cuda-toolkit

Courtesy of the “xorg crack pushers team”:

sudo add-apt-repository ppa:xorg-edgers/ppa
sudo apt-get update
sudo apt-get install nvidia-331

ALL I needed to know (for linux mint 17.1) both these saved SO much time.

2
  • This is an Ubuntu site not Linux mint Apr 13, 2015 at 14:24
  • 1
    -1 Is that an answer? I don't think so.
    – A.B.
    Apr 13, 2015 at 14:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .