How to install or upgrade Nvidia Video Drivers

Welcome to our guide about NVIDIA drivers and how to install them in Ubuntu. In this article we aim to give answers and solutions in order to play games using nVIDIA GPU. There are two primary points you need to pay attention to: [highlight color=”yellow”]GPU model and  Driver’s version[/highlight] – since the fundamental standard of selection consists out of these two, and also (as a third point) the moral question (open source or proprietary) is another factor that effects all manner of Linux community and is always taken under FSF’s consideration.

Open Source VS Proprietary drivers

Ubuntu has an answer on that and comes with open source video driver by default, called Nouveau. There is no need to put any effort to install Nouveau because this driver is already, completely installed 100% from the first boot. However this one comes with a price – lacking of 3D acceleration meaning most games will not work and have performance issues. As a side effect, NVIDIA made available another driver — not opensource but proprietary — called NVIDIA Unified UNIX Graphics Driver. Having this one installed, you make use of your GPUs hardware potential to the fullest and thus expect some serious performance boost.

Nonetheless, we would like to notice that UbuntuXtreme does not aim to go into open vs close source anticipation, but to provide you with something you can play games and benchmark your hardware, without problems. Truth has been told, the open source driver is struggling to perform or play modern games, thus we recommend using NVIDIA Unified UNIX Graphics driver; but if you are not much of a gamer guy, then nouveau will do the job as well. All in all, if you are serious about high-performance and gaming, you already know that NVIDIA proprietary driver is what you need.

Identify your GPU model

In Linux, what a video driver does is allowing OpenGL API to interact with the graphics card.  Pay attention, that nVIDIA provides many different versions for Linux, meaning that your first concern is to identify which version/driver is suitable for your GPU. To answer that question you need to know your GPU’s model (eg GeForce GTX680, GeForce Ti4200, TNT Riva etc) and then look for its name into their hardware support lists.

To identify your hardware, instead of using a terminal-based command, we prefer to use the GUI, since we believe that using the mouse is much faster than typing an arcane geek command. Go to “System Settings” and click on the “Details” icon.

As you can see my GPU model is GeForce GTX465. Now you know what hardware you are running at your PC and you can search for the appropriate driver.

Installation: Our way, The easy and the hard way

We recommend to download and run our script which will automatically installs Xorg-Edge drivers. The script automatically removes opensource drivers (if any), nvidia proprietary old drivers (if any), blacklists and removes the appropriate modules and last but certainly not least, fixes sources and installs the latest nVIDIA drivers drivers and restarts your  PC. Please try our script.

