K.Mandla's blog of Linux experiences

Success! Compiling Nvidia 8776 driver on Feisty 2.6.20-xx-386

UPDATED, 24 April 2007: After two clean reinstalls without a hitch, I think there’s a better way to get the 9631 driver working on the 420/440/460 Go (and some other Geforce4 cards) than patching and rebuilding the 8776 driver.

Before you rebuild, or if you already have the 9631 (nvidia-glx) driver installed, try this:

That should be enough to get proper output, along with all the acceleration and eye candy that you’re due with the 9631 drivers. Where I was getting a dead screen before, the card forces output to the LCD (the Default Flat Panel) and I now have a proper desktop, just like the good old days.

If you already have the patched 8776 driver in place, you can still install the 9631 driver like you normally would (sudo aptitude install nvidia-glx) and add the above line to your xorg.conf, and it should also work (that was the first way I tried it).

If you want to read more about this, check out this thread on the NvNews forums or my brief explanation here.

Like I said, I’ve done two clean reinstalls and I’m using only the nvidia-glx package now. I can run Beryl, OpenGL games, and accelerated screensavers, without repatching or rebuilding anything. I’ll leave this post intact for future reference, or if the DFP option still doesn’t do the trick for you.

Happy hacking!
–K.Mandla

——

Woohoo! I managed to compile the 8776 driver against the Feisty kernel! Hooray! This means I’m not left out in no-man’s land with my Geforce4 440 Go! No more lockups! No more legacy drivers! Full video acceleration and eye candy! Whee!

The problem, as I understand it, is that the 8776 driver has to be patched before it can be compiled against kernels 2.6.19 and up. I found the answer on the nv News Linux forums, and after some experimentation, I got it working! :mrgreen:

If you think you’re in the same boat, or if you’re working with Feisty and you have a 440 Go (or 420/460 sister card, or even just a Geforce4 card), here’s my situation. You can decide if this applies to you.

The 96xx-series drivers packaged in Feisty’s nvidia-glx don’t work. The screen is powered off and eventually X segfaults catastrophically. The 97xx drivers are no better, but in that case Nvidia admits those drivers abandon pre-FX cards. The 8776 nvidia-glx drivers in Edgy were the last ones that worked for me.

The 7184 drivers in Feisty’s nvidia-glx-legacy have no proper video acceleration (without mangling your xorg.conf) and cause hard X lockups which are only fixable with a complete power-down or a hard reboot with ALT+PRTSCR+B.

The old 8776 driver installer won’t compile straightaway against Feisty’s 2.6.20 kernel, because of changes between both the Nvidia package and the Linux kernel itself (does that make sense? did I understand that correctly?)

The nv driver works, and allows you to use your machine “normally,” but doesn’t give you any video acceleration, and the X environment is kind of slow (okay, that one is not a bug, just a gripe). So technically yes, the nv driver is an option, but without full acceleration, I might as well be using a Vanta.

As a reference, this is the list Nvidia says works with the 8776 driver. If you’re in doubt over whether or not this method is for you, look for your card on that list, and it should give you an idea if your card was meant to run against the 8776.

(Edit: I’ve seen a few fixes or tweaks that might work, depending on your hardware, but in my case just didn’t. This one might help, but again, I think it’s going to depend on what your setup is. Rebuilding the patched driver is the only thing that has worked for me.)

Here’s how I fixed it on my machine. First, purge your system of anything even remotely related to Feisty’s default nvidia-glx or nvidia-glx-legacy drivers. Get them out, because having anything remaining is going to confuse the installer, or the driver, or both. Additionally, get rid of the restricted modules package for your kernel. I’m on linux-386, but I plan to try linux-generic next. (Note: I tried it and it works fine on -generic.)

You might be prompted to remove linux-386 as well; that’s okay, since it’s just a metapackage for the entire 386 substructure. It’s like removing a bottlecap. Everything underneath the bottlecap is fine, it’s just not nicely packaged any longer.

(Note: Make sure you remove the restricted modules. You’ll get driver errors on reboot if you leave the restricted modules in there. Do this even if you never installed a driver from the repositories!)

(Another note: I’ve noticed that removing linux-restricted-modules-generic still leaves linux-restricted-modules-2.6.20-15-generic, so make sure that gets pulled out as well.)

Now you’ll need some tools to build it up. I found this list on the nv News forums for Linux, and so it’s possible there is one or more things here that aren’t absolutely necessary. But I’d rather have it and not need it than need it and not have it. ;)

