testkernel script to automate trying new kernels

Neal McBurnett neal at bcn.boulder.co.us
Tue Feb 28 22:41:17 UTC 2012

I ran into a reproducable kernel bug last month: precise crashed within a minute of booting, every time.

Joseph Salisbury ran a "git bisect" series of tests to figure out when in linux 3.1 the bug was introduced.  That is a clever semi-automated binary search of the ten-thousand or so git commits during the development of 3.1  It required thirteen builds from him, and thirteen tests by the folks with the right hardware: download, install, reboot, try to remember and select the name of the new kernel, etc.  And often, missing the grub screen on reboot, getting the wrong kernel, and having to reboot again....

So I had some time and an "itch" to meditate on the situation, and look for an easier way.  I didn't find any scripts out there to help me out, so I wrote my own cute little python program.  For now I put it up as a simple one-file "gist" on git:

 testkernel: automate many linux kernel testing steps - great for a git bisect

It is a command line script, and you specify the flavor of kernel you want, the architecture, and where the .debs are:

 testkernel -f generic-pae -a i386 http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.2.5-precise/

It then does these things to make linux kernel testing easy:
  looks in the indicated folder on the web
  downloads the .deb files for the kernel of the given type
  installs them locally
  configures grub2 to reboot to the given kernel on the next reboot

So I can just start it up, come back later to reboot (automatically into the right kernel), and then do my testing.

I also find it less of a hassle now to test mainline kernels as they come out.

Does this seem useful to others?  Is it better than any other alternatives out there?

If so, I'm hoping it would be suitable for including in some existing Ubuntu package, or a new one if that's appropriate, and describing it in our testing documentation.  Then we could refer to that from similar bug reports, and hopefully increase the rate of people being willing to help out with kernel testing.

I noted a few bugs and several TODO items in the initial comment in the script.  The one I need help with is grub-reboot - recent version of Ubuntu sometimes put the new kernel in a sub-menu, and sometimes at the top of the main menu.  I haven't figured out when to add a "2>" to the kernel name for grub-reboot, so sometimes it doesn't reboot into the right one, and you have to do it manually.


Neal McBurnett                 http://neal.mcburnett.org/

More information about the ubuntu-devel mailing list