October 6, 2014

Installing Nvidia Driver From The Website

There are several ways to install the driver for your Nvidia card in elementary OS.

One way is using System Settings > Additional Drivers.


If you want the latest driver go to the website ( option 1 ) and select your card.
Just press the Download and Agree & Download button.

To find your card open a terminal and type :
lspci | grep VGA
01:00.0 VGA compatible controller: NVIDIA Corporation G92 [GeForce GT 330] (rev a2)
My card is a GeForce GT 330.
The latest driver at this moment is version  340.46. I downloaded the file NVIDIA-Linux-x86_64-340.46.run.

The NVIDIA graphics driver is bundled in a self-extracting package. You can extract it with : 
sh NVIDIA-Linux-x86_64-340.46.run --extract-only  
Creating directory NVIDIA-Linux-x86_64-340.46
Verifying archive integrity... OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86_64 340.46.......................
.

A folder NVIDIA-Linux-x86_64-340.46 is created containing the uncompressed contents of the .run file.
Documentation can be found in :
NVIDIA-Linux-x86_64-340.46/html/index.html and 
NVIDIA-Linux-x86_64-340.46/README.txt


After some googling and attempts I found the right way to install the Nvidia driver :
First in a terminal :
sudo  apt-get install build-essential linux-headers-$(uname -r )

Before attempting to install the NVIDIA driver you should first disable Nouveau. Nouveau ( http://nouveau.freedesktop.org/wiki/ ) is a display driver for Nvidia GPUs, developed as an open-source project through reverse-engineering of the Nvidia driver. Nouveau performs modesets in the kernel. This can make disabling Nouveau difficult, as the kernel modeset is used to display a framebuffer console, which means that Nouveau will be in use even if X is not running. As long as Nouveau is in use, its kernel module ( nouveau.ko ) cannot be unloaded, which will prevent the Nvidia kernel module from loading. It is therefore important to make sure that Nouveau's kernel modesetting is disabled before installing the Nvidia driver.

Some distributions include Nouveau in an initial ramdisk image. If you have an initrd which loads the Nouveau driver, you will additionally need to ensure that Nouveau is disabled in the initrd. In most cases,  rebuilding the initrd will pick up the module loader configuration files, including any which may disable Nouveau. ( see the README.txt ).

Open a terminal and :
sudo nano /etc/modprobe.d/blacklist-nouveau.conf
Copy and paste the following lines :

blacklist nouveau
options nouveau modeset=0


Hit Ctrl+O , Enter and then Ctrl+X

Rebuild initrd :

sudo update-initramfs -u

Reboot and after rebooting do not login and switch to the first virtual (not graphic) terminal by :
Ctrl+Alt+F1
login with your username and password and stop the X-server by : sudo service lightdm stop
Navigate to the downloaded NVIDIA-run file :
cd Downloads and
sudo sh NVIDIA-Linux-x86_64-340.46.run

The .run file is a self-extracting archive. When executed, it extracts the
contents of the archive and runs the contained nvidia-installer utility,
which provides an interactive interface to walk you through the installation.

nvidia-installer will also install itself to /usr/bin/nvidia-installer,
which may be used at some later time to uninstall drivers, auto-download
updated drivers, etc.

Accept the license and answer the following questions :
The distribution-provided pre-install script failed!  Are you sure you want to continue? (Answer: Continue installation)
Would you like to register the kernel module sources with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later. (Answer: No)
Install NVIDIA's 32-bit compatibility libraries? (Answer: Yes)
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?  Any pre-existing X configuration file will be backed up. (Answer: Yes)

Your X configuration file has been successfully updated.  Installation of the NVIDIA Accelerated Graphics Driver for Linux-x86_64 (version: 340.46) is now complete.

A log file can be found in /var/log/nvidia-installer.log

Start the X server again :
sudo service lightdm start

In order to have nvidia-settings in Slingshot-launcher navigate to /usr/share/applications and copy NVIDIA X Server Settings to ~/.local/share/applications.
Right click the file and choose Properties.

At Owner click Write button, so that we can modify the file.
Right click the file and choose Open With Scratch.
Change the line Categories=Application;Settings; into Categories=System;Settings;

Applications > NVIDIA X Server Settings


If you wish to uninstall the Nvidia-driver, just open a terminal and :

sudo /usr/bin/nvidia-uninstall

10 comments:

  1. Very nice tutorial. Thanks!

    ReplyDelete
  2. Thank you very much, this helped me immensely.

    The new drivers have stopped my system from locking up during 3D games and has seen my GLMark2 score climb from 34 to 876!

    ReplyDelete
  3. My eOS was not able to see the desktop anymore after following your guidelines. Please help!

    ReplyDelete
  4. Great article, Eric! I've always had problems regarding the install of propietary drivers in Linux, but with your tutorial I didn't waste time. Thank you!

    ReplyDelete
  5. Whene i start lightdm again at the end, i just get a black screen, restart the computer, still black screen.

    ReplyDelete
  6. I have the same problem, black screen, lightdm can't start.

    ReplyDelete
  7. I have the same problem, black screen, lightdm can't start.

    ReplyDelete
  8. WARNING to anyone googling their way in here, this will make it impossible to boot your system! I followed these instructions to a letter on a fresh install of Mint 17 and now my boot hangs on a black screen. If you really do want to attempt these instructions, backup all your data and set aside enough time to re-install your system.

    ReplyDelete
  9. I knew I was taking a risk based on the comments, but works perfectly on eOS Freya 0.3.2

    ReplyDelete