Recently a good friend of mine managed to uninstall all the kernels from his Ubuntu machine (what can I say - Monday morning and no coffee is a deadly combination). Luckily he had the install CD on hand so we did the following:
- Boot from the CD (we had Internet connection)
- Mount the Linux partition and chroot into it
- Reinstall the kernel with aptitude
- Reboot and go into Grub2 command mode
- Now do the following (commands need to be adjusted to match your partition - also, tab completion works, so you don't have to guess)
insmod part_msdos insmod ext2 set root=(hd0,3) linux /boot/vmlinuz-126.96.36.199-generic root=/dev/sda3 ro initrd /boot/initrd.img-2.6.38-6-686 boot
sudo su cd /media/.. chroot .
It seems that most of the examples on the 'net are for Grub 1 and little is out there for Grub 2. I found the following three: How to use Grub2 to boot Linux manually, The Grub 2 Guide, GRUB 2 bootloader - Full tutorial. Also, I didn't perform steps 4-5 because he just reinstalled Ubuntu (it was a fresh install anyway), but I tried it out separately on my laptop and it works.