Click to See Complete Forum and Search --> : Want to install nvidia drivers for Debian Sid. Please Help!


The Coder
10-27-2008, 04:40 PM
I need your help.

I need to install the nvidia drivers for my Debian Sid x64 install. I have read so many guides but they are all very confusing to me. Some said that if you run the kernel from Sid you can't get the source code. I am running Kernel version 2.6.26. Can anyone recommend me what to do or which set of instructions to follow? I never found the nvidia drivers install hard with Kubuntu, why is it more complicated with Debian? Thanks.

bwkaz
10-27-2008, 10:34 PM
Did you compile that kernel yourself? If so, then as long as you haven't deleted the source directory, you should be fine just running the installer from nvidia. (This is one of the cases where it's better to run the hardware vendor's installer.)

The reason it gets so complicated is because distributing a kernel along with the drivers puts you on shaky legal ground (the GPL may or may not allow it), so very few distros do it. And the driver is tightly integrated with the kernel, so you can't distribute a binary driver that works with all kernels without a compile. And to compile anything, you need a kernel source tree, configured to match the kernel that you'll be running when you use the driver. This is easiest if you've already compiled the kernel and still have its source tree laying around. Since I don't think Sid has 2.6.26, I suspect you compiled it yourself.

happybunny
10-28-2008, 11:58 AM
off the top of my head...

# apt-get install linux-headers-`uname -r`

turn off X (# init 1 will do it or boot to single user mode)

Move into the directory you downloaded NVIDIA driver from

# ./NVIDIA.xxxx


answer the questions...

verify /etc/X11/xorg.conf has Driver nvidia and not Driver nv

reboot

mrrangerman43
10-28-2008, 12:20 PM
Yea fallow happybunny's reply, For the most part if there is something the installer needs it will tell you. If the installer runs into any problem and spits out an error make sure you write down what it needs.

Note: If you plan on installing a newer kernel do it before you install the nvidia driver if not, you will be installing the nvidia driver all over again.

happybunny
10-28-2008, 12:24 PM
oh yeah....the installer will spit errors into an install log but i forget the path....the failed install will tell you the path.

also remember, the driver is tied directly to the kernel...change the kernel and you need to re-install the driver

The Coder
10-29-2008, 12:12 PM
Thank you so much everybody. I will try as happybunny suggested and will let you know what I get as results. The Kernel I have, I got from the unstable repository, I did not compile it myself or modify it in any way, it was ready made.

bwkaz
10-29-2008, 10:46 PM
The Kernel I have, I got from the unstable repository, I did not compile it myself or modify it in any way, it was ready made. Then you will need at least linux-headers-`uname -r`, and possibly linux-source-`uname -r` (or whatever Debian calls it: the full, configured sources, along with the symlinks at /lib/modules/`uname -r`/{source,build}).

Samsonite
10-31-2008, 12:52 AM
I ran into Xen kernel issues using the Nvidia script on my laptop. I started using the easy route by just issueing this command below to do it the Debian way:
cd /usr/local/bin;wget -Nc techpatterns.com/sgfxi;chmod +x sgfxi;sgfxi
Link (http://techpatterns.com/forums/about933.html)
It will take care of installing neccessary packages not installed, just issue the command and hit enter a couple of times to put you in 3D capable graphics with the xorg.conf file all fixed up and ready to go.

Samsonite
10-31-2008, 02:33 AM
Double post.

The Coder
11-06-2008, 09:42 PM
Ok,
I finally got a few minutes and tried as happybunny suggested but ran into a few problems.

1.) I downloaded the kernel headers successfully using the command apt-get install linux-headers-`uname -r`. BTW - what are kernel headers?
2.) I downloaded the latest 32 bit Linux driver from nvidia.
3.) I ran this file and got the following messages in order:

- "No precompiled kernel interface was found to match your kernel; would you like the installer to attempt to download a kernel interface for your kernel from the Nvidia ftp site(ftp://download.nvidia.com)?" - I choose Yes

- "No matching precompiled kernel interface was found on the Nvidia ftp site; this means that the installer will need to compile a kernel interface for your kernel." - I choose ok

- "Error: Unable to find the development tool 'cc' in your path; please make sure that you have package 'gcc' installed. If gcc is installed on your system, then please check that 'cc' is in your path". - At this point I choose to exit the installer. I then installed gcc which pointed to and installed gcc version 4.3

- I reran the installer and received the following error message(paraphrased):
" Error: The version of the gcc used to compile your kernel is 4.1 and the version of the compiler installed on your machine that would be used to compile the code is 4.3. If you think this is ok click yes or click no to get out of the installer." - I choose to do nothing and got out of the installer

- Then I purged gcc from my machine and tried to install gcc-4.1 and received the message "gcc-4.1 is already the newest version."