That can be a bit hefty (it’s about 20Mb altogether); be prepared for a lengthy download. Contrary to what I’ve heard elsewhere, you do not need to install linux-source. And remember to use linux-headers-generic, not linux-headers-386, if you’re not using linux-386 to start with. (I’ve experimented a little with this list and you absolutely need build-essential and linux-headers-generic or -386. But you can get by without pkg-config and xserver-xorg-dev. The installer will spit out errors, but still work.)

Next get the driver and the patch. Download the 8776 driver from the Nvidia site. Then jump to the nv News forums and grab the 8776 patch from here. (I’ve also made a copy of the internal text at the Ubuntu pastebin, just as a security measure. It’s an important little file to me.)

Now drop out of X completely. At this point you might want to cut-and-paste these instructions into a text file, or perhaps fire up your mom’s 733Mhz Windows ME machine so you can read the rest of the steps. However you do it, it doesn’t bother me.

Jump to a terminal with CTRL+ALT+F1. Log in. Then stop GDM (or KDM, or whatever display manager you’re using … if you use one at all).

sudo /etc/init.d/gdm stop

Next, decompress the driver with this command.

sudo sh nvidia-Linux-x86-1.0-8776-pkg1.run -x

That -x flag decompresses the goodies without running the installer. Now change into the directory where the guts are

cd NVIDIA-Linux-x86-1.0-8776-pkg1/usr/src/nv/

Here comes the actual patching.

sudo patch Makefile.kbuild ~/NVIDIA_kernel-1.0-8776-20061203.diff.txt

Make sure the path to the patch is correct; in my case I just dropped it into the home directory. If all went well, you should see four or five lines from patch, telling you what it did.

(Edit: Just for the record, you don’t need sudo to patch it if you didn’t use sudo to decompress it. I added it on the first run but I’ve gone without it since. The installer has to be run as root, but you can decompress and patch without root privileges. I don’t know why I mention that, but it might be important to someone. :roll: )

Now jump back up three directories, to where the installer program is, and execute it.

cd ../../..sudo ./nvidia-installer

From there, the installer program will take over. You should get options to download a precompiled kernel, and perhaps a license warning or two. Keep your fingers crossed, and if it finishes without a hitch, you’ll be asked if you want it to set up your xorg.conf file. I did, and you might want to also. It makes a backup of your current one.

From there, you can enjoy Warzone 2100 again. You don’t even have to reboot if your xorg.conf is ready. The installer builds and inserts the module, so you can go straight to startx or restarting your display manager. Cool, huh? ;)

I’m going to try this again on a clean and fresh installation to make sure I haven’t left anything out. But for the mean time, I’m glad it worked. And as always, if I’m misunderstanding some of this stuff or if someone has a better way of doing it, please let me know.

P.S.: Of course, the downside of this is, as soon as the kernel changes, the driver has to be rebuilt. When I was finished with this post, I updated to 2.6.20-13-386, and of course, X gives a blue screen of death on reboot. But all you have to do is rebuild and restart X again, and it’s back to working. It’s an inconvenience, but once Feisty is stable there will probably be fewer kernel updates. And it only takes about three minutes on my 1Ghz machine. It’s better than random X lockups or laggy redraws, in my book. ;)

P.P.S: Other updates will also require you to rebuild the driver — things like an xserver-xorg update or a few other things. The nice thing is, once the driver is patched, you can just rerun the Nvidia installer and it will replace the old driver with a new one — no need to repatch or decompress again. So if you want, you could keep a folder in your home directory with the patched driver, and when you get errors from updates or whatever, just rebuild and restart X. Time lost equals about three minutes, depending on the speed of you computer. ;)

