How to install Nvidia GPU drivers on Ubuntu Linux

The post offers instructions on installing Nvidia GPU drivers for Ubuntu Linux, detailing how to use the open-source Nouveau driver or Nvidia’s proprietary drivers. Updates can be sourced from Nvidia’s official PPA repository, with specific drivers suggested for varying graphics cards. Systematic steps and command lines for installation and settings modifications are provided, with a…

This post shows students and new users steps to install Nvidia drivers on Ubuntu Linux.

Linux, including Ubuntu, is rapidly being installed on advanced computers with proprietary graphic cards and drivers to support them.

If your Ubuntu computer has an NVIDIA GPU, you can choose between the open-source driver Nouveau and NVIDIA’s proprietary drivers. By default, Ubuntu will use the Nouveau drivers.

However, if you want serious performance with your Nvidia GPU card, you may enjoy getting fresh drivers from upstream, which is currently shipping with Nvidia cards.

You can use the Nvidia official PPA repository to get the latest drivers for your graphics cards. The current official release is `Nvidia-387` (387.34), and the current long-lived branch release is `Nvidia-384` (384.98)

Specific graphics cards should use the list below:

For G8x, G9x and GT2xx GPUs use `Nvidia-340` (340.104)
For NV4x and G7x GPUs use `Nvidia-304` (304.137)

When you’re ready to install the PPA and drivers, continue below.

How to add official Nvidia PPA to Ubuntu

To add the driver’s repository to Ubuntu, run the commands below:

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

When you run the commands above, getting a prompt to accept the repository signing key would be best. Then, accept and continue installing the PPA.

How to update and install Nvidia Drivers

Now that the PPA has been installed, run the commands below to install the latest drivers for your system.

sudo apt update
sudo apt install nvidia-387

After installing the drivers above, reboot your system to enable the new drivers.

How to install cards specific drivers

If you want to install the drivers for the specific cards installed on your systems, use the list below:

For G8x, G9x and GT2xx GPUs use `Nvidia-340` (340.104)
For NV4x and G7x GPUs use `Nvidia-304` (304.137)

Reboot after installing as well

For support timeframe for these cards, see the official page below.

https://nvidia.custhelp.com/app/answers/detail/a_id/3142

Also, once logged back in, you may want to open Software & Updates under System Settings, go to the Additional Drivers tab, select the required driver version, and click “Apply Changes.”

This is how you install Nvidia GPU drivers for computers with Nvidia cards installed.

Conclusion:

This post showed you how to install and use NVIDIA drivers on Ubuntu Linux. Please use the comment form below if you find any errors above or have something to add.

Richard Avatar

