73

I recently installed 14.04.

But now I need a new driver for my nVidia GeForce GT 630. The former driver was rejected as not compatible with the 64-bit. I found that other driver and when I wanted to install it in the terminal with sh I was called first to stop the x-server. It cannot be installed with running x-server.

So how do I install them?

muru
  • 197,895
  • 55
  • 485
  • 740

9 Answers9

66

You can download the driver for your video card for Ubuntu 64bit from here. Assuming that you are using Ubuntu 64bit now. If you installed Ubuntu 32 bit, there is 331 version of the same driver for Ubuntu 32bit. Save your driver somewhere where you can easily access it, like your user home directory or inside a newly created nvidia directory in your user home directory.

To be able to install your nvidia driver you have to remove your previous video driver with this code in a terminal window:

    sudo apt-get remove nvidia* && sudo apt-get autoremove

After you finish with this one, you should also blacklist the nouveau driver by editing this file with either:

    gksudo gedit /etc/modprobe.d/blacklist-nouveau.conf

or

    sudo nano /etc/modprobe.d/blacklist-nouveau.conf

…and add these lines at the end:

    blacklist nouveau
    blacklist lbm-nouveau
    options nouveau modeset=0
    alias nouveau off
    alias lbm-nouveau off

If, by any chance, there is no blacklist-nouveau.conf present in /etc/modprobe.d/, you can save your file as blacklist-nouveau.conf when prompted.

And you can also disable the Kernel Nouveau by typing these lines in a terminal window:

    echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf

and after that

    update-initramfs -u

Now you can reboot your computer, and when you get to the login prompt, press Ctrl+Alt+F1 to exit to the terminal console. Login with your username and password.

Go to the directory where you saved your nvidia driver using the command cd in the terminal console. Eg. cd nvidia considering that you are already in your user home directory after you login. You can use command dir to be able to see your exact driver's name.

To stop your display manager or the X server, you can type in the console this code:

   sudo stop lightdm   or

   sudo lightdm stop

If you are not using lightdm as your default display manager (DM), replace lightdm with your default display manager, which can be either kdm or gdm or whatever your display manager is.

You should get a message in the terminal console saying --> lightdm stopped/waiting

And now you can finally install the nvidia driver using a code similar to this one:

  sudo sh NVIDIA-Linux-x86_64.....run    (for Ubuntu 64bit)  

or

  sudo sh NVIDIA-Linux-x86.....run    (for Ubuntu 32bit)

If you don't type the exact name of the driver, you'll get this message: NVIDIA-Linux... could not be found and you should type again the code for installing the driver.

Nvidia installer automatically installs the driver, and at the end it will ask you whether you want to save your new X configuration. Press Yes. After reboot and getting to your desktop and changing your NVIDIA settings as you please you should open a terminal window and type in this code:

  sudo nvidia-xconfig

to save your new nvidia configuration in /etc/X11/xorg.conf.

Note

You might need to install some extra software packages if nvidia installer gives an error and prompts for missing dependencies:

    sudo apt-get install dkms fakeroot build-essential linux-headers-generic

But you need to install all these missing packages only if nvidia-installer can't do the job by itself.

It can happen that after reboot your system shows a black screen or enters the low graphics mode. To fix this you should exit again to the console terminal, login with your username and password, and use the code provided above sudo nvidia-xconfig and also make use of the following tutorial. It is meant to fix the greeter assuming that they haven't fixed this bug in Ubuntu 14.04.

