How to install NVIDIA driver in Ubuntu

103,206

Solution 1

I found a very good tutorial online, and I was able to install those infamous Nvidia drivers on two computers without a problem. Here is what you do:

Preparation

1) First, you need to open up a terminal shell. You can either start up your computer and go to a virtual shell

Ctrl+Alt+F1

or login and open up the gnome terminal

Ctrl+Alt+t

2) Then In the terminal, run the following commands:

This command will refresh your packages

 sudo apt-get update

Then you will need to install the linux headers if those are not already installed.

 sudo apt-get install linux-headers-generic

Next, you will need to do a dist-upgrade, which upgrade some packages of your system

 sudo apt-get dist-upgrade

When that is all done, you will need to reboot your system

 sudo reboot

The Installation of the Drivers

1) Repeat step one to open the terminal.

Now install the Nvidia drivers

 sudo apt-get install nvidia-current-updates 

You have one more step, or else, you will have a high chance that you just soft-bricked your system. For safe measures, run this final command:

sudo nvidia-xconfig

*There was a well known bug that the Nvidia installation script did not run that command. If that config file is not created, your graphics will not work.

Now reboot your system:

 sudo reboot

Congratulations! You should now be using Nvidia Drivers.

Confirming it Worked

One quick way to check is to click on the gear cog at the top

Cog

Then click About This Computer

In the line that says Graphics, It should say your Graphics driver:

This is what mine looks like:

About Computer Graphics

You can also click on graphics to get more details:

Graphics

Cheers!

Source: http://falkvinge.net/2013/02/15/how-to-install-nvidia-drivers-in-ubuntu-12-10-quantal/

Solution 2

Though it seems like getting Nvidia driver installed in Ubuntu is a mess. It is not actually like that. All you need to do is follow the steps:

  1. Open the "Software & Updates" from the dash and choose "Software sources".

  2. In the small pop up window, choose all the tick buttons in the first tab. Close it.

  3. Open a terminal and enter the following command. After entering the command, press "Return" key.

    sudo apt-get update && sudo apt-get upgrade
    
  4. Once completed, open "Software & Updates" againand select the tab named "Additional Drivers". There, you could choose between a proprietary version of Nvidia and a few xorg devel versions. Choose the one tagged proprietary. It may take some time to finish downloading depending on your connection.

  5. Once complete download is finished, close the window.

  6. Voilà, you have installed Nvidia driver.

Solution 3

I noticed that you said 400m series. Usually these days laptops come with optimus technology. If you have optimus then you need to install bumblebee.

sudo add-apt-repository ppa:ubuntu-x-swat/x-updates

Add the Stable Bumblebee Releases PPA and install Bumblebee using the proprietary NVIDIA driver:

  sudo add-apt-repository ppa:bumblebee/stable
  sudo apt-get update
  sudo apt-get install bumblebee bumblebee-nvidia

If you have 32-bit applications like Wine, and run 11.10 Oneiric or later, you will need extra libraries:

  sudo apt-get install virtualgl-libs:i386

Allow yourself to use Bumblebee by adding yourself to the 'bumblebee' group. (replace $USER by your username)

  sudo usermod -a -G bumblebee $USER

Reboot or re-login to apply the group changes If you'd like to run a program on the nvidia card now, use the optirun program:

  optirun firefox &

Solution 4

Since most of these answers are outdated... Here is modern way to install the nvidia drivers for Ubuntu (for 14.04 and newer):

All you need to do is:

  • Add the graphics-drivers ppa
  • Install the recommended Nvidia driver
  • Restart your system

so, from a terminal, run:

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

that's all there is to it!

note: if you want to install a specific version of the graphics driver, you can see which drivers are available for your hardware by running: sudo ubuntu-drivers devices, and inspecting the output to see which drivers are supported. Then just install normally with, for example, sudo apt-get install nvidia-381

Share:
103,206

Related videos on Youtube

Boopathi Rajaa
Author by

Boopathi Rajaa

Updated on September 18, 2022

