Sunday, June 22, 2008

Keeping the last successfully booted kernel

It's always been possible to boot to an older kernel on Ubuntu if a new kernel didn't work. However it was never possible to boot to the last kernel that was known to work, nor was there ever a guarantee that there would be an old kernel around.

Let's say someone installs Intrepid 8.10 Alpha 1 with kernel 2.6.26-2-generic. After installing (which presumably went well), they upgrade and get a new 2.6.26-2-generic kernel (remember, newer kernels don't always bump the "2" ABI). Upon rebooting, they discover this new kernel doesn't work for them. What now? There is no longer an older kernel to boot to.

Enter "last-good-boot". A new mechanism now in development that will save away the kernel+initrd+modules for the last time your system booted successfully.

It will add this as an entry in grub for visibility.

Currently there are packages in a PPA:

deb intrepid main
deb-src intrepid main

It includes the module-init-tools and grub changes needed to test. After installing these packages, you will need to reboot in order to get your first last-good-boot.

Feedback welcome.


  1. This is amazing. Thanks very much!

  2. Combine this with the specification to clean out cruft, including older kernels, and we have both a clean and a solid system! I really like it!

    I do hope that combination makes it into Intrepid.

    For non-dual boots, or for otherwise hidden grubs - hell, even for shown grubs, could this be shown automatically (and just) when a kernel actually fails? I know this is asking much, but that would be a fantastic user-friendly way to present it.

  3. stoffe,

    That's exactly why I implemented this feature. See the wiki page for more information.

  4. Awesome! This is exactly the kind of improvement that makes Linux more friendly to the wider, non tech world.

    +1 Linux world domination!
    +100 Ben!

  5. Ben, what a fantastic idea. Keep them coming. This is one of those "two birds with one stones approach" in that it helps you clean up old kernels while preserving a known good kernel.

  6. hooray! windows 95 tech at last! :DDDDDDDDDDDDDD