Restore Grub after Windows Install: After installing Windows alongside Linux, the Windows bootloader overwrites the Grub bootloader. This results in not being able to boot into Linux, which is where a Grub fix comes in.
There are several different methods that can be used to restore Grub after Windows Install. The following section covers two of them. The first being a manual step by step method, and the second being a more automated approach. I've had great success restoring grub on all of my Windows 11 and Windows 10 installs using either method.
How to Restore Grub after Windows Install
To restore Grub2 after a Windows install:
- Boot from a Live Linux USB drive. You can use any Live Linux distribution for this, such as Ubuntu, Fedora, or Debian.
- Once you have booted into the Live Linux environment, open a terminal. For example;
Ctrl+Alt+T
- Type the following command to list all the partitions on your system:
sudo fdisk -l
- Identify the partition where your Linux operating system is installed. Note the partition name, for example,
/dev/sda1>/code>.
- Mount the partition with the Linux operating system:
sudo mount /dev/sdx1 /mnt
Replace
/dev/sdx1
with the actual partition name. - Mount other necessary partitions:
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
- Chroot into the mounted Linux partition:
sudo chroot /mnt
- Install the Grub bootloader:
sudo grub-install /dev/sdx
Again, replacing
/dev/sdx
with the actual device name of your hard drive. If you have more than one hard drive, make sure to select the one where the Linux operating system is installed. - Update the Grub configuration:
sudo update-grub
- Exit the chroot environment:
exit
- Unmount the partitions:
sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt/sys
sudo umount /mnt
- Reboot your computer from the terminal.
sudo reboot
How to Restore Grub after Windows Install - Boot Repair
To restore Grub after Windows Install, we can use boot-repair which is a simple tool that can be used to repair frequent boot problems such as a missing Grub Bootloader. Here's how:
- Open a terminal
Ctrl+Alt+T
, type the following and then press Enter:sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update && sudo apt-get install boot-repair
Press
Enter
and thenY
to install. - Next, type the following and press
Enter
:boot-repair
When prompted, answer any questions regarding RAID etc and then wait for the tool to scan and detect boot partitions.
- Once the scan has finished, select Recommended Repair to allow boot-repair to do its thing and fix Grub bootloader by performing an automatic repair.
If all went well, Grub should now be restored, and you should be able to boot into both Linux and Windows.