Recover Grub2 After Windows Install

If you run Ubuntu and you installed Windows later, then know what I’m talking about. Windows just wrote over the MBR record. Windows doesn’t play nice at all. You no longer have access to your Ubuntu distribution.

I’ve read tons of documentation how to recover Grub2, but this is the simplest and the one that worked for me. So, to recover Grub2 after a Windows install, just perform the following:

Boot from a Ubuntu Live CD.

Preferably the same release, but it doesn’t have to be as long as you have access to a Linux Terminal or the Bash shell.

sudo fdisk -l

That’s the letter L by the way. This should tell you where your Linux distribution is located. Mine is sda1. You may to look for the one with the Linux partition. Mine was set to ext4.

sudo mount /dev/sda1 /mnt

There shouldn’t be any errors if the partition is mounted properly. If you have experienced an error, you probably did something wrong like mounting a different partition or a partition that doesn’t exist.

sudo grub-install --root-directory=/mnt/ /dev/sda

Restore Grub2 to the MBR.

sudo shutdown -r now

There is probably a more graceful way of rebooting, but this one works as well.

sudo update-grub

Update the Grub menu after the reboot.

That was easy. Practically it’s just one command that really did the trick. There is no typing and editing involved. Like I said, the simplest way to recover Grub2 after a Windows install.