Ubuntu upgrade from 10.04 to 11.10 and Grub

So you upgraded your Virtual machine linux-server and now you get sh:grub> oops!

Before you update to 11.04 or more do:

sudo apt-get install grub-pc
sudo upgrade-from-grub-legacy

But if you didn't update to grub-2 before going to 11.04/11.10 via a do-release-upgrade

Boot the 11.10 livecd, go to terminal and if you had a LVM drive and the boot parition is at /dev/sda5:

sudo mkdir /mnt/boot
sudo mount /dev/sda5 /mnt/boot
sudo grub-install --boot-directory=/mnt/boot /dev/sda

Reboot on next boot hold SHIFT key.

Choose first option, edit it and remove the vt.handoff=7. (or just hit ALT+F! when you see the cursor)  Machine should boot fine.

If you remove grub DO NOT REBOOT until grub-pc is installed.

apt-get purge grub-common
 apt-get install grub-pc
grub-install --recheck /dev/sdX

If the above doesn't work: https://help.ubuntu.com/community/Grub2#Purge_.26_Reinstall