Howto: Install NVidia drivers In Debian or Ubuntu

Anti-Trend

Nonconformist Geek
Howto Install NVidia drivers In Debian or Ubuntu
-aka-
Getting 3D in Debian or Ubuntu with NVidia​

Installing the proprietary NVidia drivers in Debian (or Ubuntu, a Debian spin-off) is surprisingly easy. Not as easy as they'd be if they were open-source, but I digress... ;)


STOP! This thread is outdated and is here for historical purposes only. Please read the bottom of this post under the heading "EDIT".


Requirements:

  • Your kernel headers must matched your installed kernel. If you roll your own kernels, this is already handled. Otherwise, use the command:
    Code:
    uname -a
    ...to identify your running kernel, and use your package manager to install the corresponding kernel header package.
  • Make sure the build-essential meta package is installed, which allows the drivers to compile in the first place.
    Code:
    apt-get install build-essential
  • If you do build your own kernels, leave out the Riva FB drivers, and do build the appropriate AGPart module if you have an AGP architecture.

Steps to install:
  1. Download NVidia's Linux drivers and save them someplace where you'll remember them later.
  2. Save anything you're working on and log out of your desktop session.
  3. Go to a virtual terminal (ALT+CTRL+F1)
  4. Login as root Note: In Ubuntu, you are already root... sort of. Yes, I know, this is dumb. To get full root in Ubuntu, run the following command:
    Code:
    sudo su -
  5. Terminate your graphical user environment. There are a few ways to do this; the easiest is to
    Code:
    /etc/init.d/kdm stop
    if you're using the KDE display manager,
    Code:
    /etc/init.d/gdm stop
    if you're running the Gnome display manager, or if you're using the X display manager:
    Code:
    /etc/init.d/xdm stop
  6. Navigate to the directory where you downloaded your drivers earlier. Note: If you don't know how to do this part, you need to first go over the absolute basics: Absolute basics ...you can always post here if you need help with something specific, but please at least read that first if you're having trouble navigating in a non-graphical environment.
  7. Install the NVidia drivers with the following command:
    Code:
    sh NVIDIA-Linux-x86-1.0-9629-pkg1.run --x-module-path=/usr/lib/xorg/modules/ -aqNX
    ...where "NVIDIA-Linux-x86-1.0-9629-pkg1.run" should be the actual name of the NVidia driver you're trying to install. Tip: You can start typing the name of the file, then hit the TAB key and your system will automatically complete the filename for you. That makes it a lot easier to type long filenames without making typos.
  8. Once you've got the new drivers installed, just start your display manager back up and logout of your virtual terminal. Here are the commands to do so with KDM, GDM and XDM respectively:
    Code:
    /etc/init.d/kdm start && exit
    Code:
    /etc/init.d/gdm start && exit
    Code:
    /etc/init.d/xdm start && exit
  9. To test your new 3D Drivers, log back in to a desktop session and run the following command in a terminal:
    Code:
    glxinfo | grep render
    Note: the "|" is a pipe symbol, not an "i" or an "L". You should see something similar to the following:
    Code:
    direct rendering: [B]Yes[/B]
    OpenGL renderer string: GeForce 6800 GT/AGP/SSE/3DNOW!
        GL_NVX_conditional_render, GL_SGIS_generate_mipmap, GL_SGIS_texture_lod,
    ...If "Direct Rendering" reads as "yes", congratulations! If not, feel free to post here, and we'll see what we can do to help you out.

*EDIT*

OK, this thread is completely obsolete! For Debian users, I recommend avoiding my silly little script and instead using the excellent sgfxi, which will automatically download and install the ideal graphics drivers for your NVidia or ATI video card. To install it, simply do the following as root:

Code:
cd /usr/local/bin;wget -Nc smxi.org/sgfxi;chmod +x sgfxi
To execute the script, simply drop to a VT and run the command 'sgfxi' as root.

Or if you prefer to be able to install the drivers with a normal user account, you could do something like this:
Code:
:~# visudo
...and add a line like this:
Code:
%video ALL=/usr/local/bin/sgfxi
Then you'd be able to install the drivers by dropping to a VT, then running
Code:
sudo sgfxi



NOTE: This script is for real Debian distros only, *not* for Ubuntu. If Ubuntu users don't like their distro's way of packaging drivers, I've heard good things about the Envy script.
 
Howto: Install NVidia drivers in Linux In Debian or Ubuntu

Nice How to Guide there... [ot]...now we need someone to do a How to for the ATi Drivers :p[/ot]
 
Hi AT

Followed the instructions, thenks! However, I have a query -
When I tried the command "glxinfo | grep render", debian complains that glxinfo is an unknown command.

When I check the KInfoCenter I can see under OpenGL - see attached image

I am using the HWF P4 kernel.....

Is everything alright here?
 

Attachments

  • OpenGL.jpg
    OpenGL.jpg
    67 KB · Views: 1,071
glxinfo is part of the mesa-utils package. Just install that and you'll have the command you're looking for.
 
Ubuntu has added some scripts to the mix which make building drivers the NVidia way a real pain in the ass. To help counter this, I've written a primitive BASH script which Ubuntu users may find useful:

