Mainline Kernel – How to Test with NVIDIA Drivers

kernelmainline-kernel

I am coming from Bug # 868950 on launchpad, a kernel related problem. To analyse the problem a bit deeper and see where it comes from, I was told to try out a mainline kernel to see if the problem persists.

It would be great if the person to answer this question could post a step-by-step guide on what to do. It would also be nice to explain why this is required and how exactly this helps the developers. I couldn't find any proper documentation on this for newbies. I'm sure this way more people will find themselves able to help out and we'll eventually do the devs a favor.
Note that I have to use NVIDIA drivers.

Best Answer

Mainline kernels are compiled from recent sources using the Ubuntu configuration, so any bugfixes will first appear in the mainline kernel. Since the kernel package receives a lot of bug reports, the developer team cannot spend a lot time on all bug reports. Your reported bug may be fixed before, so that's why they tell you to test it with the most recent kernel.

To install a mainline kernel:

  1. Find the latest kernel on http://kernel.ubuntu.com/~kernel-ppa/mainline/?C=M;O=D. At the moment, it's http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.1-rc9-oneiric/
  2. Create a new directory for saving the downloaded kernel packages (e.g. ~/kernel-test)
  3. Download the linux-headers*_amd64.deb, linux-headers*_all.deb and linux-image*_amd64.deb files. Replace amd64 by i386 if you're running a 32-bit OS, and pick the "pae" version if you want it. You can check if you're running pae now by looking in /proc/cpuinfo.
  4. Open a terminal and install the downloaded kernel packages:

    sudo dpkg -i ~/kernel-test/*.deb
    
  5. Reboot and the new kernel will automatically be selected. If it won't boot, either try pressing Ctrl + Alt + Del or using the power button. The next boot, the menu will appear. If not, hold Shift after the BIOS POST.

To uninstall the mainline kernel, simply uninstall the related packages:

sudo apt-get purge linux-headers-3*-generic linux-image-3*-generic

Replace * by the package names of the mainline kernels. It matches the file you've downloaded.

Be aware that the mainline builds are compiled with an older toolset which has some side-effects like being unable to unload kernel modules after loading them (this applies to DKMS packages like nvidia-current)