Last active
June 25, 2016 16:31
-
-
Save ram-rana-16/685704b87101fb727b79 to your computer and use it in GitHub Desktop.
How to Repair, Restore, or Reinstall Grub 2 with a Ubuntu Live CD or USB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo mount /dev/sdXY /mnt | |
[It is usually a EXT4 Partition. Replace the XY with the drive letter, and partition number, for example] | |
sudo mount --bind /dev /mnt/dev && | |
sudo mount --bind /dev/pts /mnt/dev/pts && | |
sudo mount --bind /proc /mnt/proc && | |
sudo mount --bind /sys /mnt/sys | |
[Now we jump into that using chroot.] | |
sudo chroot /mnt | |
[This time you only need to add the drive letter (usually a) to replace X, | |
for example: grub-install /dev/sda, grub-install –recheck /dev/sda.] | |
grub-install /dev/sdX | |
grub-install --recheck /dev/sdX | |
update-grub | |
[Now grub is back, all that is left is to exit the chrooted system and unmount everything.] | |
exit && | |
sudo umount /mnt/sys && | |
sudo umount /mnt/proc && | |
sudo umount /mnt/dev/pts && | |
sudo umount /mnt/dev && | |
sudo umount /mnt | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment