Skip to content

CUDA Installation – Ubuntu 10.04

October 5, 2013

This setup was done in the Computational Fluid Dynamics Laboratory.

Firstly, as I said in the previous post, the CUDA toolkit is specifically for Nvidia GPUs. So you need to know which Video Card (Video Graphics Array – VGA) is currently a part of your system (if there is any!). So open up your terminal and try the following command, and check the entry in the VGA section.

$ lspci -v

You might get a long list, but look for ‘VGA’ and you’ll find something like this:

Okay my laptop does not have a Nvidia card (its a Intel HD 4000 series) but then for the Nvidia users….

You’ll need 3 things here:
1. Nvidia Developer Drivers (260.19.26)
2. CUDA toolkit (Ubuntu 10.04; 64-bit)
3. GPU Computing SDK Sample examples (optional, but usually for verification)

Go to this link and download these.

Note: Make sure you download the correct version, i.e. 64-bit (some errors in 32-bit installation have been noticed), and also note down the version of ‘Nvidia Developer Drivers’ that you download (260.19.26 at present).

1. First and foremost, get rid of some drivers that might possibly interfere with our installation.

a) Blacklist kernel modules:

$ gksudo gedit /etc/modprobe.d/blacklist.conf

b) Add the following lines to the file that opens up, save and quit:

blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv

c) Remove any Nvidia driver already installed:

$ sudo apt-get --purge remove nvidia-*

d) Your system might through up an error (nouveau module still running), it has been covered later on.

2. Reboot your PC.

3. Go to virtual terminal (CTRL+ALT+F5) [to return back to normal mode, CTRL+ALT+F7 / CTRL+ALT+F8]

4. Log in at the virtual terminal and run the following line of code

$ sudo service gdm stop

5. Install the Nvidia Development Drivers.

a) Go to the location where you saved the downloaded file, become super user and run:

$ chmod +x
$ ./

b) Accept the license agreement, say ‘yes’ to “Install Nvidia’s 32-bit compatibility OpenGL libraries?”

c) Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that the NVIDIA X driver will be used when you restart X? Say ‘yes’

Note: Some systems might throw up an error that has something to do with the nouveau module. Trust me, it troubled me a lot, for around 30-40 mins before I figured a way out. The error occurs because the nouveau module is still running, and hence Nvidia can’t go ahead with its driver installation.
Steps 6 is only for users facing this problem!

6. So the first thought that might come to your mind is, why not simply remove the nouveau module like we did in case of the already existing Nvidia drivers? Yes this might help, so go on with the following command:

$ sudo apt-get --purge remove xserver-xorg-video-nouveau

Reboot, then check if its still working or not:

$ sudo modprobe -r nouveau

In case it is still working (even purging it hasn’t help) you will see the following output (yes I got this)

FATAL: Module nouveau is in use.

Then I found the solution here. Just follow these instructions to help yourself out of this.

a) Purge nouveau:

$ sudo apt-get --purge remove xserver-xorg-video-nouveau

b) Open ‘/etc/default/grub’ file:

$ gksudo gedit /etc/default/grub

c) Edit this file to add the following line to it:


d) Update the grub and later, reboot:

$ sudo update-grub

7. Now you can retry the step 5 and see that it works. Once you’re done with step 5, move on to install CUDA:

a) Go to the directory where you’ve saved your file and run it.

$ chmod +x
$ ./

b) When it asks you for the path of installation, simply choose the default.

8. Now we set up the environment variables:

a) Set PATH:

$ gksudo gedit /etc/environment

b) When the text opens, append the path to CUDA libraries to the existing path, save and quit editor.


change to…


c) Reload the newly edited path, so that the system updates it.

$ source /etc/environment


$ gksudo gedit /etc/

e) When a new text file opens up, paste the following lines into it, save and quit.


f) Reload this path:

$ sudo ldconfig

9. CUDA is now installed, but some more repairs and we’re done. You can now install the ‘GPU Computing SDK’ so that you can compile and verify CUDA.

a) Go to the directory location and:

$ chmod +x
$ ./

b) Install compiler, enter Y when asked:

$ sudo apt-get install g++

c) Repair the broken libGL dependency. Here we also generate a symbolic link between the common name and the existing one (Take care of your version. Mine was 260.19.26, please check yours)

$ sudo rm /usr/lib/
$ sudo ln -s /usr/lib/ /usr/lib/

d) Create link to common name

$ sudo ln -s /usr/lib/ /usr/lib/

e) Install some additional libraries for functioning of CUDA:

$ sudo apt-get install freeglut3-dev libxi-dev

10. Now you can go to the directory where the ‘GPU Computing SDK’ was extracted.

$ cd ~/NVIDIA_GPU_Computing_SDK
$ cd C

11. Build the examples provided:

$ make

Now you have successfully configured your Nvidia GPU in a Linux environment and also installed CUDA. You can verify the installation by simply running a sample code that comes along with the ‘GPU Computing SDK’. All the compiled example codes can be found under “~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release/”.

Once you are into that directory, you can run the ‘deviceQuery’ code.

$ ./deviceQuery

If it outputs something like the following figure, you have successfully completed your installation.

cuda installation verification - rohit

Doubts, issues, installation problems – do comment! That’s all!


From → GPU & GPGPU, Linux

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: