180

I just ordered the Nvidia GTX card. I have a dilemma, though. Should I keep using the driver which is available in "additional drivers" in Ubuntu, or should I install the driver from the Nvidia site?

So which driver is the best for me?

1

14 Answers 14

268
+150

Updated - January 25, 2020

1. The quick way

Before adding this PPA, please read the PPA's Description on their page which mentions important information about using it, which version is right for your Nvidia card and more. This is for desktop users who want the latest version of the driver or the last supported one for their card.

Using 18.04+ To install run the following command:

sudo add-apt-repository ppa:graphics-drivers/ppa

This will automatically update the repositories and then you can run the following line:

sudo apt install nvidia-driver-440

If your desktop does not load after installing the corresponding driver, then do the following:

sudo nano /etc/gdm3/custom.conf

then remove the comment (# symbol) from the line that says

# WaylandEnable=false

and save. Then reboot. If this still does not work, then please disable Secure Boot since you might actually be using UEFI.

2. Common questions regarding Nvidia

For Troubleshooting Nvidia Problems or Overclocking Settings please see this answer which covers:

  1. What common bugs are solved by using the latest drivers?
  2. My video card is not installing (Installation problems)
  3. Tuning and Tweaking by Video card
  4. Quick way of setting default screen resolution

Top questions asked about video cards discussed below:

  1. Can I use the latest driver on an older version of Ubuntu?
  2. Difference between video cards & drivers: Official Nvidia site, Ubuntu's Default, PPA & Nouveau?
  3. What PPAs are recommended when using any video card?
  4. How to know which driver or package to install?
  5. How to install a driver?
  6. Difference between Proprietary Drivers?
  7. How to know if my video card is supported in Ubuntu?

2.1 Can I use the latest driver on an older version of Ubuntu?

Since 12.04+, video drivers are maintained and updated more often. It is easier to handle and solve the problems that showed with older ones. You most likely won't need additional PPAs unless you have the latest Nvidia card.

2.2 Difference between video cards & drivers: Official Nvidia site, Ubuntu's Default, PPA & Nouveau

I recommend them in the following order according to problems found, how the "out of the box" experience feels to end users, how compatible they are, how easy it is to update, install or remove and how it will feel once you have it set up:

  • Nvidia PPA - Great Performance. It works out of the box for most cards by using the driver included in the PPA (Which are different for each generation of Nvidia cards.

  • Ubuntu Default Recommended Drivers - Ubuntu does an amazing job in figuring out which Nvidia driver you need depending on the card you are using.

  • Nouveau - This is the open source implementation of the Nvidia driver. They also do an amazing job and although they are not on par with the official drivers or the ones in the PPA (Even more so with the latest Nvidia cards), the speed of development, the commitment, dedication and advancements that they do per week, gives confident that this is in fact an option to have and promote.

  • Official Nvidia Site - These are the official drivers (Same as the ones in the PPA), the key difference is that they do not upgrade automatically and have some issues when updating, uninstalling and installing (Very rare but it happens).

The differences can be summed in the following points:

Official Site

  • Offers the latest driver
  • Installation is through the terminal
  • When an update appears you have to manually download the new package
  • It has more issues than any other method (Specially for Nvidia)

PPA Repositories

  • Offers the latest driver hours/days after its official release
  • Installation is either through terminal or GUI
  • If you have a previously installed a driver it will update the package automatically
  • When an update appears you will be notified to update using the Update Manager
  • It is more stable and tested than the official ones
  • It has less issues than using any other method (Less issues for all video cards)
  • It is the 1st recommended way for Nvidia Cards.

Default Ubuntu Drivers

  • For every new release the drivers get better and better
  • Gets updated less frequently than a PPA
  • In most cases the drivers will work out of the box (Nouveau for Nvidia)
  • Not up to date when compared with the official site or a PPA
  • It is by far, more tested in Ubuntu than any other way (PPA or Official)
  • Easier to update

2.4 How to know which driver or package to install?

Depending on how many video cards you have and if they are integrated or not, the installation method and packages to install will change from the PPA mentioned above which is for Single Cards.

Computer with two video cards in hybrid mode

Starting with Nvidia 319.xx, both Nvidia Optimus and the common PCIe drivers are integrated into one, so if you install the Nvidia-319 package or newer, you will get the driver for the Integrated Nvidia cards and also for the PCI ones.

There are two solutions possible for hybrid cards: The first one is a package called bumblebee, which is able to use different configurations for different applications. To install it, run:

sudo apt install bumblebee linux-headers-generic

The second one is an official NVIDIA package called nvidia-prime, which is automatically installed together with the nvidia-355 package. It is able to decide on which card to use at profile level, i.e. when the user logs in. This decision is adjustable at NVIDIA X Server Settings Control Panel. Note that nvidia-prime and bumblebee are incompatible: If bumblebee is installed then nvidia-prime won't function correctly, and its options won't be shown at NVIDIA X Server Settings Control Panel. You'll have to 1. remove bumblebee 2. reinstall nvidia-430 in order to make it work again.

After this, it is recommended to turn off the computer and then back on.

The following picture should be seen with nvidia-prime installed, but not necessarily when bumblebee is also installed.

Computers with a SLI setup

If you have 2 or more video cards in SLI mode you can do the following:

  • For NVidia cards, when creating the Xorg.conf add the following to the line:

    sudo nvidia-xconfig --sli=On
    

Lastly, Ubuntu has a neat way of recommending which driver to use depending on your video card and drivers available (This is why I also recommend adding the PPAs first). Simply type:

ubuntu-drivers devices

It should show you a list of driver packages available for your hardware, including but not limited to the video card. If you wish to see which driver is recommended for your video card then simply type the following:

ubuntu-drivers devices | grep recommended

2.5 How to install a driver?

The method used will depend on how many video cards you have and which type of video cards you are using. The following are some of the ways of installing an Nvidia video card:

NVIDIA (old drivers that need the headers)

For Nvidia, many times you need to first install the header files of the kernel version you are using at that moment for the driver to install correctly. So you would first need to execute the following line:

sudo apt-get install linux-headers-generic

And then install the package related to the driver (nvidia* for Nvidia cards). In other cases you might need to go a little further and install the sources and specific header files, for example:

sudo apt install linux-source linux-headers-3.5.0-16-generic

which installs the linux-source package and the specific header file assuming you have in this case the 3.5.0-16-generic kernel version.

To check which version you have at any given time type uname -r which should give you the specific kernel version in use.

For Nvidia, it depends on the video card and package needed for it, for the latest video cards and assuming you added the PPA mentioned above, the terminal line would be:

sudo apt install nvidia-driver-440

The number at the end would change depending on how old your video card is or how new it is (Some versions available are 390, 410, 415 and 418).

For GeForce 10, 20 and RTX series GPUs use nvidia-430
For GeForce 8 and 9 series GPUs use nvidia-340
For GeForce 6 and 7 series GPUs use nvidia-304

The latest versions bring more fixes and correct issues related to graphics corruption, HDMI support, thermal support and more for the latest Nvidia cards. Normally, updating the video drivers solves many issues.

Note that Fan Control and any other Nvidia features that are not found on the nvidia-settings app, are not Ubuntu related, but Nvidia related. I would recommend, asking the Nvidia developers in the official Nvidia forum about features you may want to include (Fan Control, Overclocking features, etc...)

CUDA

For CUDA you can follow this link Installing and testing CUDA in Ubuntu 14.04

Bumblebee

For Bumblebee (NVIDIA Optimus) you can use the following PPA (Ubuntu 15.04+ users can optionally not do this since it is already included):

 sudo add-apt-repository ppa:graphics-drivers/ppa
 sudo apt-get update
 sudo apt-get install bumblebee linux-headers-generic

2.6 Difference between Proprietary Drivers?

Please visit Difference between Additional Drivers (Nvidia) for more information about Proprietary Drivers.

2.7 How to know if my video card is supported in Ubuntu?

Here are a couple of hints to know if your video card is supported in Ubuntu:

  • If the video card existed BEFORE the release of the Ubuntu version you are using, it has a 99% change it will be supported.

  • If the video card appeared less than 6 months AFTER the release of the Ubuntu version you are using and you kept that Ubuntu version updated, then you have a pretty good chance it will be supported.

  • If you added one of the PPAs I mentioned above then you have a 99.99% chance that it will be supported.

  • Checking the Nvidia Site or the PPA for support might yield a quicker answer, but in almost 100% of all cases, your video card will be supported either by the open source driver or by the proprietary driver.

  • Using the latest Ubuntu version will also improve your chances of having your latest video card supported.

In general, I make it a rule of thumb that if you have the latest video card or almost one of the latest video cards, you will need the latest drivers. So always install the latest drivers through the PPA or the Software Sources that come with Ubuntu if you have the latest Nvidia card.

NOTE - Ubuntu might show in the Graphics option in "About This Computer" the value Unknown. If this is happening, please install the mesa-utils package.

This answer is oriented towards resolving common Nvidia bugs (Black screen, drivers not working in general, low FPS, etc...)

  1. What common bugs are solved by using the latest drivers?
  2. My video card is not installing (Installation problems)
  3. Tuning and Tweaking by Video card
  4. Quick way of setting default screen resolution

2.7.1 What common bugs are solved by using the latest drivers?

Common bugs shared by all video cards are:

  • Missing Unity launcher or panel
  • Missing options inside Nvidia Settings
  • Desktop does not appear (Black screen)
  • Top/Bottom of the screen are cut out
  • Video looks cut into pieces
  • Higher Resolutions are not usable (Not found)
  • Video shows with VGA but not with HDMI (And Vice Versa)
  • Suspend not working on Laptop when closing Lid
  • Fan speed makes a lot of noise or is always at full speed
  • Heat Problems
  • nvidia-xconfig not creating xorg.conf correctly

If you happen to have any of this, it is a good idea to add one of the PPAs and update your video drivers to the latest they can manage. In almost all cases, the problem is solved after updating and rebooting. For these cases I also recommend using the Graphics Drivers PPA.

I also invite you to take a look at some of the related questions:

Which ATI/AMD, or Intel, or NVIDIA Graphics for Unity?

What is the correct way to install proprietary ATI Catalyst Video Drivers (fglrx) directly from AMD?

How to correctly enable Desktop Cube in Unity 3D?

Enable HDMI audio for an Nvidia card

How do I enable desktop visual effects?

NVIDIA drivers not working after upgrade. Why can I only see terminal?

Desktop does not show when I installed nvidia drivers!

Black screen on latest Nvidia/Ati Cards when starting LightDM/Ubuntu

HDMI/VGA connection cuts borders of screen or creates blurry text

/etc/X11/xorg.conf doesn't exist?

Installing latest Nvidia from Xorg PPA gives black screen

Now some pointers I want to mention:

  • For NVIDIA Cards, it also helps to create the xorg.conf file using the nvidia-xconfig command line. Just go in the terminal to type the following and then reboot:

    sudo nvidia-xconfig
    

    Know that if nvidia-xconfig throws one of the following errors you most likely need to delete the existing xorg.conf file first before executing the nvidia-xconfig command again:

    • VALIDATION ERROR - It can mention section missing, incorrect information in a section, not closed sections or simply requiring at least 1 section to proceed.

    • WARNING - It can mention several errors in values regarding any parameter found in a section, for example not specifying explicitly a value for a parameter.

    • FATAL SERVER ERROR - After running nvidia-xconfig you can get in small cases a "no screens found" error which most likely means that the recommendations mentioned above like installing the PPA were not applied first or a possible module is still working (Either the nouveau is loading or an nvidia driver installed using the Nvidia driver package from the nvidia site.

    • ERROR - You will get an error similar to Unable to write to directory '/etc/X11' if you executed the nvidia-xconfig command without sudo. If the error persists via the nvidia-settings you need to delete the xorg.conf file first.

    For all the cases where you need to delete the xorg.conf file, please make sure to backup any changes to did to it before deleting it.

  • Reinstalling the driver solves several issues. For example, if you are using the nvidia-graphics-drivers-355 driver package, then do the following to reinstall it:

    sudo apt-get install --reinstall nvidia-graphics-drivers-355
    
  • Reinstalling Xorg also helps in other cases:

    1. Remove existing xorg using the following command

      sudo apt-get remove --purge xserver-xorg
      
    2. Install xorg using the following command

      sudo apt-get install xserver-xorg
      
    3. Reconfigure xorg using the following command

      sudo dpkg-reconfigure xserver-xorg
      
    4. After this it is recommended to reinstall the video driver if you are using Nvidia or ATI as mentioned above.

I have to add that if you suffer from Black Screen after installing the Nvidia drivers from the PPA and rebooting (And you don't have a Hybrid System) then your problem might be the need to remove the bumblebee package along with the bumblebee.conf file. Follow the steps provided in Installing latest Nvidia from Xorg PPA gives black screen for this or simply run the following lines:

sudo apt-get purge bumblebee primus   
sudo rm -fr /etc/modprobe.d/bumblebee.conf
sudo reboot

2.7.2 My video card is not installing correctly (Installation problems)

Most installation problems related to ATI or Nvidia can be solved by following the steps provided in Can not install Nvidia driver but in short I can summarize that in the following steps assuming you have one of the following issues:

  • Installed the official Nvidia drivers and have a problem updating or removing them
  • Screen looks wrong/corrupted
  • Unity does not load of fails to load
  • Can not access the GUI environment in no way

If you have installed the official Nvidia Drivers, follow all steps below after having started Ubuntu in Recovery Mode. If not, skip to step 2:

  1. If you installed the Nvidia driver from the Nvidia site or the ATI driver from the official AMD site, then type the following on the terminal (In this example assume you have the Ubuntu 64Bit with the 304.51 version of Nvidia):

    sudo sh NVIDIA-Linux-x86_64-304.51.run --uninstall
    
  2. If you have install any nvidia package like nvidia-current or nvidia-current-updates remove them. Same goes with ATI drivers. sudo apt-get remove nvidia-current for example.

  3. ANY change you did to blacklist the Nvidia/ATI driver for instance or changes to any other files related to the Nvidia/ATI drivers should be reversed. This is just in case you went ahead and started editing like crazy (Which happens I know ^^).

  4. Delete or backup/move the xorg.conf file. You will not need this file right now.

  5. After doing all the steps above then Reboot the PC and make sure it loads with Nouveau and not with any Nvidia drivers for Nvidia cases or with ATI drivers and not with fglrx for Ati/AMD cases.

  6. If right now you KNOW you are running Unity with the Nouveau driver (Or ATI open source driver) or if you just happened to get a video error, or it just fails to correctly load LightDM, do not worry, all 3 options will end the same way. When rebooting, in the GRUB menu, select the "Recovery Mode". After the recovery mode shows you the recover options, choose the root option or the Failsafe X option. In this modes and after all previous steps have been done, install the Nvidia/ATI driver using the PPA I mentioned above. Always try to install the latest driver if you have a recent video card: sudo apt-get install nvidia-430 for Nvidia cards or sudo apt-get install fglrx for the latest Ati/AMD Cards. Remember there should not be anything installed before doing this in regards to Nvidia/ATI drivers (Except obviously the Nouveau drivers).

  7. Now reboot and all should work.

NOTE - In Step 6, if it looks as though the PC is stuck loading just press CTRL+ALT+F1 to go to the TTY1 terminal and do step 6 from there.

Other common installation problems involve resolution. You can check and change the resolution via terminal in the following way:

  1. Open the terminal and type xrandr this will show you all possible supported resolutions (This depends on your video card and monitor/tv). Take note on the order they appear listed. The first line that shows the resolution is line 1, the next one is 2 and so on for all resolutions supported. A value of 0 will reset the resolution to the default one after you actually set a resolution.

  2. Type xrandr -s X where X is the line number as mentioned above. So it would look something like: xrandr -s 1.

    Lastly for users that have reported not seeing the Unity Launcher/Panel after updating the Kernel and/or Nvidia version, the first thing to do is to check if the Unity Plugin is enabled. For this go to the Compiz Config Settings Manager (Am assuming it is already installed) and go to the Unity Plugin. Check to see that the checkbox for it is activated. If not then activate this option and follow the on-screen suggestions.

2.7.3 Tuning and tweaking my video card

For Nvidia Video Cards follow these steps:

  1. In the terminal type: sudo nano /etc/X11/xorg.conf

  2. Find the device section and add the following line:

     Option "Coolbits" "4"
    

it should look something like this:

 Section "Device"
     Identifier     "Device0"
     Driver         "nvidia"
     VendorName     "NVIDIA Corporation"
     Option         "Coolbits" "4"
 EndSection

Now save and reboot. You should now see (Depending on your video card model) a new option about Fan Speed like this:

A brief explanation of CoolBits:

CoolBits enables various unsupported features, such as support for GPU clock manipulation in the NV-CONTROL X extension. This option accepts a bit mask of features to enable. Which means a value of 0, 1, 2 or 4.

CoolBits = 1 - When "1" (Bit 0) is set in the "Coolbits" option value, the nvidia-settings utility will contain a page labeled "Clock Frequencies" through which clock settings can be manipulated. "Coolbits" is only available on GeForce FX and Above.

CoolBits = 2 - When "2" (Bit 1) is set it will attempt to initialize SLI when using GPUs with different amounts of video memory.

CoolBits = 4 - When "4" (Bit 2) is set the Thermal Monitor page will allow configuration of GPU fan speed, on graphics boards with programmable fan capability.

The default option is 0 (unsupported features are disabled).

As of Nvidia 337.XX the following options are available:

CoolBits = 8 - When "8" (Bit 3) is set the PowerMizer page in the nvidia-settings control panel will display a table that allows setting per-clock domain and per-performance level offsets to apply to clock values. This is allowed on certain GeForce GPUs in the GeForce GTX 400 series and later. Not all clock domains or performance levels may be modified.

CoolBits = 12 - When "12" (Bit 3 + 2) this will be the same as activating the effects of Coolbits 8 + Coolbits 4. So you will get the new overclocking features and fan control.

This options can also be activated by issuing the following command:

nvidia-xconfig --cool-bits=4

WARNING: this may cause system damage and void warranties.

I also want to add that the information for Proprietary drivers is typically saved in the home folder. For example, the information saved by nvidia-settings is stored in ~/.nvidia-settings-rc which you can access by typing the following:

nano ~/.nvidia-settings-rc

I mention this because if the xorg.conf is not used, then how do the settings for ATI or Nvidia work? The reason is that X can automatically detect and configure many options of xorg.conf like input/output devices and Video cards. This did not happen automatically before, but since 2010, X can handle many options and detect them without any problems or the need to configure a file for them.

Note that, many of these are still present but divided into more specific files in /usr/share/X11/xorg.conf.d/

For example, some video cards do not show the Unity Launcher or top panel unless xorg.conf is present. In other cases, users that want to tweak their video card, may need the Coolbits option which is added to xorg.conf. These are the reasons why nvidia-xconfig exists. To provide an additional level of support in case X does not detect or offer all the options for the video card.

Another trick is to run update-pciids so it updates the PCI Id List. On very rare cases, the ID is not found or detected incorrectly for the video card (Actually any PCI device) so this will help solve any problem related to it.

In some cases it also helps to change the Texture Filter value to Fast in the OpenGL Plugin inside the Compiz Config Settings Manager.

Lastly, changing the Image Settings options to "High Performance" in the OpenGL Settings of the Nvidia Settings Panel can help in some cases.

2.7.4 Quick way of setting default screen resolution

I have read and done some of the tips about using xrandr or editing the xorg.conf file, but the quickest way that I found was literally editing the ~/.config/monitors.xml file and changing the resolution around lines 15 to 18 (The ones that mention Width, Height and Rate). So set the correct Width, Height and Rate and reboot to test this. This is only to set the default resolution you wish to see once the computer starts.

24
  • 6
    This completely saved me and I really think that this documentation should go on Ubuntu's site or somewhere more accessible. It took a few days to search through and find this (especially the tool that recommends the proper driver which was my whole issue from the start) Aug 20, 2013 at 16:17
  • 2
    I tried to edit this but could not (there's a size limit :/) Anyway, people should note that X SWAT is no longer available after Quantal! Aug 21, 2013 at 13:03
  • 3
    I vote this answer of the year. :) The last time I had to deal with Ubuntu + nVidia was back in 2007 and I was worried I'd have to go through the same issues. Thanks to Luis's post, the installation went so smooth. Sep 15, 2013 at 11:15
  • 1
    @Fabby Your comment has killed a cat... also that is why I added the Link there as a "Xorg title". But yes, I will follow your excellent advice and point to this. Thanks buddy. Feb 1, 2015 at 15:56
  • 1
    lol. Was reading my article and yours. Excellent job on it btw. Nov 10, 2015 at 14:22
26
+100

First of all you should identify your NVIDIA graphics hardware - so open a terminal and execute:

lspci -k | grep -EA2 'VGA|3D'

The following options should not all be taken.
Stop when you reach what you want to achieve.
The higher the number the more complex (and less stable) the solution.

Option 1 - Check for NVIDIA drivers available in the official Ubuntu repositories:

apt-cache search nvidia

Option 2.1 - Check for NVIDIA drivers available on Launchpad:

Proprietary GPU drivers PPA

Option 2.2 - To include the latest NVIDIA drivers - add the repository to software sources:

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update

Search for drivers ... you will see a list of drivers ... the version at the bottom is the newest one:

apt-cache search nvidia | grep -oE "nvidia-[0-9]{1,3}"

Option 3 - Search for drivers available on NVIDIA website:

NVIDIA GPU drivers releases

Then follow these steps :

Step 1.1 - Select the NVIDIA drivers you want to use and execute:

sudo apt-get install nvidia-<version_number>

Step 1.2 - In case the NVIDIA GPU has Optimus support execute:

sudo apt-get install nvidia-prime

Step 2 - To finish the drivers installation process execute:

sudo reboot

Additional information:

Supported NVIDIA GPU products

NVIDIA GPU drivers release information

NVIDIA support timeframes for legacy GPU releases

4
  • 4
    I suggest to change the answer a little bit. Make it more clear that the recommended way is to install from Ubuntu repository by sudo apt-get install nvidia-*. An optional way is to install from PPA. This will be good to have this answer. Already +1.
    – Pilot6
    Oct 2, 2015 at 15:23
  • 1
    And also it is good to add how to get the GPU model. lspci -k | grep -EA2 VGA|3D. It will show the model and if the driver is installed.
    – Pilot6
    Oct 2, 2015 at 15:24
  • 1
    you answers are very vague, options in your answer do not show the whole process properly but rather list them
    – Alex Jones
    Oct 2, 2015 at 15:44
  • Note: l̶a̶t̶e̶s̶t̶ supporting Your video card. Most of the cases proprietary video drivers will install on machine even if those doesn't support Your video card anymore. So, pick carefully. It should be mentioned in README section or/and on NVIDIA GPU drivers release information...
    – Kamiccolo
    Oct 2, 2015 at 16:34
7

Install the driver:

sudo apt-get update
sudo apt-get install nvidia-current
sudo apt-get update

Install mesa-utils to display graphics info:

sudo apt-get install mesa-utils

glxinfo | grep OpenGL

Restart the computer:

sudo shutdown -r now

Resolving problems:

Configure a /etc/X11/xorg.conffile to get all resolutions. Info about configuring xorg.conf Use gtf to create a mode line

Making a file called xorg.conf and putting it in /etc/X11. X will read the config file and try to accept your statements. It will then auto config anything you don't explicitly say.

Running nvidia-xconfig creates a fishbone with basic configuration. Similar commands for other binary drivers may exist.

sudo service lightdm stop
sudo X -configure
sudo mv xorg.conf.new /etc/X11/xorg.conf
sudo start lightdm

This will create xorg.conf.new file in your current dir. Now you should do the following:

  1. kill x server
  2. generate a new xorg.conf file
  3. rename and move
  4. return to GUI

Better GUI (arandr) for manipulating resolutions etc:

sudo apt-get update
sudo apt-get install arandr
7

You don’t need to use command line nor software centre to install NVIDIA drivers (also its best not to install it this way because sometimes you may boot to black screen.).

Ubuntu comes with NVIDIA drivers pre-configured (but not installed), all you need to do is:

  1. Open dash

  2. Search and launch Additional Drivers, wait for it to search, then select the driver you want to install. It comes with 2 drivers, one is open source Nouveau and proprietary from NVIDIA.

  3. Select the driver, press Apply Changes and wait. It may require some time and internet connection for it to download and install it for you.

  4. Now reboot.

enter image description here

I have selected the proprietary drivers

1
  • is Nouveau active by default? Wondering why it was the one selected for my system? changing to Nvidia now b/c I kept getting a black screen after restart Feb 11, 2020 at 23:30
6

The recommended way is to install the drivers from Ubuntu repositories.

Now all Nvidia adapters are supported by the drivers included in Ubuntu repositories. But this was not always the case and in the future some new adapters may appear that will not be supported by the Ubuntu official drivers for a while.

In most cases the system picks the correct driver in

System Settings -> Software & Updates -> Additional drivers.

First of all you need to find the model of your GPU.

Run in terminal lspci -k | grep -EA2 'VGA|3D' and you will get something like

01:00.0 VGA compatible controller: NVIDIA Corporation GF116 [GeForce GTX 550 Ti] (rev a1)
Subsystem: Gigabyte Technology Co., Ltd Device 351a
Kernel driver in use: nvidia

So, the model is GeForce GTX 550 Ti and some Nvidia proprietary driver is installed.

If the open source driver is in use, you will see

Kernel driver in use: nouveau

To check which proprietary driver is installed run:

dpkg -l | grep nvidia

The package marked with ii is installed.

You can check which driver version support this adapter at

Nvidia drivers site

For example my card is supported by 340, 346, 349, 352 and 355 major versions.

Now Ubuntu repositories have 340 and 352 driver versions for this adapter. It makes sense to install the 352.

It can be done from GUI as mentioned above or by running

sudo apt-get install nvidia-352

If your adapter is not supported by any driver from the official repositories, or you want to try the very latest one, you can install a driver from ppa.

Hybryd graphics

If you have a laptop with an Intel CPU, in most cases you will have also an Intel adapter that is built in CPU.

In this case you will have to install nvidia-prime package too. But if you install from the official repositories, it will be installed automatically.

Then you will be able to switch adapters in Nvidia X Server Settings (PRIME Profiles).

enter image description here enter image description here

Or you can do it in terminal.

  • sudo prime-select nvidia will switch to the Nvidia adapter.

  • sudo prime-select intel will switch to the Intel adapter.

  • prime-select query will show the current state.

You will need to log off and log on to apply the setting.

New adapters that are not supported by the nouveau driver

You may face a situation that you have a very new Nvidia adapter that is poorly supported by the open source nouveau driver.

In this case your system may be unable to boot to GUI.

You can refer to this answer and boot with nomodeset parameter. You will have to boot the system this way when you boot from LiveUSB, then install Ubuntu.

After you install Ubuntu, you will need to boot with nomodeset again and install the proper Nvidia driver.

When you boot in UEFI mode, that F6 option does not appear. In that case you will need to get to grub menu, press e and type in nomodeset manually.

4
  • did you try this method on your Ubuntu?
    – Alex Jones
    Oct 2, 2015 at 15:47
  • @edwardtorvalds This is the method I always use.
    – Pilot6
    Oct 2, 2015 at 15:47
  • @Pilot6 I have managed to Install Nvidia drivers from ppa by adding the 'nomodeset' in grub. However, now after the ubuntu and drivers are installed I can't login (login windows appears again after I hit login) unless I remove the 'nomodeset' from grub. Is there a solution to get nomodeset permanently removed??? or what else is causing this issue? Dec 10, 2015 at 23:47
  • You do not need nomodeset after you install the drivers. So remove it from /etc/default/grub and run sudo update-grub.
    – Pilot6
    Dec 11, 2015 at 9:09
5

Let the built-in ubuntu-drivers program decide automatically which proprietary graphics drivers to install. Open the terminal and type:

sudo ubuntu-drivers install   
sudo reboot   

The install command of ubuntu-drivers installs drivers that are appropriate for automatic installation including their dependencies. The graphics driver packages that are installed by these commands will receive software updates in the same way as other apt packages are updated.

4

Here is a detailed asnwer on how to get it done. It will list 2 ways of installing the latest Nvidia drivers on Ubuntu 12.10 to 14.04. Its best if you have synaptic installed on your system, because you will need it to install some files. If its not installed, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

sudo apt-get install synaptic

All the steps listed require the use of Terminal. To open it, just press Ctrl+Alt+T on your keyboard

The first way:

First thing to do is Update your Ubuntu distribution

sudo apt-get update && sudo apt-get dist-upgrade

Reboot if required.

Download the latest driver for your distribution from Nvidia

Install linux-source + linux-headers-generic + dkms (Using Synaptic Package Manager)

enter image description here enter image description here enter image description here

Install Build Essentilas, gcc and g++

sudo apt-get install build-essential gcc g++

Reboot your system at this point.

Once system is backup and running, edit /etc/modprobe.d/blacklist.conf, and add the following lines to the end of the file

blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv

Save and exit the file.

Remove any current Nvidia drivers

sudo apt-get remove --purge nvidia*

Remove any xserver-xorg-video-nouveau drivers

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

Edit grub file

sudo nano /etc/default/grub

From the line that has GRUB_CMDLINE_LINUX remove "quiet splash" and replace it with "text"

Update grub using the following commands

sudo update-grub
sudo update-initramfs -u

Reboot your system at this point. Once system reboots, it will be in text mode. Login to your system, and then do

sudo su

(enter your password)

cd Downloads

(providing that the Nvidia downloaded file was savwe there)

sh xxx.run 

(where xxx is the Nvidia file name) Click OK If a message comes up regarding the driver, click on yes (its very important that you click yes) Wait for the installation to finish, then

sudo nano /etc/default/grub

From the line that has GRUB_CMDLINE_LINUX remove "test" and replace it with "quiet splash" then do

Ctrl+xyenter to save the file and exit.

Update grub using the following commands

sudo update-grub/
sudo update-initramfs -u

Reboot, and you're set.

The second way:

Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

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

enter image description here

Both methods have been tested with Nvidia Driver Version 340, and they both work OK. Many updates have been done after the fact, and everything works OK.

3

Wanted to throw my caveat out there on the subject after spending last 2 days with this.

I've been using Ubuntu for years. Last week I retired my old quad core AMD 940 based pc and built a new AMD 8350 8 core with asus mobo and for a video card since I don't play games I bought a new GTX 650 gpu card.

After installing the GTX 650.. it worked fine with the Noveau driver but I wanted to use the video cards HDMI port and for whatever reason that didn't work w/my HP w2207h monitor.

NOTE:  I'd actually never tried the hdmi port on that monitor before so I don't know if 
it ever worked as that monitor is now nearly 4 years old.

So I first installed the Ubuntu NVIDIA "Current Proprietary" tested.

Still no HDMI but the unity desktop etc all still worked ok.

Thinking maybe I should try the linux driver directly from NVIDIA I went to their driver section, searched for the linux GTX 650 card and downloaded that .run file - where is going to be some long driver name.

Next step for those new to ubuntu/unity

Press ctrl + alt + F1 puts me in a terminal

Next before you will be able to apply the NVIDIA driver you have to kill the LIGHTDM that is still running in the background.

       $ sudo service lightdm stop

Once lightdm is stopped you have to change the .run file to be executable:

       $ sudo chmod +x ./<nvidia>.run

then finally execute the new driver install program.

       $ sudo ./<nvidia>.run

this will start and ask you multiple questions you will have to answer.

when its done you reboot.

Now my warning.

Before you start doing all of the above you should either have a 2nd computer/laptop available so you can look up how to reverse the above if you have problems -or- you should have printed out all the info you need INCLUDING:

the command line you would need to "purge" the new Nvidia driver

       $ sudo ./<nvidia>.run --uninstall

once done you must install some video driver BEFORE you reboot unless you left the Noveau driver installed (re you didn't remove it -- which most say is not required to have tried the above NVIDIA proprietary driver).

Next... make sure you know the command line required to reinstall the Noveau driver if you have to.

So why did I post this?

I was quite careful installing the NVIDIA websites latest driver for the GTX 650 card.

However, after a reboot my Ubuntu 12.10 Unity desktop was crazy with various problems.

  1. I use synaptic but couldn't use it because launching it would just minimize it to the Unity tool bar on the left from which I couldn't make it appear on screen
  2. I couldn't launch the "System Settings" from desktop or from cli. It did the same thing as synaptic
  3. I found my mouse might or might not appear on the screen when I logged in. If not I'd have to do a shutdown ... not a reboot... to get it bac

Because I had not taken the time to prepare myself with how to remove that driver and reinstall a working one from the command line (remember I couldn't use the System Settings tool ?? ... it was a real pain to get back to my previously working system.

So do as the Boy Scout model says "be prepared" before you start down this road.

Worst of all for me... Even with NVIDIA's latest driver installed I could NOT get the HDMI port on the GTX 650 to display to my monitor. To double check I attached the HDMI cable to a 2nd much newer HDMI capable Monitor and still got NO SIGNAL with that.

So I am back to square one still trying to get my HDMI port to work BUT... glass 1/2 full I did learn alot in the process.

Hope this helps others.

1
  • 1
    Boy... never I never learn! My writeup above stated I had built a new PC and had just bought a new GTX 650 Nvidia graphics card which I could NOT connect using HDMI to 2 diff monitors. Today I thought well maybe its the NEW HDMI cable I'd just bought so I swapped HDMI cables with one from one of my TVs ... and it worked. So the new HDMI cable was no good.
    – bmullan
    Jan 28, 2013 at 19:36
2

A simple command-line installation method (a text-based variant of the answer by @edwardtorvalds):

  1. Run the command

    ubuntu-drivers devices
    

    (/usr/bin/ubuntu-drivers is provided by ubuntu-drivers-common, which is included as a package since 14.04, and available as an app in earlier releases.)

  2. After a few seconds, you should get output that looks like this:

    == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
    modalias : pci:v000010DEd00000DE1sv000019DAsd00001167bc03sc00i00
    model    : GF108 [GeForce GT 430]
    vendor   : NVIDIA Corporation
    driver   : nvidia-346-updates - distro non-free
    driver   : nvidia-340-updates - distro non-free
    driver   : nvidia-304-updates - distro non-free
    driver   : nvidia-340 - distro non-free
    driver   : xserver-xorg-video-nouveau - distro free builtin
    driver   : nvidia-304 - distro non-free
    driver   : nvidia-346 - distro non-free recommended
    

    The recommended driver is nvidia-346, so run

    sudo apt-get install nvidia-346
    

    (Since nVidia drivers are non-free software, you'll need to first ensure that the multiverse repository is enabled.)

1
  • for step 2, to quickly find the recommended driver, just run: ubuntu-drivers devices | grep recommended Apr 23, 2016 at 13:05
2

Its available in Default Repositories.

From now on, Nvidia drivers are available on default repositories. So no need of any ppa.

Execute :

sudo apt-get update
sudo apt-get install nvidia-361

As of now, nvidia-361 is the most recent version available on default repositories. You might want to make it sure by searching all the available drivers by apt-cache search nvidia

1
2

There are a lot of solutions out there but here is what actually worked for me (suppose you have a fresh installation of Ubuntu 16.04 and nvidia binary driver downloaded)

  1. If you have dual boot, go to your BIOS settings and turn the secure boot option to "other OS";

  2. Press Ctrl+Alt+F1 in the login session to enter the TTY-1 and do the following:

    sudo apt-get install linux-source
    sudo apt-get install linux-headers
    
  3. Before install the driver, stop the lightdm by:

    sudo service lightdm stop
    
  4. Run the NVIDIA script

    sudo ./NVIDIA-Linux-x86_64-378.09.run
    

During the installation you may receive a warning saying "Distribution provided script failed", just ignore it.

1
  • Wow, you saved me! I do have dual boot and your step 1 really helped me. I couldn't repeat other steps, but this one was sufficient: Switched "secure boot" to "other OS", rebooted and installed the driver with gui (Software & Updates). It worked!
    – Dany
    Dec 8, 2019 at 13:43
1
  • Download the driver and place it in your home directory

Download for 64bit: http://www.nvidia.com/object/linux-display-amd64-295.53-driver.html

Download for 32bit: http://www.nvidia.com/object/linux-display-ia32-295.53-driver.html

  • Do: ctrl + alt + F6 (Warning: This will switch you to a TTY, no GUI)
  • Login using your username and password
  • Type: sudo service lightdm stop
  • Type: sudo ./NVIDIA*
  • Type: sudo reboot

The driver should work with no problem now (I just did this with my GTX 570)

Test the driver by opening a terminal: (ctrl + alt + T)

  • Type: glxinfo | grep direct It should report back: direct rendering: Yes
  • To adjust your NVIDIA settings Type: nvidia-settings

NOTE: The script should blacklist the nouveau driver by default. If the NVIDIA driver isn't working, try to do this manually:

  • Type: sudoedit /etc/modprobe.d/blacklist.conf

Append the following lines:

blacklist nouveau
options nouveau modeset=0
  • Type: sudo reboot
1

The problem you're running into is that you don't have the linux source, so you can install the nvidia driver. I believe what you want is the linux headers for your kernel version.

sudo apt-get install linux-headers-generic should install the correct headers, which then will allow you to continue from where you left off.

1

It got easier with 346.72, at least with Lubuntu and MATE 14.04. I hit Ctrl+Alt+F1 and it took 5 commands. Steps that worked for me are as follows:

  1. Download from NVidia site.
  2. Hit Ctrl+Alt+F1 to go to the tty and log in.
  3. sudo service lightdm stop
  4. cd /path/to/file
  5. sudo chmod +x NVIDIA-Linux-(asterisk)-346.72.run && sudo sh NVIDIA-Linux-(asterisk)-346.72.run
  6. Everything goes off without a hitch with 64 bit. The pre-install script failed but I told it to install anyway. From there, it was basically "yes, yes, yes".
  7. sudo service lightdm start or some variation of this command. They were slightly different for Lubuntu and MATE.

No need to generate an xorg.conf because it did that when I answered yes during the installation. Also, no need to blacklist nouveau before installing. The only hitch I encountered was when I installed the same driver for a 32 bit OS. It told me that it needed a gcc+ package which I got on my first google.

2
  • Why not just add the ppa?
    – Tim
    Jun 2, 2015 at 17:26
  • The ppa didn't work for me for some reason. Maybe others have a different experience, but every time I tried it, it gave me several drivers but not the latest. I'd put nvidia-346 and ended up getting a couple legacies, a relatively recent one, and an open source driver, but not the one I wanted. This was after both Ctrl+Alt+T and Ctrl+Alt+F1 plus stopping lightdm. There were a lot of different answers for the ppa problems, so I tried the method I posted to see if it was more expedient, and it was.
    – Ben Doidge
    Jun 2, 2015 at 17:33

You must log in to answer this question.

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