Code:
#!/bin/sh
#
#######################################
# Easy NVidia Builder Script
# Licensed under the GPLv3 
# (or later at your option):
# http://www.gnu.org/copyleft/gpl.html
#######################################
#
#############################
## Default Display Manager ##
#############################
## Change to kdm, gdm or xdm as necessary:
DMNG=gdm

#############################
## NVidia Driver Location  ##
#############################
## What's the absolute path to the drivers?
NVDRIVER=/usr/local/src/nvidia/NVIDIA-current.run

#############################
## Path to X Modules       ##
#############################
## Shouldn't have to change this in Ubuntu:
XMODPATH=/usr/lib/xorg/modules

## Kill Ubuntu's annoying script that keeps respawning the display manager:
killall gdmopen
## Now stop the display manager we've defined earlier:
/etc/init.d/$DMNG stop
## If there are still any X.org processes hanging around, kill them too:
killall Xorg
## Zombie Clause - Wait 6 seconds and make absolutely sure they stay dead:
sleep 6
killall $DMNG
killall gdmopen
killall Xorg
## They've had their fair chance. After 3 seconds, we bring out the big guns:
sleep 3
killall -9 $DMNG
killall -9 gdmopen
killall -9 Xorg
## Now we build the NVidia driver:
sh $NVDRIVER --x-module-path=$XMODPATH -aqNX --no-runlevel-check
## Restart the display manager:
/etc/init.d/$DMNG start

How to use this script:
  1. Download the appropriate drivers from NVidia's website.
  2. Put this BASH script someplace in your path where it can executed. For instance, /usr/local/sbin/ would be a perfect location:
    Code:
    cd /usr/local/sbin && wget http://www.hardwareforums.com/repo/scripts/nvinst.sh
  3. chmod the script so that it can be executed:
    Code:
    chmod 755 /usr/local/sbin/nvinst.sh
  4. Using your favorite text editor, edit the NVDRIVER section of the script to account for the exact path to your downloaded drivers. For example:
    Code:
    #############################
    ## NVidia Driver Location  ##
    #############################
    ## What's the absolute path to the drivers?
    NVDRIVER=/usr/local/src/nvidia/NVIDIA-Linux-x86-169.12-pkg1.run
  5. Also change the display manager variable, if necessary.
  6. Logout of any X sessions (KDE, Gnome, etc) and either drop to a virtual terminal (Ctrl+Alt+F1-F6) or to runlevel 1, whichever is more convenient for you.
  7. Execute the script: sudo nvinst.sh
And of course, feel free to post here with problems or improvements.
 
[OT]
## They've had their fair chance. After 3 seconds, we bring out the big guns:
sleep 3
killall -9 $DMNG
killall -9 gdmopen
killall -9 Xorg

KILL DASH NINE,
No more CPU time.
I run KILL DASH NINE,
And your process is mine.
I run KILL DASH NINE,
'Cause it's MY time to shine
So don't step outta line or else it's
KILL DASH NINE!

Kill Dash Nine | Lyrics
[/OT]
 
Hey all

Just came against a big wall when trying to install the nVidia driver against the 2.6.25 Kernel In Debian (Lenny). Basically the short of it is that the latest from nVidia will not build against a XEN enabled Kernel #476504 - nvidia-kernel-source: Fails to build with Linux kernel 2.6.25 - Debian Bug report logs. If, like me you are using a stock kernel and have not a clue how to compile a kernel, disabling the option, your best bet is to try and use Debian's latest, own nvidia-glx driver. It is unfortunate that the driver is only available from the Sid repo's.

I suppose it is down to you whether you wish to dab in the unknown but this is how it worked for me:
Just to quickly explain that I am using the new kernel out of choice as it solves an issue I had. If you are using the new Kernel it is likely that you are experimenting anyway so on your head be it.....

Add and enable the Sid repository (I include the lot - main contrib non-free). Then as root:
/etc/init.d/kdm stop (replace kdm with other if necessary)
apt-get update
apt-get install nvidia-kernel-source module-assistant (if it is not installed already) nvidia-settings nvidia-xconfig
You might get a warning that the packages suggest installing the nvidia-glx package. Options are Y/N/Q. I chose Y.

When all is done:
m-a prepare && m-a a-i nvidia
apt-get install nvidia-glx

When this is finished, to make sure the new module is loaded:
rmmod nvidia (not necessary if you were not using the module already)
modprobe nvidia

Now restart your desktop manager
/etc/init.d/kdm start
or reboot
.

Disclaimer - this is not a how-to but just an FYI which I felt would be a bit silly if I did not include the way I manged to install the driver.
I took the how to from here -
Debian User Forums :: View topic - Nvidia 100.14.19 - Debian way, custom (or not) kernel.
Note that I have omitted the
grep -q ^nvidia /etc/modules || echo nvidia >> /etc/modules
as it crashed the whole process for me... probably because it was not intended for me..... :doh:

AAAAnyways I hope some of you will find this useful.
 