Comments

  1. Mike Shaw Avatar
    Mike Shaw

    Seems to be broken:

    $ sudo add-apt-repository ppa:graphics-drivers/ppa
    Cannot add PPA: ‘ppa:~graphics-drivers/ubuntu/ppa’.
    ERROR: ‘~graphics-drivers’ user or team does not exist.
    $

    1. Theodore Pollock Avatar
      Theodore Pollock

      Have you tried manually going in there to add the repository manually? I had the same problem myself although it was because I hadn’t connected to the internet yet. But since your posting I’m going to assume you’ve connected to the net, and I would have you try to add it manually.

  2. nvidia-304 seems to be broken. On lubuntu 18.04:

    sudo add-apt-repository ppa:graphics-drivers
    [sudo] password for user:
    Fresh drivers from upstream, currently shipping Nvidia.

    ## Current Status

    Current short-lived branch release: `nvidia-396` (396.24)
    Dropped support for Fermi series (https://nvidia.custhelp.com/app/answers/detail/a_id/4656)

    Current long-lived branch release: `nvidia-390` (390.48)
    Old long-lived branch release: `nvidia-384` (384.130)

    For G8x, G9x and GT2xx GPUs use `nvidia-340` (340.106)
    For NV4x and G7x GPUs use `nvidia-304` (304.137) End-Of-Life!

    Support timeframes for Unix legacy GPU releases:
    https://nvidia.custhelp.com/app/answers/detail/a_id/3142

    ## What we’re working on right now:

    – Normal driver updates
    – Help Wanted: Mesa Updates for Intel/AMD users, ping us if you want to help do this work, we’re shorthanded.

    ## WARNINGS:

    This PPA is currently in testing, you should be experienced with packaging before you dive in here:

    Volunteers welcome! See also: https://github.com/mamarley/nvidia-graphics-drivers/

    ### How you can help:

    ## Install PTS and benchmark your gear:

        sudo apt-get install phoronix-test-suite

    Run the benchmark:

        phoronix-test-suite default-benchmark openarena xonotic tesseract gputest unigine-valley

    and then say yes when it asks you to submit your results to openbechmarking.org. Then grab a cup of coffee, it takes a bit for the benchmarks to run. Depending on the version of Ubuntu you’re using it might preferable for you to grabs PTS from upstream directly: http://www.phoronix-test-suite.com/?k=downloads

    ## Share your results with the community:

    Post a link to your results (or any other feedback to): https://launchpad.net/~graphics-drivers-testers

    Remember to rerun and resubmit the benchmarks after driver upgrades, this will allow us to gather a bunch of data on performance that we can share with everybody.

    If you run into old documentation referring to other PPAs, you can help us by consolidating references to this PPA.

    If someone wants to go ahead and start prototyping on `software-properties-gtk` on what the GUI should look like, please start hacking!

    ## Help us Help You!

    We use the donation funds to get the developers hardware to test and upload these drivers, please consider donating to the “community” slider on the donation page if you’re loving this PPA:

    http://www.ubuntu.com/download/desktop/contribute
    More info: https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa
    Press [ENTER] to continue or Ctrl-c to cancel adding it.

    Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease
    Hit:2 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease
    Get:3 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
    Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease
    Get:5 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
    Ign:6 http://download.opensuse.org/repositories/home:/stevenpusser/xUbuntu_18.04 InRelease
    Hit:7 http://download.opensuse.org/repositories/home:/stevenpusser/xUbuntu_18.04 Release
    Fetched 163 kB in 3s (51.9 kB/s)
    Reading package lists… Done
    user@Winfast:~$ lsmod | grep nvidia
    user@Winfast:~$ lsmod | grep NVIDIA
    user@Winfast:~$ sudo apt update
    Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease
    Hit:2 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease
    Get:3 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
    Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease
    Ign:5 http://download.opensuse.org/repositories/home:/stevenpusser/xUbuntu_18.04 InRelease
    Hit:6 http://download.opensuse.org/repositories/home:/stevenpusser/xUbuntu_18.04 Release
    Get:7 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
    Fetched 163 kB in 3s (52.7 kB/s)
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    All packages are up to date.
    user@Winfast:~$ sudo apt install nvidia-304
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
    nvidia-304 : Depends: xorg-video-abi-11 but it is not installable or
    xorg-video-abi-12 but it is not installable or
    xorg-video-abi-13 but it is not installable or
    xorg-video-abi-14 but it is not installable or
    xorg-video-abi-15 but it is not installable or
    xorg-video-abi-18 but it is not installable or
    xorg-video-abi-19 but it is not installable or
    xorg-video-abi-20 but it is not installable or
    xorg-video-abi-23
    Depends: xserver-xorg-core but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    user@Winfast:~$ ubuntu-drivers devices
    == /sys/devices/pci0000:00/0000:00:05.0 ==
    modalias : pci:v000010DEd00000242sv0000105Bsd00000CAFbc03sc00i00
    vendor : NVIDIA Corporation
    model : C51G [GeForce 6100]
    driver : nvidia-304 – third-party free recommended
    driver : xserver-xorg-video-nouveau – distro free builtin

    user@Winfast:~$ sudo ubuntu-drivers autoinstall
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
    nvidia-304 : Depends: xorg-video-abi-11 but it is not installable or
    xorg-video-abi-12 but it is not installable or
    xorg-video-abi-13 but it is not installable or
    xorg-video-abi-14 but it is not installable or
    xorg-video-abi-15 but it is not installable or
    xorg-video-abi-18 but it is not installable or
    xorg-video-abi-19 but it is not installable or
    xorg-video-abi-20 but it is not installable or
    xorg-video-abi-23
    Depends: xserver-xorg-core but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.

  3. I was installing the way you suggest but it get stuck. And it was showing Following Error-

    E: Could not get lock /var/lib/dpkg/lock – open (11: Resource temporarily unavailable)
    E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

    1. jquenel Avatar

      Make sure you don’t have another process (maybe Ubuntu Software center ?) already using dpkg. Rebooting usually solves this issue.

  4. jackson Avatar

    thank you so much worked for me

  5. mystogan Avatar

    The best way(in my opinion) is to use the ubuntu repository.
    try : ubuntu-drivers devices #It will permit to see what versions is recommended for your driver
    then : sudo ubuntu-drivers autoinstall # the recommended version will be installed

    1. thank you for sharing this method, i didn’t even know this existed, this was so simple

    2. Autoinstall worked! Thanks you!

  6. MehThisAgain Avatar
    MehThisAgain

    I am so weary of pages that suck hours of my time that do not work. After the PPA install,

    “Unable to locate package nvidia-387”

    Or any other package. What a waste of time.

    1. this took you… hours?! omg

    2. search in synaptic for nvidia-387
      after doing stage 1 and 2 it is there

  7. This worked so smoothly. Thanks for sharing this info.

  8. Thank you so much for this. You saved my bacon! I never would have thought too look to apply the driver. Thank you! Also, these computers in which I am installing these drivers are going to Africa to refugees. You have saved me time and effort which will changes countless lives. Thank you for the help.

  9. puyol105 Avatar

    Hi. I did all of this, but in SOFTWARE & UPDATES -> ADDITIONAL DRIVERS appears the nvidia but don’t allow me to select another option but “Continue using a manually installed driver”.

    1. I used the first procedure to install the nvidia 304 drivers in Black Lab Enterprise linux. When I went to the Software & Updates > Additional Drivers, there were several other nvidia drivers listed (along with radio nobs in front to select them) along with the default OS driver. Did you see a list of additional drivers on the Additional Drivers page?

  10. When you are on the SOFTWARE & UPDATES > ADDITIONAL DRIVERS page, are there other nvidia drivers listed? They should all have a ‘radio knob’ in front of them to enable you to select the specific driver that you want to install.

  11. Tahmoorath Avatar

    after installing nvidia driver, the login screen converts to a black blank screen and frequently restarts that screen, I read several threads and did many ways but didn’t work.my graphic card is gt720m and Ubuntu 18.04 and the version of driver is 340.107. I can just go to recovery mode and from root terminal purge nvidia driver to go back in Ubuntu, but still I need to install Nvidia driver, what should I do?

  12. Doesn’t work for me. After
    sudo add-apt-repository ppa:graphics-drivers
    sudo apt update
    sudo apt install nvidia-410
    (410 is the current branch now in 11/2018)
    … I get …
    Paketlisten werden gelesen… Fertig
    Abhängigkeitsbaum wird aufgebaut.
    Statusinformationen werden eingelesen…. Fertig
    E: Paket nvidia-410 kann nicht gefunden werden.
    (translated: cannot find package nvidia-410)

  13. This worked for me:
    sudo add-apt-repository ppa:graphics-drivers
    sudo apt update
    sudo apt install nvidia-390

    Then, in “Software & Updates”, “Additional Drivers” I could select “nvidia-driver-410”.

    I checked the “390” version was compatible with my card before installing: http://www.nvidia.com/object/unix.html
    Not all the “nvidia-nnn” versions are available, even though the blurb says “410” is the latest.
    Run this to get a list of versions:
    sudo apt-cache search nvidia-

  14. Allen McIntosh Avatar
    Allen McIntosh

    Adding the repository worked fine, but once the driver was installed in Ubuntu 16.04.2 on my T-61 laptop it insisted on hibernating when the top was closed while it was sitting in its docking station. Changing the “power” settings to ask it not to do this had no effect. The same settings work just fine with the freeware driver. Hibernating is awkward and pointless when the laptop is in a docking station. I tried tweaking settings to use the monitor connected to the docking station as primary, but only succeeded in rendering the machine totally unusable: blank screen all the time. I finally installed 16.04.2 again and went back to the freeware driver. It’s flaky, but at least I can see what I am doing.

Leave a Reply to MehThisAgain Cancel reply

Your email address will not be published. Required fields are marked *


Exit mobile version