kernel panic in ubuntu

A kernel panic occurs mostly due to a critical update gone wrong inside the OS kernel. If you have installed a kernel update (or any critical “security” update that involves a new kernel) in Ubuntu (>= 9.10), then on reboot you may get a kernel panic error. The issue is most likely in dual-boot (Linux+Windows) systems using wubi. Generally, it comes with an error like this:

Kernel panic ‑ not syncing: VFS: Unable to mount root fs on unknown-block (8,1)

This particular issue is because after update, the kernel is unable to point to the root. The  kernel image resides in /boot/initrd.img-2.x.yy-zz-generic. If you are updating, you will most likely have another (lower version) kernel as a savior. You’ll have to load this kernel and then recover the initrd.img of the corrupt kernel from there.Let us consider an update to kernel 2.x.yy-zz from 2.x.aa-bb. On selecting 2.x.yy-zz-generic in GRUB2 menu, you got some error like above. You’ll get the same error even with the 2.x.yy-zz-generic (recovery mode) option. So in such a situation,

1. Reboot and select 2.x.aa-bb-generic in GRUB2. You should be able to load into Ubuntu. In case you’re not, you’ll need to reinstall GRUB by booting from a Live CD.

2. Open terminal and check file system:

sudo fsck

If some orphan pointers are present, they will be recovered. Occasionally, this step would suffice to resolve the issue.3. Try restoring original configuration for kernel:

sudo dpkg-reconfigure linux-image-2.x.yy-zz-generic

This will try to recover the corrupt kernel. If it fails or you get a message like the above kernel was not installed, then move on to step 4. Else you’re done.4. Install kernel:

sudo apt-get install ‑‑reinstall linux-image-2.x.yy-zz-generic

This will freshly install the kernel and clean up duplicates. You can now restart and boot into 2.x.yy-zz-generic.A way to avoid kernel panic after update is to install GRUB2 before reboot. Even better is to avoid updating the kernel too often; if you do need to update, at least wait for sometime before any known issues with a new kernel are resolved by the community.

Update 12/07/2010: Other instances of boot-failure

Booting through wubi (Windows Installer, for Ubuntu installed within Windows) can also fail in other ways after updating a kernel. The grub may fail to show the menu and drop to its command prompt, or there may be a message like

ALERT! root.disk not found. Dropping to a shell!

This will drop to a command prompt (initramfs shell). As of this date, this is a reported problem in grub-2, the version of grub that is shipped with Ubuntu nowadays. This causes relocation of wubildr (which has information about the root.disk) at every kernel update. To prevent unwanted updates of critical packages, they can be selectively locked in update preferences. 


Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s