Tuesday, October 12, 2010

Spooked by a corrupt initrd image

Halloween is approaching. It is apt I have a scary tale to tell.

I left my laptop on in the sun, on a surface with poor conductivity. As I opened it, I glimpsed it complaining of heat exhaustion before it powered off. (That’s happened to me before, too!) I let it cool off, but on booting Ubuntu, a terrifying message was all that appeared on the screen:

Error 16: Inconsistent filesystem structure

Uh oh. Did I lose everything? What haven’t I backed up lately? Indeed, what have I backed up lately?

I searched online for the error message, and took heart when others reported no data loss in various forums. Running fsck was suggested, though in at least one case they resorted to reinstalling the OS. No way I’m doing that!

My first instinct was to dust off my USB DVD writer and burn a Ubuntu rescue CD. This turned out to be unnecessary, but at least I was reassured when I used it to mount the Linux partition and found my files intact. Firing up fsck had no effect: I was still defeated by the same error message.

Playing with the GRUB command-line (by pressing “c” instead of selecting an kernel to boot) showed that the initrd image was corrupted, as selecting the newest image with the “initrd” command triggered the same error message.

The solution was easy. Boot up an older kernel, then download a fresh copy of the initrd image by running:

$ sudo apt-get install --reinstall linux-image-2.6.32-25-generic

4 comments:

rkumar said...

unrelated to this post.

Could you give a small post about using git for maintaining multiple releases of a software. (I;ve just had a look at your wonderful Git Branch Wizardry) but may need time to let that all seep in.

Version 1.1 is now maintenance. Version 1.2 has major changes, and will be backward incompatible.

(I use github, btw).

rkumar said...

Following up on previous, I used the command:

$ git checkout 1bxxxx -b 1_1maint

to pick out the last commit of 1.1 and created a 1.1 maintenance branch.

So the first step is through ! :)

Ben Lynn said...

I'm guessing you'll be mostly working in 1.2, and occasionally you'll have minor fixes you want to give to version 1.1 as well.

In that case, if the code is sufficiently similar, in the 1.1 branch, you may be able to git cherry-pick the tiny bug-fix commits from 1.2.

Otherwise, if the code is rather different, perhaps the easiest solution is to git apply a patch (which you can create with git diff) and modify it by hand for 1.1 before committing.

Ben Lynn said...

Another possibility is to switch to the 1.1 branch every time you fix a 1.1 bug, and then switch back to the 1.2 branch, before merging the commits. However, I think this requires more discipline.