0

What do I do to reinstall the GRUB boot-loader, since I heard the Windows boot-loader overwrites GRUB.

  • good thing i still have my LIve USB – win10 haterz Apr 24 '16 at 15:46
  • IF BIOS/MBR and Ubuntu was in logical partition, Windows "forgets" to rewrite partition table correctly. http://askubuntu.com/questions/654386/windows-10-upgrade-lead-into-grub-rescue/655080#655080 and: Parted rescue seems easier than testdisk http://askubuntu.com/questions/665445/upgraded-to-windows-10-on-dual-boot-and-cant-boot-to-ubuntu-partition/665462 – oldfred Apr 24 '16 at 15:57

2 Answers2

1

Boot from the live CD or live USB, in "Try Ubuntu" mode. Determine the partition number of your main partition. GParted (which should already be installed, by default, on the live session) can help you here. I'm going to assume in this answer that it's /dev/sda2, but make sure you use the correct partition number for your system!

Mount your partition:

sudo mount /dev/sda2 /mnt  #Replace sda2 with your partition number

Bind mount some other necessary stuff:

for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done

chroot into your Ubuntu install:

sudo chroot /mnt

At this point, you're in your install, not the live session, and running as root. Update grub:

update-grub

If you get errors, go to step 7. (Otherwise, it is optional.)

Depending on your situation, you might have to reinstall grub:

grub-install /dev/sda
update-grub # I'm not sure if this is necessary, but it doesn't hurt.

If everything worked without errors, then you're all set:

exit
sudo reboot

At this point, you should be able to boot normally.

If you cannot boot normally, and didn't do step 7 because there were no error messages, try again with step 7.

Sometimes giving GRUB2 the correct configuration for your partitions is not enough, and you must actually install it (or reinstall it) to the Master Boot Record, which step 7 does. Experience helping users in chat has shown that step 7 is sometimes necessary even when no error messages are shown

Defused
  • 11
  • 1
  • Copied from http://askubuntu.com/a/88432, an answer to a suggested duplicate question. Please read http://askubuntu.com/help/referencing – Martin Thornton Apr 24 '16 at 17:42
0

Boot from the Ubuntu installation media and select Try Ubuntu without installing. When you have entered the Ubuntu Live desktop, open a terminal and execute the following commands.

In case your machine has UEFI BIOS and Windows and Ubuntu are installed in EFI mode :

sudo mount /dev/sd*** /mnt
sudo mount /dev/sd** /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/sd*
update-grub  

Note : sd* = disk | sd** = efi partition | sd*** = system partition

In case it has legacy BIOS and Windows and Ubuntu are installed in MBR (msdos) mode :

sudo mount /dev/sd** /mnt  
sudo grub-install --boot-directory=/mnt/boot /dev/sd*

Note : sd* = disk | sd** = system partition

To identify disk and partition numbers you can use GParted - it is included in the install media.

cl-netbox
  • 31,163
  • 7
  • 94
  • 131