msgbartop
A chronological documentation test project, nothing serious, really!
msgbarbottom

03 Oct 2007 How to restore Grub from a Ubuntu Live CD

Posted by

This will restore grub if you already had it installed but lost it due to a Windows install or some other accident that erased/changed your master boot record (MBR) so that grub no longer appears at startup or it returns an error.

Boot into the Ubuntu Live CD. This can be the Live installer CD or the older Live session Ubuntu CDs.

When you get to the desktop open a terminal and enter.

mkdir mnt
mount /dev/xxx#

Where xxx is your linux disk, eg sda or hda, and # is the partition number.

Change rootdrive to the previously mounted drive

chroot mnt /bin/bash

Access the “grub>” prompt (i.e. the grub shell).

sudo grub

Enter these commands

find /boot/grub/stage1

This will return a path/location. If you have more than one, select the installation that you want to provide the grub files.
Next, THIS IS IMPORTANT, whatever was returned for the find command use it in the next line (you are still at grub>. when you enter the next 3 commands)

root (hd?,?)

Again use the value from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1)

Next enter the command to install grub to the mbr

setup (hd0)

Exit the grub shell

quit

Grub is now installed to the MBR.
When you reboot, you will (hopefully) have the grub menu at startup.

Comments are closed.