How to repair grub?

I have a vps using Ubuntu 12.04 LTS and I my host corrupted my vps so now it won't boot up. When it boots up it says:

Booting from Hard Disk...
error: file not found.
grub rescue>

How can I fix/repair this?


Solution 1:

You will need to boot from a rescue system. How the boot medium is select differs between VPS providers.

If you can somehow manage to boot an Ubuntu ISO image, you can follow the well known procedure to reinstall grub: The article here covers it pretty well: https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows (You can disregard the reference to "Windows")

If you need more help on how to boot the ISO image, please supply more information on your VPS (Maybe your provider name or a hint as to how you manage the machine, web interface ...).

Solution 2:

If you have a good internet connection, please consider downloading boot-repair iso disk image from sourceforge.org, here.

Then, burn it to the CD/DVD or ThumbDrive USB using LinuxLiveUSB or Unetbootin. Next, boot from the device and wait until the interface comes up.

You will see an application shown, just click on "Recommended Repair".