P.P.P.S.: This rebuild also worked for me in Arch Linux, using the same procedure but without needing to install any additional packages. I expect it would also work for other distros, although the dependencies for building the driver are something I can’t predict. :(

P.P.P.P.S.: Just once more for the record, I describe using 386 throughout this, but the -generic series kernels work just as well. I’m assuming most people who read this are coming off a borked nvidia-glx dist-upgrade from Edgy. If that’s the case, you’re probably using linux-386, since it should be installed when you install nvidia-glx under Edgy, and in that case, you’ll want the -386 packages. Does that make any sense at all? And if you don’t know what kernel you’re using, find out with uname -a.

P.P.P.P.P.S.: I should mention that installing the driver this way also gives you access to the nvidia-settings panel and the nvidia-xconfig tool. So once your X is up and running you can trigger the settings panel and really tweak your setup. You can also fine-tune your xorg.conf file with something like sudo nvidia-xconfig --composite --allow-glx-with-composite --render-accel --add-argb-glx-visuals --no-logo. Fun, huh?

By the way. For the ones getting errors: If the error is X-server crash after reboot while the drivers working before; try disabling NVIDIA restricted-linux kernel modules by editing the appropriate configuration file: /etc/default/linux-restricted-modules or /etc/default/linux-restricted-modules-common via:

Please don’t blame Ubuntu, Victor. From my perspective, this is all Nvidia’s fault. They’re releasing drivers that don’t include the cards they say will work. Ubuntu is just repackaging them in the same manner they get them, and aren’t really responsible.

Jerry, make sure you’ve completely removed anything even remotely related to the old nvidia-glx system. You have to purge everything out of the system, or the installer will read the modules as mismatched.

Once you’re sure you’re clean, patch the driver and use the installer from the 8776 driver. And let the installer set up your xorg.conf file.

You shouldn’t have to reboot after the driver is built, but you can if you want. If you’re still getting errors about the module not loading, then something didn’t compile correctly. Start over and keep trying.

It should; I guess it’s more accurate to say that it should work with any card that ran 8776 under Edgy. What’s basically happening here is that you patch the existing 8776 Nvidia driver to mesh with the 2.6.20 kernel. So if you had success with the nvidia-glx driver under Ubuntu 6.10, you should be able to get this to work with 7.04. Let us know if you have any problems.

Hi, I have a geforce2 mx400 and like you, the last working driver was the 8776, and like you feisty killed it and refused to install it. I tried all the other drivers and combinations of nvidia-glx but still no joy. I followed you stuff and it did build a module for me out of the patched installer, only I still get fatal:error and it refuses to load the module nvidia.

Hi Alex. I don’t know if I have a solution for you, but these are the first things that come to mind.

1. Make absolutely sure that you take out nvidia-glx, nvidia-glx-legacy, or nvidia-glx-new, and the restricted modules for your kernel (it’ll probably be linux-restricted-modules-generic or linux-restricted-modules-386).

2. And watch out for that funny linux-restricted-modules-2.6.20-XX-generic or -386 module that sometimes is left behind, even after the metapackage is purged out. Try sudo dpkg -l linux-restricted-modules* and see if anything is marked as installed (it will show “ii” next to it). If you see anything there, strip it out.

3. Make sure you have the right headers package installed for your kernel, as well as the xserver-xorg-dev files. I know the installer will build the driver without some of those packages, but invariably I get errors either from the installer or on reboot, if I don’t include everything it wants.

4. You might try switching kernels, if it still hassles you. Jump from the -386 to the -generic (or vice-versa), reboot to it, purge out the old kernel, remove all the restricted modules, rebuild and see if that helps at all. If anything, it might work as a troubleshooting measure.

5. Since it doesn’t require a reboot to get the module in place, you could conceivably try the entire procedure from a Feisty live CD, and see if you can get things working that way. Your machine would have to be able to handle that workload, and you’ll need a bit of patience to get results, but it might give you an idea if it’s just a problem with a cluttered installation. I’ve had more than one insurmountable, unsolvable problems that dissipated completely with a clean installation. I know it’s not always an option, but it occasionally is the solution.

Like I said, I know there’s no hard answer in there, but if something works, let us know. If not, let us know that too. ;)

This forum really helped me get my Geforce 3 working with Ubuntu Feisty Fawn. Not sure exactly where credit goes to, but I would like to thank those responsible for this information.

I don’t suppose anybody could help so I could get beryl working again. I used it in Edgy Eft and love the ‘eye candy.’ If I follow the same steps I used in Edgy, everything freezes once I run Beryl. I have to hit ctrl-alt-backspace to use Ubuntu again.

If your machine can run the 8776 driver and you’ve used Beryl before, it should also work with this method. I don’t use Beryl much so I don’t have much advice to offer, but I would suggest the Beryl howto on the Ubuntu Document Storage Facility, as a place to start.

Let us know if you’re still having problems. I can install it as a test run, just to make sure it’s still working with this driver. Although to be honest, I regularly run 3D games and screensavers with this driver patch, so it would really surprise me if it didn’t work. :|

Thank you very much for your reply, as this is making me go mad. I removed and purged the whole lot and then repatched a 8776 installer and ran it again. Again it gave me a clean patch and I ran the installer again.

But alas, it fails on “sh: /sbin/lrm-video: not found”