Yeah, to be honest one shouldn't enable Xen in their kernels unless they actually plan to run hypervisors... and that would be weird on a desktop warranting 3D graphics anyway. :) On typical desktops, Xen should be disabled.
 
OK, this thread is completely obsolete! For Debian users, I recommend avoiding my silly little script and instead using the excellent sgfxi, which will automatically download and install the ideal graphics drivers for your NVidia or ATI video card. To install it, simply do the following as root:

Code:
cd /usr/local/bin;wget -Nc smxi.org/sgfxi;chmod +x sgfxi
To execute the script, simply drop to a VT and run the command 'sgfxi' as root.

Or if you prefer to be able to install the drivers with a normal user account, you could do something like this:
Code:
:~# visudo
...and add a line like this:
Code:
%video ALL=/usr/local/bin/sgfxi
Then you'd be able to install the drivers by dropping to a VT, then running
Code:
sudo sgfxi



NOTE: This script is for real Debian distros only, *not* for Ubuntu. If Ubuntu users don't like their distro's way of packaging drivers, I've heard mixed reviews about the Envy script.
 
yep, you guessed it, using drivers installed (sgfxi) and grx are crap now, only 800 X 600 & 60Htz and what looks like 16 color, is there a way to activate higher settings

BTW: i've attached a screenshot & the browser window is green but when i make ksnapsshot the active window display returns to screenshot

BTW: making this post wasn't easy
 

Attachments

  • snapshot1.png
    snapshot1.png
    146.6 KB · Views: 1,028
Have a look at your xorg.conf (/etc/X11/) file and try and add the additional resolutions and depths manually (not before backing the file up!!!) -
You should have the following lines already
xorg.conf said:
Subsection "Display"
Depth 16
Modes "800x600" "640x480"
EndSubsection

Try to add another Subsection for 24 and 32 Depth -
Subsection "Display"
Depth 24
Modes ["any other possible resolutions"] "1024x768" "800x600" "640x480"
EndSubsection
Subsection "Display"
Depth 32
Modes ["any other possible resolutions"] "1024x768" "800x600" "640x480"
EndSubsection


Obviously you can only add resolutions which are supported by your screen...

Good luck....
 
well, exited X, downloaded and ran nvidia-xconfig & it auto rewrote xorg.conf, now all is good @ 1280x1024[ot]like you need telling about nv-conf[/ot]but i'm kinda proud of my little self cos i fixed it

BTW: your suggestion would also have worked :beer:


Edit: grandma, you suck eggs like this, shlurp shlurp shlurp
 
Yep, Saba's got it exactly right. I've got a 16:10 screen that maxes out at 1680x1050. Here's the screen section of my X.org if it helps you:

Code:
Section "Screen"
    Identifier     "Default Screen"
    Device         "nVidia Corporation GeForce 8800 GT"
    Monitor        "SyncMaster"
    DefaultDepth    24
    SubSection     "Display"
        Depth       8
        Modes      "1680x1050" "1440x900" "1280x1024" "1280x960" "1152x864" "1024x768" "832x624" "800x600" "720x400" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       15
        Modes      "1680x1050" "1440x900" "1280x1024" "1280x960" "1152x864" "1024x768" "832x624" "800x600" "720x400" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       16
        Modes      "1680x1050" "1440x900" "1280x1024" "1280x960" "1152x864" "1024x768" "832x624" "800x600" "720x400" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       24
        Modes      "1680x1050" "1440x900" "1280x1024" "1280x960" "1152x864" "1024x768" "832x624" "800x600" "720x400" "640x480"
    EndSubSection
EndSection
 
well, exited X, downloaded and ran nvidia-xconfig & it auto rewrote xorg.conf, now all is good @ 1280x1024[ot]like you need telling about nv-conf[/ot]but i'm kinda proud of my little self cos i fixed it

BTW: your suggestion would also have worked :beer:


Edit: grandma, you suck eggs like this, shlurp shlurp shlurp

Very kind, but just so you know, I only managed to install the nVidia drivers on my desktop once (GeForce 6200)... and to be frank, I cannot remember how I did it... :doh:.
One of the more frustrating processes I encountered with Debian. :mad:
Saying that, I am normally very impatient, which could explain why I did not have much success.... lack of trying! :chk:
 
AT said:
Yep, Saba's got it exactly right. I've got a 16:10 screen that maxes out at 1680x1050. Here's how the screen section of my X.org if it helps you:
cheers, my Vista box is 1440x900 (highest setting available:()

Saba said:
Very kind
and well deserved, i still think of myself as someone who hasn't got clue, but i'm realizing my potential slowly
Saba said:
but just so you know, I only managed to install the nVidia drivers on my desktop once (GeForce 6200)... and to be frank, I cannot remember how I did it... :doh:.
One of the more frustrating processes I encountered with Debian. :mad:
Saying that, I am normally very impatient, which could explain why I did not have much success.... lack of trying! :chk:
your luckier than me, i couldn't get my 6200 functioning correctly on *bubtu, AT will probably remember helping me, my 6200 did work with nv drivers, but froze every 5 - 10 mins[ot]was a tw4t[/ot]
 
Back
Top