Ubuntu Natty vs. nVidia

Despite all the problems I had with Ubuntu updates over the last couple of years, I decided to update my work machine to Ubuntu 11.04 (“Natty Narwhal”). I expected problems and I wasn’t disappointed, after the upgrade I was left standing in the dark, without X.

Fortunately, the rest of the system worked, so I was able to log into the system via console. The log file in /var/log/Xorg.0.log showed the following error message:

[   161.049] (II) LoadModule: "nvidia"
[   161.049] (II) Loading /usr/lib/xorg/extra-modules/nvidia_drv.so
[   161.049] (II) Module nvidia: vendor="NVIDIA Corporation"
[   161.049]    compiled for 4.0.2, module version = 1.0.0
[   161.049]    Module class: X.Org Video Driver
[   161.052] (EE) NVIDIA: Failed to load the NVIDIA kernel module. Please check
[   161.052] (EE) NVIDIA:     system's kernel log for additional error messages.
[   161.052] (II) UnloadModule: "nvidia"
[   161.052] (II) Unloading nvidia
[   161.052] (EE) Failed to load module "nvidia" (module-specific error, 0)
[   161.052] (EE) No drivers available.
[   161.052]
Fatal server error:
[   161.052] no screens found
[   161.052]

After a bit of pondering I remembered that I was using a graphics driver from Ubuntu’s “restricted” repository for my nVidia 9500 GT. The upgrade process installed a new kernel (package linux-image-2.6.38-8-generic-pae, check uname -r to see which kernel you’re running) but wasn’t able to rebuild the graphics driver kernel module because it neglected to install the matching header files (package linux-headers-2.6.38-8-generic-pae).

Here’s what I did:

sudo apt-get install linux-headers-2.6.38-8-generic-pae
sudo dpkg-reconfigure nvidia-current

The nvidia-current package recompiled the kernel module and after a reboot (just in case), my graphical login was back and things worked normally. At some point I also removed my /etc/X11/xorg.conf and recreated it from scratch using sudo nvidia-settings, but I don’t think this step was necessary.

The next problem I encountered was with my dual monitor setup (I’m using two monitors with a single graphics card). Unity didn’t let me place windows on the second screen for some stupid reason. Using the nvidia-xconfig tool, I switched from “Separate X screen” configuration to “TwinView” and things worked again.

This entry was posted in linux and tagged , . Bookmark the permalink.

15 Responses to Ubuntu Natty vs. nVidia

  1. Pierangelo says:

    Sincerly, i love you.

  2. dpal says:

    you are a godsend. thankyou thankyou thankyou

  3. mafr says:

    I’m glad it worked for you, too :)

    • dpal says:

      I had to re-visit this site again after the last kernel update. Is there a way to force ubuntu to download and install the matching headers?

      • mafr says:

        You mean, from now on always install matching headers automatically when upgrading the kernel?

        I don’t think there’s anything you can do as a user except for manual intervention. The only solution I see is Ubuntu adding dependencies to the headers to each kernel package they produce. I somewhat doubt that this will happen :-/

  4. jklooste says:

    Fixed me up to! You = Awesome

  5. Logan says:

    Hi mafr,
    Thanks you very much!!!. You saved lot of time and trouble. It worked for TOSHIBA TECRA M10 Laptop. Thanks Again.

  6. Well, that fixed it for me too! However, what I cannot, for the life of me, understand is that Ubuntu cannot get this NVidia driver thing sorted out properly for once! All upgrades since Jaunty (if I recall correctly) have had a similar problem. I had to load the Nvidia driver directly from NVidia each time. This time round though, the latest driver was loaded, but didn’t load, as you experienced as well. Surely this should have been dealt with in the upgrade process?

  7. nizyn says:

    After I installed linux headers, I put “sudo dpkg-reconfigure nvidia-current” Than it answered me following:
    ” Module build for the currently running kernel was skipped since the
    kernel source for this kernel does not seem to be installed.”
    What should I do know? Which kernel is not installed?

    • mafr says:

      Perhaps you installed the wrong kernel headers. You need the header package that matches your kernel exactly. What does the “uname -r” command return?

  8. Ian says:

    I got similar errors, but the solution for me was to boot into the non-PAE version of the kernel. Not sure why this should be, but it worked for me! You can make this the default kernel by editing the /boot/grub/menu.lst and changing the default value (to 2 in my case – NB you have to count from 0).

  9. Diego says:

    Thanks man!

    However, I had to rollback to my old kernel, just didn’t have time to fix it up properly.

    Was trying to install 2.6.38, rolled back to 2.6.32… rebuilding and whatnot.

  10. ayush says:

    thank man….(from india)
    had tried at least 20 different methods
    but finally this was the one that worked
    people like you make this world a better place…….

  11. mafr says:

    You’re welcome!

  12. slux says:

    Holy shit thanks :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s