So, I rebooted into the 386 kernel (I was running the generic kernel) and tried again from scratch (so repatching, and rerunning the installer). This gave the same error as above.

Thank you for a quick response, Mandla. I just tried the info from the storage facility and still no success. I also play 3d games and both them and glx screensavers work on my system. If you don’t mind, try it out to see what happens. If Beryl works for you, then maybe we could compare our settings to try to troubleshoot.

I want to add something I just discovered. Beryl itself works if I run Beryl through the terminal (leaving the terminal window open). If I close the terminal, then Beryl closes too. I’m fairly new to linux, I think programs that run in terminal normally work that way. Anyway, if I use Beryl-Manager, everything still freezes. I will try using the latest version sometime to see if the same thing happens. If not, then I will be downgrading again.

Try adding an ampersand (“&”) to the end of your terminal command, Robert. That should force the process into the background, and spare it from extermination when the terminal window is closed. :mrgreen:

Hey Alex, do you get any different results if you use a different driver? I seem to remember that 8756 driver was another option for the patch. I have not tried that yet though. I only used the 8776 version.

Mandla,
Just saw your reply, will have a go in the morning, but could you check that modprobe alias? I am curious if it even exists on your system, if so, maybe it is left-overs from the nvidia-glx/legacy/new package?

This machine has never had the packaged nvidia driver on it; only the rebuilt patched driver. I’m using the generic kernel, and I stripped out the restricted modules that were installed by default, like I described above. Does that help at all?

Right, I am little further (I think). I booted into gdm with the nv driver and checked synaptic, I had previously removed + purged all packages, but checked anyway. There weren’t installed, but when I clicked I could check ‘remove permanently’ on some of the packages, so I did that for all nvidia and linux-restricted-modules. Then repatched and rebuilt the driver.

When I rebooted it gave errors of the nvidia module not receiving interrupts from the device. So I added ‘noacpi’ ‘nolapic’ & ‘irqpoll’ to the grub list and rebooted.

BINGO! I have acceleration and am using the nvidia module!

I am a little unsure which grub commands I should add, as adding all of them didn’t work and a single one didn’t either. The three I chose were pure chance, so go figure?

I don’t know, maybe I was very glad to get Beryl of working. Well, maybe some of it. I figured that if the cube would work, then everything else would too. I just noticed some errors even though I’m able to use the 3D cube. Any suggestions how I could correct these errors?

Before I try this, I just want to make sure about something. I have a Netgear WG311v2 wlan card, which uses acx firmware drivers that in the past required the linux-restricted-modules. Was this changed in Feisty? Or will I likely break my wlan by uninstalling the restricted modules to build the nvidia drivers?

I suppose I could just use ndiswrapper, but that’s kinda felt clunky to me before. I seemed to have more luck with my connections using the acx drivers.

@Robert: I’m afraid I don’t have many tips for you on that one. You might need to check the Beryl forums to see if that will impede things, or if they can safely be ignored.

@Kallethen: I’m not sure, to be honest. I think if I relied on the restricted modules for another piece of hardware, I’d try the “UseDisplayDevice” option mentioned at the top of the page first. I have a feeling if you yank the restricted modules package in order to get the video display working, you might be sacrificing your wireless card. And if it were me, I’d want the wireless over video effects. Give it a try though, and see what happens.

Thank you, Mandla, for the help you did give. It’s just ‘eye candy’ that doesn’t work, so I’m not gonna complain too much. LOL. I tried using the 8776 patch on 9629 & 9631 to see what happens and did nothing. When I tried 9629 alone, it wouldn’t finish because of the kernel. When I tried 9631 alone, Everything came up surrounded by a rainbow of colors. I will look into it from time to time. If I find a ‘cure,’ I’ll be glad to post it so it can help someone else who may have the same or similar issue. I can’t right now, but when I’m able too, I’ll have to upgrade my video card. I did have the thought of downgrading back to Edgy Eft, but something tells me that it’s not worth it just for ‘eye candy.’

That happens to me as well, Shawn. I’m not really sure why. It seems like purging those out should include that package, but sometimes it doesn’t. It’s possible it’s somehow mislinked, but regardless, I just manually remove it, like you suggest. If you leave it in, you’re aimed for driver errors when you reboot.

Hi Mandla,thank you for your aid but for me this solution doesn’t work. I’ve done everything you wrote, but this is the message:
(EE) Failed to load Nvidia Kernel Module!
(EE) ABORTING
(EE) Screen found but none have an usable configuration

I don’t have any real explanation, but all of Beryl works now. The only thing I did different was try to install the program from the menu (Add & Remove Applications) instead of the Synaptic Package Manager. Maybe the source was different, more reliable or a bad connection, I don’t know. All I know is this time I went through everything and it all works.

I was able to get the 9631 working on Feisty from the repository. The trick was to use “nvidia-xconfig” to setup the xorg.conf instead of “nvidia-glx-config enable”. HOWEVER, OpenGL still didn’t work for me. I had the right resolution and color depth, but nothing that relied on OpenGL would display.

That didn’t surprise me though. I had the same problem on Edgy AND WinXP with 9631 drivers. 8776 were the last drivers that allowed my Geforce4 MX to work properly with OpenGL on any operating system I’ve tried.

I decided to try to rebuild the 8776 drivers. That went without a hitch, thank you very much for this blog entry! Yes, removing the linux-restricted did kill the ACX drivers, but I switched to ndiswrapper instead and so my wireless is working (though I still had to blacklist acx from modprobe, which I kinda expected).

Thanks again for this useful set of instructions on getting the drivers I needed. Now to go play some NWN!

—
(from the thread:)
sargo
I fixed too… and Feisty runs like a charm… I saw a confirmed bug about nvidia-glx-new (in Ubuntu bugs) and although you uninstall completely the package one file remains. This file is /lib/linux-restricted-modules/.nvidia-new-intalled. In my case I removed that file and made a reinstallation of nvidia-glx and all worked like always but without XGL ( ).

—

I am running beryl with forced AIGLX and had multiple x screens working yesterday (still can today but without beryl), but today vids won’t open on screen1 :(

OOohhh man that “UseDisplayDevice” “DFP” worked beutifully in Mandriva 2007.1.
I cant tell how happy I am, I’ve been trying to get nvidia working for like a year and a half. I’m a total newbie and have just given up more times than I d like to say.
Thank you

This is great!!!!! Thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you!!!!!!
Really thanks for the trick, I’ve got mad during these last 2 weeks to enable 3D on making stupid geforce!! You’re great!
Now I just need to figure out why my desktop effects don’t work! =)

Thought I should let you know that even after patching, building, and installing the 8766 nvidia accelerated driver, you might have problems with it inexplicably NOT LOADING.

On Ubuntu Feisty x86 Desktop I eventually tracked this down to an artifact of removing the linux-restricted modules packages, especially if you’ve previsouly had the Feisty-supplied nvidia restricted driver installed.

It appears that when you do this, the removal adds the nvidia module to the kernel module blacklist!

I thought I should let you know that even after patching, building, and installing the 8776 nvidia accelerated driver, you might have problems with it inexplicably NOT LOADING.

On Ubuntu Feisty x86 Desktop I eventually tracked this down to an artefact of removing the linux-restricted modules packages, especially if you’ve previously had the Feisty-supplied nvidia restricted driver installed.

It appears that when you do this, the removal adds the nvidia module to the kernel module blacklist!

I know this forum is related to Nvidia issues, but I was wondering if anyone here might be able to help me with a font issue, i think. I’m having problems with the apostrophe in the browser and in pdf files, maybe other places too I haven’t noticed. When the pages loads or a document loads, it shows a question mark in a diamond or a group of 3 characters beginning with “&.” I installed mstcorefonts and that helped some, but when the text is bold it doesn’t know how to handle the apostrophe, so far anyway. Again, this only happens in the browser and in pdf files, maybe other places too I haven’t noticed. I’m able to use the apostrophe with out any problems ‘ ‘ ‘ ‘ . I find it so baffling that certain things don’t know how to handle it, but I’m able to use the apostrophe without any problems.

Your alternate advice on DFP did not cut it for me. My monitor is FlatPanel but with VGA connector through a KVM. As far as nVidia’s driver cares, that is a CRT (check their READMEs). Anyone using a 15-pin VGA is using a CRT from nVidia’s viewpoint.

You can see my “non-3D working” xorg.conf for 96xx from the bug report link. I will have to patch 8776 if I want 3D.

I need your help. My son is incarcerated and does not have access to internet. He recently installed Ubuntu but needs the Nvidia GLX driver. Is there a way for me to download it to CD? I am able to send this to him. Thanks for your reply, and expertise.

You could, but to be honest, if you’re going to burn it to a CD you might as well download the entire 7.04 alternate and send him that. That way, if there’s any other software he might need that’s on the CD, he has it. No sense using a CD on one package when you can cram the entire installation set into the same space, for the same cost and same postage. :mrgreen: