Skip to content

Instantly share code, notes, and snippets.

@ram-rana-16
Last active June 25, 2016 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ram-rana-16/685704b87101fb727b79 to your computer and use it in GitHub Desktop.
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
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