Skip to content

Instantly share code, notes, and snippets.

@sathishmanohar
Created May 21, 2012 17:15
Show Gist options
  • Save sathishmanohar/2763371 to your computer and use it in GitHub Desktop.
Save sathishmanohar/2763371 to your computer and use it in GitHub Desktop.
Recovering GRUB 2 Boot Loader - Steps and Instructions
# This is text format of the instructions shown in the below Youtube video
# http://www.youtube.com/watch?v=ajs9rO5upZA
# First get a ubuntu Live CD or USB Stick and boot from it
# Check all the Hard disk and Partitions using following command
sudo fdisk -l # Now take a note of the partition, on which linux is installed which may be like: /dev/sda1
# 3. Mount the partition where you need to install GRUB 2 (Hard disk partition)
# Now the file system appears in nautaulis and command line is not file system of Hard disk
# Instead it is the file system of the live cd itself, now we have to mount the correct
# Hard disk partition to make changes to actual Hard Disk MBR
# For that we need to do the following steps:
sudo mount /dev/sda1 /mnt
mount
# 4. Mount the partition to alternate location
sudo mount /dev/sda1 /mnt/boot
# 5. Create an unbreakable link from the /dev folder on the live image you booted from,
# to the /dev folder on the partition you mounted to /mnt
sudo mount --bind /dev /mnt/dev/
# 6. Now we have to change the root from live CD root ( / ) to mounted partition's root
sudo chroot /mnt
# 7. Now you are in a new root shell, in which the mounted partition is the new root
# You can verify this typing ls
# Since, we are in the mounted partition now, we can got ahead and install GRUB 2
sudo grub-install /dev/sda #Installations should finish now, with no errors
# 8. Exit your CHROOT shell, but exit or ctrl+d
exit #Now you are in Live CD/USB Shell
# 9. Unmount the partitions we've mounted before - to have a clean reboot
sudo umount /mnt/dev
sudo umount /mnt/boot
sudo umount /mnt
# 10. Reboot
sudo reboot #Remove Live CD or USB Stick to boot from Hard Disk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment