I’ve done multiple Debian upgrades from Etch to Lenny and have noticed there are some issues with grub breaking. The upgrade somehow puts the wrong hard drive information in the default grub file.
Here’s some recommendations on how to perform the Lenny upgrade:
The safest way (before upgrading) is to look at the grub file:
nano /boot/grub/menu.lst
Look at the “default:” section and note which partition it uses to boot up. For instance look at the areas in red below:
root (hd1,1)
kernel /boot/vmlinuz-2.6.18-5-686 root=/dev/sda2 ro
In my situation, those two partitions were incorrect after performing the upgrade. This leads to ALL the items in the grub menu breaking, which can be scary at first. You can however mount the hard drive on a working copy of Debian to get the correct partition or use the emergency CD to get into a working shell.
Here’s a guide on how to upgrade from Etch
http://www.debianadmin.com/howto-upgrade-from-debian-etch-40-to-lenny-50.html
If your grub is broken after the upgrade and you didn’t look at the partition info:
There is still hope! When grub loads up, press the “e” key to edit the grub menu file.
If grub doesn’t even load Linux properly, you will need to edit this:
1) Select the line with root(XXX,XXX). Press the “e” key to edit the line
2) This will be a guessing game, but most likely changing the hd1 to hd0 can fit it. E.g. (hd0,1)
3) After making the change, press “b” to boot
4) If it works, go into /boot/grub/menu.lst to edit the file and make the change in the default section.
If grub loads Linux, but it hangs on loading root partition, you will need to edit this line:
kernel /boot/vmlinuz-2.6.18-5-686 root=/dev/sda2 ro
1) Press the “e” key to edit this line
2) Change the /dev/XXX to the correct partition. Again, this might be another guessing game
but you can try changing the root= to /dev/sda1 or /dev/sda2
3) After making the change, press the “b” key to boot
4) If it works, go into /boot/grub/menu.lst to edit the file and make the change in the default section.
my grub was screwed up, and for some reason vmware mounted my /boot as /dev/sdc2. But it wouldn’t work because I was using LVM and even when I did the above, it did try to boot, but ultimately failed because it wasn’t able to find anything in the logical volumes. You could see in the boot text that it was looking for logical volumes. And ESXi doesn’t support that I guess.