Home > General > Repairing/Restoring a missing GRUB2 bootloader

Repairing/Restoring a missing GRUB2 bootloader

December 1st, 2011

If you reinstall Windows or otherwise accidentally destroy your GRUB(2) bootloader, don’t worry.  This is a fairly straight-forward problem to fix.

1) Boot from a live-cd or USB drive with the same or similar Linux distribution

2) Open a terminal and become a superuser.  (“sudo su” for those that support it, “su” and the appropriate password for those that don’t)

3) Find the partition your operating system  lives on, something like this:

fdisk -l /dev/sda

Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2581 20731851 83 Linux
/dev/sda2 2582 2647 530145 82 Linux swap / Solaris

4)  Mount the partition in a temporary location, /mnt for example:

mount -t ext3 /dev/sda1 /mnt

5)  execute the following commands and reboot:


grub-install --root-directory=/mnt /dev/sda
update-grub

6)  Check to make sure your grub config is ok on reboot.  If not, edit your grub config file and rerun the “update-grub” command.

Categories: General Tags:
Comments are closed.