What do I do now?

happybunny
11-06-2008, 10:43 PM
just choice OK at that option and continue on with the installer.

i sometimes see /usb/bin/gcc linked to different versions of gcc that is actually installed.

Check out what yours points to, but i often ignore that type of message and all is well

bwkaz
11-07-2008, 12:26 AM
1.) I downloaded the kernel headers successfully using the command apt-get install linux-headers-`uname -r`. BTW - what are kernel headers? Debian's "kernel-headers" package contains enough of the kernel sources to allow you to build modules that didn't come with the kernel. Normally this isn't a good idea, because an equivalent module that came with the kernel is maintained much better, but nvidia is one of the exceptions. (Actually it's the only one I know of...)

Anyway, it contains a lot of headers, along with a few files that hold configuration info (how Debian configured their kernel), along with a pair of symlinks at /lib/modules/<kernel version>/{build,source} that point to the root of the kernel source tree. (The build link is supposed to point to where the kernel built into; i.e. where its intermediate binaries went. The source link is supposed to point to where the sources came from. These are rarely different.)

- "Error: Unable to find the development tool 'cc' in your path; please make sure that you have package 'gcc' installed. If gcc is installed on your system, then please check that 'cc' is in your path". - At this point I choose to exit the installer. I then installed gcc which pointed to and installed gcc version 4.3

- I reran the installer and received the following error message(paraphrased):
" Error: The version of the gcc used to compile your kernel is 4.1 and the version of the compiler installed on your machine that would be used to compile the code is 4.3. If you think this is ok click yes or click no to get out of the installer." - I choose to do nothing and got out of the installer

- Then I purged gcc from my machine and tried to install gcc-4.1 and received the message "gcc-4.1 is already the newest version." The nvidia installer is trying to run cc to compile anything. This is the really old name of the system's C compiler (but is still present on almost any Unix-like system). It's not calling gcc, for instance, nor is it calling gcc-4.1, or whatever binary Debian's "gcc-4.1" package installed.

What you need to do is, check whether there's a cc executable or symlink on the system anywhere. It should be in /usr/bin, but it sounds like it isn't anywhere. Also, find out what binary the gcc-4.1 package installs (dpkg --listfiles gcc-4.1 may be helpful here; you may want to pipe that into less so it doesn't scroll off your screen). Find the gcc-4.1 (or whatever it is) in the output of the dpkg listfiles, and do this (as root) to create the cc symlink:

ln -s /whatever/path/to/gcc-4.1 /usr/bin/cc

That will make cc run /whatever/path/to/gcc-4.1 when it gets invoked. If this is the same version as was used to compile your kernel (you can find out what the latter is by running cat /proc/version), then the nvidia script should work.

However, you should NOT ignore this version-mismatch message. It's there for a reason -- let me quote from the nvidia README, which has a pair of FAQs on the older version of this error message, with the rationale. I've made the critically-important parts bold:

Q. Compiling the NVIDIA kernel module gives this error:

You appear to be compiling the NVIDIA kernel module with
a compiler different from the one that was used to compile
the running kernel. This may be perfectly fine, but there
are cases where this can lead to unexpected behavior and
system crashes.

If you know what you are doing and want to override this
check, you can do so by setting IGNORE_CC_MISMATCH.

In any other case, set the CC environment variable to the
name of the compiler that was used to compile the kernel.


A. You should compile the NVIDIA kernel module with the same compiler version
that was used to compile your kernel. Some Linux kernel data structures are
dependent on the version of gcc used to compile it; for example, in
'include/linux/spinlock.h':

...
* Most gcc versions have a nasty bug with empty initializers.
*/
#if (__GNUC__ > 2)
typedef struct { } rwlock_t;
#define RW_LOCK_UNLOCKED (rwlock_t) { }
#else
typedef struct { int gcc_is_buggy; } rwlock_t;
#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
#endif

If the kernel is compiled with gcc 2.x, but gcc 3.x is used when the kernel
interface is compiled (or vice versa), the size of rwlock_t will vary, and
things like ioremap will fail. To check what version of gcc was used to
compile your kernel, you can examine the output of:

% cat /proc/version

To check what version of gcc is currently in your '$PATH', you can examine
the output of:

% gcc -v



Q. X fails with error

Failed to allocate LUT context DMA


A. This is one of the possible consequences of compiling the NVIDIA kernel
interface with a different gcc version than used to compile the Linux
kernel (see above). Note that the installer now uses "cc" instead of "gcc" (and you may not be able to override this by setting CC anymore).

trilarian
11-07-2008, 02:06 PM
bwkaz: You are correct in your logic about cc <> gcc case. However, at least in Debian and for the particular case of NVIDIA driver install, all you need to do is apt-get install gcc. I just recently (2 days ago) did this on a fresh install for a friend. It will complain about cc versions, but when you OK that it installed fine and even made an NVIDIA control panel that was accessible from X (Gnome in his case).

The Coder
11-07-2008, 05:52 PM
So, the final consensus is just ignore the error message about the compiler version being different?

I installed gcc yesterday and it looks like it installs gcc-4.3 by default. Should I just install that and ignore the error? Should I bother creating a new system variable or change any symbilinks?

trilarian
11-07-2008, 06:15 PM
Short answer: yes, ignore and enjoy.

Long answer: The computer that is typing this message is using the NVIDIA install on Debian Sid which complained about cc versions. I just did the same for a friend, and I haven't experienced any issues. So, for what its worth I'd say ignore and enjoy box.

As for is it the correct way to do things - maybe bwkaz can enlighten you better as his post was very detailed and he obviously has more knowledge than me on that particular subject. As I was once told (be it correct or not) was that newer versions of a compiler does things differently and includes optimized code that is not present in earlier releases (natural progression of software). Since the kernel is your base set of functions - think skeleton of your body - all things must communicate or you could introduce a condition for a system crash. Major changes usually denote a change in the base number (2.x to 3.x instead of 4.1 to 4.2), though that is not a hard rule.

All that means is that a general rule of thumb is that all kernel modules be compiled with the same compiler version as the kernel itself to keep from introducing potential crashes.

In this particular case, I don't think NVIDIA keeps up with the experimental kernels (which are found in Sid) or the experimental compilers for that matter. So as long as you run Sid you will see this error. However, in my many years of using Debian I've never had an issue with ignoring that error for the nvidia driver.

Samsonite
11-07-2008, 11:44 PM
However, in my many years of using Debian I've never had an issue with ignoring that error for the nvidia driver.
Same here with Lenny, when it asks if you want to abort..."just say no".
PS: I only started getting that error less than a year ago. (Been using Debian for many years also).

bwkaz
11-08-2008, 12:25 AM
Long answer: The computer that is typing this message is using the NVIDIA install on Debian Sid which complained about cc versions. I just did the same for a friend, and I haven't experienced any issues. That doesn't mean it's safe. ;)

There are lots of code-paths in the nvidia driver that aren't always exercised. There are several that are only exercised extremely rarely. (It's the same problem as you have with all software: it's impossible to test it 100%, because there are just too many different codepaths, too many different configurations, etc., etc., etc.) If one of these extremely rare codepaths is the only one that uses a structure whose size changes depending on compiler version, then you won't see a kernel oops until your system exercises that codepath.

So just because you don't see any problems doesn't mean there aren't any. :p

(And besides, there is already a gcc package installed that matches the kernel version; all you have to do is use it!)

As I was once told (be it correct or not) was that newer versions of a compiler does things differently and includes optimized code that is not present in earlier releases (natural progression of software). Well, that's part of it, but not all of it.

Having a different level of optimization in two different parts of the kernel is bad from a performance POV, but it won't cause the kernel to crash and burn. But if you have one structure whose size or members depend on the compiler version, and you're passing around pointers to this structure, you will cause breakage as soon as the two different codebases try to use the structure.

Major changes usually denote a change in the base number (2.x to 3.x instead of 4.1 to 4.2), though that is not a hard rule. And gcc 4.3 includes a lot of changes compared to 4.2; let alone 4.1. I don't know for sure whether any of these changes affect how it compiles code (the ABI may be the same) -- but they might. The kernel might also explicitly ask for a different structure when it's compiled with different compiler versions (see the README snippet above: struct rwlock_t (the reader-writer lock) is empty in gcc 3.x and newer, including all 4.x versions, but nonempty for gcc 2.x. The kernel may do the same thing with 4.x (x<3) vs. 4.3, I don't know.)

All that means is that a general rule of thumb is that all kernel modules be compiled with the same compiler version as the kernel itself to keep from introducing potential crashes. Exactly. :)

In this particular case, I don't think NVIDIA keeps up with the experimental kernels (which are found in Sid) or the experimental compilers for that matter. It has absolutely nothing to do with what nvidia keeps up with.

It has everything to do with Debian's kernels being compiled with a different compiler than what Debian's "gcc" package provides. This isn't a big deal, though, because you can install "gcc-4.1" and get the same compiler, then just use it (which is what I was recommending before with the cc symlink stuff ;)).

Skipping the warning may be convenient, but it's also wrong. It may also work (for some indeterminate amount of time), but it's still wrong. :)

(Another workaround -- though a fairly bad one -- would be to recompile the kernel yourself, after installing gcc-4.3 via the "gcc" package. Then boot to the new kernel and rerun the nvidia installer. But that's a lot more work than adding a simple symlink.)