eXploitLab4 | Information Technology

eXploitLab4 | Information Technology

How to Repair, Restore, or Reinstall Grub 2 with a Ubuntu Live CD or USB



Grub 2 typically gets overridden when you install Windows or another Operating System. To make Ubuntu control the boot process, you need Reinstall (Repair/Restore) Grub using a Ubuntu Live CD.
sudo mount /dev/sdXY /mnt

Now bind the directories that grub needs access to to detect other operating systems, like so.

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
Now install, check, and update grub.
This time you only need to add the drive letter (usually a) to replace X, for example: grub-install/dev/sdagrub-install –recheck /dev/sda.
grub-install /dev/sdX
grub-install --recheck 
/dev/sdXupdate-grubNow 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
Shut down and turn your computer back on, and you will be met with the default Grub2 screen.
You may want to update grub or re-install burg however you like it.

Congratulations, you have just Repaired/Restored/Reinstalled Grub 2 with a Ubuntu Live CD!


Post a Comment
Thanks for your comment
Powered by Blogger.



close