Taz D.
  • 2,225
  • 2
  • 17
  • 21
  • Thanks for that clear explanation. Maybe I should have followed it. But I went the simpler way as you see above. Now I need a way to make Unity and Gnome running again – Horst Seeger Apr 21 '14 at 08:17
  • Visit this page and see if you can find anything worth exploring in there. – Taz D. Apr 21 '14 at 08:48
  • You also need to run this command before running nvidia driver - sudo apt-get install linux-headers-generic – mac Aug 09 '14 at 21:10
  • 1
    Nice guide, helped me a lot :) – Maarten Kieft Aug 23 '14 at 15:24
  • 3
    Is there any particular reason to use this answer and not the simple "additonal drivers tab" thing – user2618142 Aug 25 '14 at 14:51
  • 1
    No reason at all! – Taz D. Aug 25 '14 at 16:18
  • So I followed this guide and now my screen flashes single colors (Blue, black, white, red, green) on repeat. I can still get to the console but my x session is completely boned. – AlexLordThorsen Oct 16 '14 at 05:40
  • 2
    And in every kernel update, you will probably need to repeat the procedure. – NickTux Oct 28 '14 at 10:30
  • I ran lightdm stop and my screen went blank/ black. Do I actually need this step? – ericn May 27 '15 at 13:46
  • The error is "failed to get d-bus connection" – ericn May 27 '15 at 13:50
  • @NikTh If dkms is installed before you compile you won't have to – mchid Jan 15 '16 at 09:29
  • This worked well for me for Nvidia GT-740 with an Asus 4K monitor, whereas the answer which used "apt-get" did not work. I got a couple of errors during the installation (could not create some links), but I continued the installation and it worked anyway. Thanks for the great answer! – Mr Ed Mar 02 '16 at 07:24
  • Why are the blacklisting steps necessary? What does blacklist nouveau do after uninstalling the nvidia-* packages? – user3728501 Jul 03 '16 at 15:57
  • The blacklist is because running Nvidia's file will return an error message about nouveau kernel being incompatible with Nvidia's driver. – Will Jul 29 '16 at 13:01
  • I got "X server is running" error. Instead of stopping lightdm, I had to do sudo killall Xorg multiple times until it says "no process found". – Xin Aug 27 '16 at 07:23
  • I don't recommend this solution. In particular, don't download the driver from the nvidia site---it did not work well for me. Follow the instructions here instead: https://codeyarns.com/2013/02/07/how-to-fix-nvidia-driver-failure-on-ubuntu/ – Xin Aug 27 '16 at 14:57
46

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

  1. Add the graphics-drivers ppa

    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt-get update
    
  2. Install the recommended driver

    sudo ubuntu-drivers autoinstall
    
  3. Restart your system

    sudo reboot
    

To select a different driver, or if the above doesn't work:

  1. Add the graphics-drivers ppa

    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt-get update
    
  2. Purge any existing nvidia related packages you have installed

    sudo apt-get purge nvidia*
    
  3. Check which drivers are available for your system

    ubuntu-drivers devices
    
  4. Install the recommended driver

    sudo apt-get install nvidia-361
    
  5. Restart your system

    sudo reboot
    
d a i s y
  • 5,511
Corey Goldberg
  • 3,046
  • 3
  • 19
  • 21
17

You can install Ubuntu drivers , for GT 630 you can use: sudo apt-get install nvidia-304 OR sudo apt-get install nvidia-304-updates, not both.

L.V.A
  • 1,154
  • Now I have followed your advice to use: sudo apt-get install nvidia-304 nvidia-304-updates – Horst Seeger Apr 21 '14 at 08:02
  • 5
    As I say: I followed your advice to use that line. result: ubuntu bootes till the red screen with Ubuntu 14.04 LTS down left and the mouse pointer works but nether Unity nor Gnome appears. Before at least Unity was working without letting me change the background. It was also just read but with all icons and the launcher. Gnome was working completely. Now there is just that red background without anything accessable. How to go on now? – Horst Seeger Apr 21 '14 at 08:12
  • 1
    In this situation you can use Ctrl+Alt+1 and use ubuntu in text mode, if it blocks you can switch to 2 by Ctrl+Alt+2. The number 7 is the desktop and the number 8 is the log screen. – L.V.A Apr 22 '14 at 06:56
  • As I wrote already under a subsequent question: my problems are solved. Nvidia is running, Unity and Gnome are running. But thank you for the advices about Ctrl+Alt+F1, F2, F7. These possibilities of working with the console I didn't know yet and they helped me a lot. – Horst Seeger Apr 23 '14 at 07:20
  • 8
    I once screwed up my system entirely by running "sudo apt-get install nvidia-something", too. NEVER DO THAT – matteo Aug 05 '14 at 19:08
  • 2
    Do you mind to rephrase your answer ? nvidia-304 is not Ubuntu open source driver. – NickTux Oct 28 '14 at 10:28
  • do you mean reverting to nvidia 304 instead of nvidia 331 solved the problem? – doctorate Nov 22 '14 at 17:23
  • you should note that by this method you are installing open-source version not proprietary ! proprietary are good for gaming – Alex Jones Apr 25 '15 at 02:38
  • 4
    Your answer is a bit misleading: one should either do sudo apt-get install nvidia-304 or sudo apt-get install nvidia-304-updates not both. Afaik, they're different packages of the same driver, -updates being slightly ahead. – user25588 May 28 '15 at 15:11
  • @edwardtorvalds opensource is nouveau, this is the proprietary driver, it's the same proprietary driver that get's installed through "software-sources" it's just officially maintained. – mchid Jan 15 '16 at 04:24
  • Is 340.96 the latest version of the drivers package now? – matanox Apr 07 '16 at 06:40
16

Here's what I do (via PPA):

I add a xorg-edgers PPA first:

sudo add-apt-repository -y ppa:xorg-edgers/ppa

Then I either install from command line or from additional drivers section.

First, update your package list:

sudo apt-get update

Additional drivers are now updated with newer packages.

And alternatively, from terminal, install nvidia-331 (for v331), nvidia-337 (for v337) or nvidia-current (for very recent version).

After installing, don't forget to logout or reboot, and log back in.

Arda
  • 1,320
  • 11
  • 15
4

I'm using geforce gt820m.

I have tried almost all the suggestions above, but none worked for me. However, combining what I learned from above with other many online resources like here, This is how I went about mine.

You'll eventually end up with something like this, should you follow these steps.

What I had

First of all, reset everything to default. How?

Uninstal any nvidia things

sudo apt-get --purge remove nvidia*

Blow xorg Edgers ppa away

In your "Other Softwares" tab, uncheck the Xorg Edgers PPA, to look like in below image. That ppa caused me so much pain than good.

Uncheck xorg edges ppa in

Then allow the packages to be updated when prompted to or let ...

sudo apt-get update

...do the rest.

Its about time

Go back to additional drivers, and you should see only one Nvidia binary listed (at least for my card, that's what was listed, instead of the two that showed when the xorg edges ppa was active )

What was/is the difference? The drivers showed by the xorg edgers ppa are open source. The one which now shows has the indication proprietary. In this case, proprietary rocks, so please go with it, unless you wanna mess your head around for the next hours without success.

Switch from the x.org x server to the nvidia binary and apply. It should take a bit of time to apply (it took a bit of time on my end here, and I realized it downloaded some packages in the process). Restart your computer when its done.

Troubleshooting

If you added anything different from the default to either /etc/default/grub or have made changes to /etc/X11/xorg.conf , please reset them to their defaults. You should be smart to know what you added and take it away.

After reverting all your changes to these two areas, please update these:

sudo update-initramfs -u
sudo update-grub

The above two commands will ensure the changes you made to the above file, especially the one in /etc/default/grub is applied on next reboot. Failing to apply the update commands kept me stuck with whatever changes I made to the grub file, even after reboots.

For the xorg.conf file, you can delete it from that folder (you're free to make a backup of it)

If you are not seeing a good resolution, be sure to do

sudo nvidia-xconfig

Restart your PC then.

If you're feeling excited, you can delete nouveau from your PC by simply

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

I won't recommend you remove the nouveau, but I did though :P

Doing the steps above got me up and running again with nvidia driver after several hours of try and error.

Any Issues?

Yes. For some reasons I do not know yet, running many applications causes the PC to freeze. Ctrl + Alt + F1 gets me the chance to re-spawn the lightdm, but why the freeze happens is a mystery for me now. Any assistance is much appreciated.

KhoPhi
  • 1,888
4

You can install additional drivers for nVidia graphics adapters (and for other hardware) with ubuntu-drivers-common (formerly jockey). Apparently hardware detection and driver management is now done through a command-line interface:

sudo ubuntu-drivers autoinstall

For details see https://askubuntu.com/a/9465/175814.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
2

I have had a lot of issues with NVIDIA and Ubuntu 14.04. But eventually, I managed to install it. I have Acer Aspire laptop with Nvidia GeForce 820M.

Here how it goes:

  • Install nvidia-331. I did it through Synaptic Package Manager. But I guess

$ sudo apt-get install nvidia-331

will work as well. I did NOT perform sudo apt-get install nvidia-331-updates. I did NOT perform any additional disabling of the nouveau driver.

  • Then I rebooted the system.

  • I have downloaded cuda_5.5.22_linux_64.run from NVidia web page and extracted to separate files:

    $ chmod 755 cuda_5.5.22_linux_64.run
    $ ./cuda_5.5.22_linux_64.run -extract=/home/user/Downloads/cuda-5.5
    $ ls 
    cuda-linux64-rel-5.5.22-16488124.run    NVIDIA-Linux-x86_64-319.37.run cuda-samples-linux-5.5.22-16488124.run
    
    $ sudo sh cuda-linux64-rel-5.5.22-16488124.run
    $ sudo sh cuda-samples-linux-5.5.22-16488124.run
    
  • Then I compiled 1_Utilities/deviceQuery and it worked. And then I compiled the 0_Simple/matrixMul and it worked as well. Be sure to set $PATH and $LD_LIBRARY_PATH.

I have tried to follow the same path with cuda 6.0. Although deviceQuery compiled, it failed to execute:

$ ./deviceQuery 
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
cudaGetDeviceCount returned 3
-> initialization error
Result = FAIL

$ echo $PATH
/opt/cuda-6.0/bin:/opt/cuda-5.5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

$ echo $LD_LIBRARY_PATH
/opt/cuda-6.0/lib64:/opt/cuda-6.0/lib:/opt/cuda-5.5/lib64:/opt/cuda-5.5/lib:
jkt123
  • 3,530
  • 22
  • 24
yomagg
  • 21
0

if you're stuck offline, but can access 3rd-party internet, you can always download your driver as a .run file from the Nvidia website.

you'll have to stop lightdm to install, which isn't hard:

  • use Ctrl + Alt + F1 and login to the terminal environment
  • sudo service lightdm stop
  • cd *directory of .run file*
  • *drivername*.run after following the setup procedure, this will take you back to your desktop:
  • sudo service lightdm start

you may not have to restart, though it's recommended you do.

I also recommend using the proprietary drivers over nouveau.
In my experience, nouveau can't do multi-monitor at 1600x1200, but can only do single monitor at 1280x1024 max for my Galaxy Nvidia GeForce GT430.
Not to mention very poor gaming FPS.

Tcll
  • 735
  • 1
  • 7
  • 15
-1

You should try the nouveau driver with bumblebee. I got stuck with it because for some reason, in ubuntu gnome 14.04.1 amd64, installing any nvidia proprietary driver has the result of gnome shell being unable to load successfully. Although, if you use optirun glxspheres64 or primusrun glxspheres64 the fps is very low, in games it appeears to be vary robust. I play NFS World and WOT and the performance is quite better than using nvidia 331 with bumblebee.

  • 1
    Can you please explain how to do that? – David Foerster Dec 23 '14 at 15:38
  • Been on Vivid for a while, but have been running proprietary nvidia drivers for years. Pretty sure they usually worked fine with any desktop environment including Gnome. – Nephente Oct 04 '15 at 16:26
  • Coming here from a long time, I had many nasty issues with Ubuntu over the years, right now I am on Fedora 23, and they mention in documentation that bumblebee+nouveau + gnome-shell does not work with gdm. This was the problem two years ago, and I had it. It's also hardware dependent (my laptop has some issues). As of installing nouveau, you should uninstall:
     sudo apt-get purge bumblebee* nvidia* primus* and then install this way: 
     sudo apt-get install bumblebee nouveau primus virtualgl 
    
    – cyberalex4life Apr 20 '16 at 14:00
  • There are 2 things I can confirm: nouveau was stable, but did not implement hardware acceleration verry well. So you may have found yourselves in the position that you wanted to play Steam Games with a config like mine (Intel Core I7 3610 QM 2.30GHz, Nvidia 610m, and got the same performance as with intel gpu. If you'd wanted stable, if you'd wanted free, nouveau was fine. If you'd wanted performance you should have gone with NVidia – cyberalex4life Apr 20 '16 at 14:21
  • About installing nvidia on ubuntu: there are 2 options: nvidia-prime with allows switching cards with the cost of log out -> log in, and bumblebee + nvidia that offers less performance in theory. I am more of a bumblebee fan because I don't have to log out. In my case nvidia-prime would cause severe tearing whilst bumblebee does not. Using bumblebee with primus and VGLTransport=proxy seems the best choice in respect to performance. I am not using Ubuntu for quite a while and I would mention that this is my personal choice and I won't comment on it. – cyberalex4life Apr 20 '16 at 14:29