Comments

  • Boopathi Rajaa
    Boopathi Rajaa over 1 year

    I'm running Ubuntu 13.04 on DELL XPS L501 - Nvidia GeForce GT 420M. I'm using kernel 3.9.0-030900-generic.

    All kernel-headers are installed in the system.

    and

    I've tried the following.

    • Use apt-get to install nvidia-current (which download 304) && load using modprobe
    • Use apt-get to install nvidia-310 && load using modprobe
    • Download nvidia 64-bit driver nvidia-319.23 for 400M series and install
    • Use swat-x repo to install nvidia driver

    All of these failed. And I tested it everytime like this

    • After the module is loaded (checked from lsmod),
    • restarted lightdm
    • tested from get.webgl.org
      • (Google-Chrome webgl support is enabled)

    Problem faced with nvidia-xconfig

    • after running nvidia-xconfig (which writes to /etc/X11/xorg.conf), and restarting lightdm, my display res changes to 640x480.
    • and had to remove this file to revert back to old setting
    • Have also tried commenting out those two lines which adjusts Horizontal and Vertical Setting in xorg.conf. That just rectified the resolution. But still I wasn't able to use the graphics card (webgl).

    EDIT 1: (nouveau)

    • Tried rebooting after each installation
    • Removed (purge) all of nouveau* before starting.
    • Removed one more package (dont remember the exact name though) - xorg-xserver-blah-blah.

    EDIT 2: (bitlbee)

    • I had bitlbee installed before. Removed that too before starting installation.
    • When bitlbee was present, NVIDIA-3.9-x86.run (downloaded from nvidia) was not able to recognize graphics card. But it did when I removed bitlbee. (So I'm assuming here that it should work if graphics driver was installed properly)

    EDIT 3: (software-properties-gtk)

    • sudo software-properties-gtk
    • the Additional drivers tab is always NIL. (before and after installation) (even if the installation was successful)

    Have been trying this the whole day, and done it quite a few times. None of them worked.

    Need help! Is it the problem with kernel-3.9, that there are no updates for this ?

    • Panther
      Panther almost 11 years
      Try rebooting after installing the nvidia driver. My guess is you are conflicting with nouveau
    • Boopathi Rajaa
      Boopathi Rajaa almost 11 years
      tried that too. added edits in the question. kindly check.
    • bcbc
      bcbc almost 11 years
      That's an optimus card (on demand) whereas the actual card is an intel gpu. So you want to look at Bumblebee
    • Arup Roy Chowdhury
      Arup Roy Chowdhury over 8 years
      Safest most effective and most current is nvidia ppa from Ubuntu devs launchpad.net/~graphics-drivers/+archive/ubuntu/ppa and I don't use Bumblebee but use nvidia-prime that works out well on my 4th gen i7 laptop. Also if you intend to do CUDA and openCL work, make sure after reboot to install nvidia-modrpobe and then reboot again.
    • Pilot6
      Pilot6 about 8 years
      Possible duplicate of How do I install the Nvidia drivers?
    • neuronet
      neuronet almost 8 years
      flashbacks of why I rage quit linux in 2000
  • Sos
    Sos almost 11 years
    well, I did everything and it didn't work. Unfortunately, when I ran sudo nvidia-xconfig it gave me some error. I don't know if it was that, but when I go into graphics (in the "About this computer") it says Graphics: Unknown. Any ideas?
  • Boopathi Rajaa
    Boopathi Rajaa almost 11 years
    I've the same issue .. !!
  • Max Tither
    Max Tither almost 11 years
    I have not a clue. I do remember, however, that when I first installed Nvidia drivers on my computer, using the inter graded chip on my motherboard, It would say "Graphics: Unknown". I now use a Card, and it recognizes it. It could be that Nvidia made lousy drivers for your card, and thus, you get this. My other guess is that somewhere, something went wrong with the driver installation.
  • user1205577
    user1205577 over 10 years
    This crashed all graphics for me.
  • luator
    luator almost 9 years
    sudo nvidia-xconfig --- Thanks, this saved my day :)
  • terminal ninja
    terminal ninja almost 8 years
    this helped me with vaio vpceg
  • John Prior
    John Prior over 7 years
    This caused my system graphics to become unstable. I used this tool to figure out exactly which NVidia driver set to install: nvidia.com/Download/index.aspx then sudo apt-get install nvidia-<version> made my system work again.