[button color=”green” link=”https://utappia.org/wp-content/uploads/2012/08/installer_nvidia.sh”%5DDownload our Installer Script[/button]
Please add execute permission to the script before install it typing:

chmod +x installer_nvidia.sh
sh ~/Downloads/installer_nvidia.sh

to run the script

Do you want to install a PPA once, then stay back and relax for life? If so, then follow the easy path that most Ubuntu users do. Two choices here, but pick one: xorg crack pushers(aka Xorg-edgers) or Ubuntu-X. The difference between these two PPA is that Xorg-Edgers offers you bleeding-edge drivers directly from upstream git, while X-Swat provides you a safer — recommended — upstrream releases.

 

[toggle title=”The easy way: Latest (maybe unstable) drivers”]

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

[/toggle]

[toggle title=”The easy way: Latest but stable drivers”]

sudo add-apt-repository ppa:ubuntu-x-swat/x-updates 
sudo apt-get update
sudo apt-get install nvidia-current

[/toggle]

[dropcap]Warning:[/dropcap]In case you want to upgrade Ubuntu up to a new version (eg from Ubuntu 12.04 upgrade into Ubuntu 12.10) you have to remove this PPA or strange things will happen and maybe render unstable the whole system. So before you upgrade to the newer Ubuntu distro, please act wise and remove it..

[toggle title=”Unistall the PPA”]

sudo apt-get install ppa-purge

### then remove the X-Swat PPA ###
sudo ppa-purge ppa:ubuntu-x-swat/x-updates

### or Xorg-Edgers PPA ###
sudo ppa-purge ppa:xorg-edgers/ppa

[/toggle]

After upgrading to the newer version of Ubuntu, you should re-able the PPA in order to get updates based on the new branch related to your new distro.

Unistall the NVIDIA Unified

If for some reason you want to remove the nVIDIA unified Driver and go back into Nouveau opensource stuff, then follow the instructions bellow.

[toggle title=”Remove NVIDIA Unified and Restore Nouveau”]

sudo apt-get purge nvidia
sudo apt-get install nouveau

[/toggle]

So far, we have covered the easy method and now you should be able to install and remove them properly. Pay attention that in case you want to upgrade your Ubuntu distro to the new one, make sure you have the PPA purged!!! You can stop reading now and reboot your PC. Have fun 😉

The hard way… compiling

Still reading ah? If you consider yourself as person who posses significant knowledge on Linux and basic bash terminal commands, then feel free to compile the NVIDIA driver module in your own . There’s nothing wrong doing things manually; grasp deep knowledge of things who which where and what is happening into your system. So, after identifying yours GPU model then go to NVIDIA webpage and browse into the Supported Products tab, looking for your model. If you purchased your GPU during the past 5 years then it’s probably supported by the Latest Long Lived Branch version and Latest Short Lived Branch version. The difference between these two is that the Long Live Branch is something like Ubuntu LTS — meaning only security updates and bugfixes. But if you can’t find your model’ name nowhere on that list, then you should look under the Legacy stuff. Supposing you own a long fashioned GPU, nVIDIA provides you their Legacy Driver — support for very old models, such as TNT2, GeForce3/4 Ti/MX/FX series etc. Eventually, we recommend you to install the Short Lived Branch version — no fear. Here is a step-by-step guide to do it.

[toggle title=”1. Kill the X server”]
Press Ctrl+Alt+F1 or F2 or F3 or F-whatever
otherwise type the command:

sudo chvt 1 && sudo service lightdm stop

where chvt 1 is tty1 = equal to Ctrl+Alt+F1
where chvt 2 is tty2 = equal to Ctrl+Alt+F2
where chvt 3 is tty3 and so on…[/toggle]
[toggle title=”2. Disable nouveau “]

sudo modprobe -b vga16fb
sudo modprobe -b nouveau
sudo modprobe -b rivafb
sudo modprobe -b nvidiafb

[/toggle]
[toggle title=”3. Remove nouveau packages”]

sudo apt-get --purge remove xserver-xorg-video-nouveau
sudo update-initramfs -u

[/toggle]
[toggle title=”4. Reboot”]

sudo shutdown -r 0

[/toggle]
[toggle title=”5. Download the driver”]

wget -qO- ftp://download.nvidia.com/XFree86/Linux-x86/XXXXXXX.run

[/toggle]
[toggle title=”6. Remove your current driver in use”]

# Remove all nvidia* packages in the system
sudo dpkg -l | grep nvidia | awk '{ print $2 }' | xargs sudo aptitude -y purge

# Remove all the nvidia kernel objects currently installed
export kernel_version=`uname -r`
sudo rm -f `find /lib/modules/$kernel_version -iname nvidia.ko`

[/toggle]
[toggle title=”7. Install the new driver”]

sudo sh NVIDIA-Linux-x86-*.run

[/toggle]
[toggle title=”8. Enable the Desktop”]

sudo service lightdm start

[/toggle]

Pay attention that every time you update you kernel, you should repeat the whole procedure (Steps 1-8). Otherwise you will end up with a broken X server. In contrast to the PPA method, compiling the module by yourself it’s not what Ubuntu tastes, especially when there are two Launchpad teams who provide you the dinner well served. So doing all that by hand is pointless. But if you still insist on that, maybe reconsider why you use Ubuntu instead of Arch or Gentoo.

Alright let’s round things up. The NVIDIA Unified drivers are way better than Nouveau since they provide 3D acceleration. The greatness of NVIDIA is their combination of decent performance and low noise levels, and as such that dynamic shifted through their GPUs. It is common knowledge that their Linux drivers are way immature comparing to Windows, hence lot’s of features are not implemented. On the other side of the scope, we also have to acknowledge that this driver is pitted against to a currently zero-market, since there is no actual profit from Linux gaming. But soon, things will change and then we will be happy to edit this article. Until then, may the source be with you, always!

Advertisements

2 thoughts on “How to install or upgrade Nvidia Video Drivers

  1. Great guide Salih! Although unfortunately it hasn’t worked for me. No matter which method and version of NVIDIA drivers I install, I get caught in an infinite loop when I launch the lightdm service (shows NVIDIA logo, then just the cursor, then the console, ad infinitum).

    I also wasn’t able to try out nouveau because the following two lines in your guide didn’t work for me:

    sudo apt-get purge nvidia
    sudo apt-get install nouveau

    I think the first one needs an * at the end. Not sure what package name to use for nouveau, but apt-get doesn’t recognize “nouveau” on its own.

    My situation is that I’m using a 32-bit installation of Ubuntu 11.10 on a 64-bit machine. I had everything working (NVIDIA development drivers, CUDA, OpenCV, PCL, OpenNI, KinectFusion etc) before, but some kind of update or reinstallation has killed the NVIDIA side of things. I’m really hoping I can just fix the NVIDIA drivers so that I can have things working the way they were before, otherwise (with my ability) I’m looking at multiple weeks worth of delays and a missed deadline…

    Like

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s