Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to Restore or Reinstall Grub 2 with a Ubuntu Live CD or DVD  (Read 1446 times)

0 Members and 1 Guest are viewing this topic.

jibinw

  • Guest
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. This tutorial explain how it is possible.

Using the sudo command, especially from a Live CD can do serious damage to your system. Read all instructions and confirm you understand before executing any commands. When pasting into the Terminal, use Ctrl+Shift+V, NOT Ctrl+V.

Mount the partition your Ubuntu Installation is on. If you are not sure which it is, launch GParted (included in the Live CD) and find out. It is usually a EXT4 Partition. Replace the XY with the drive letter, and partition number, for example: sudo mount /dev/sda1 /mnt.

Code: [Select]
sudo mount /dev/sdXY /mnt
Now bind the directories that grub needs access to to detect other operating systems, like so.

Code: [Select]
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
Code: [Select]
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/sda, grub-install –recheck /dev/sda.

Code: [Select]
grub-install /dev/sdX
Code: [Select]
grub-install --recheck /dev/sdX
Code: [Select]
update-grub
Now grub is back, all that is left is to exit the chrooted system and unmount everything.

Code: [Select]
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 have just Repaired/Restored/Reinstalled Grub 2 with a Ubuntu Live CD!
« Last Edit: June 09, 2018, 04:38:30 pm by jibinw »