DEV Community

Le Vuong
Le Vuong

Posted on • Edited on

Repair grub Linux/Windows dual boot

I accidentally removed the BIOS boot option for Linux, but fortunately, I found this very detailed guide on how to restore the GRUB bootloader for Linux.

I believe this will work in most cases, even after installing the Windows bootloader, which usually overwrites Linux boot settings.

Below are some notes after I did this (more details in the link above):

  1. Create an Ubuntu boot disk. The download (6G) is usually fast, but the slow part is writing to the boot USB (which took 20 minutes for me). See how to create a Rufus boot disk (on Windows) here.

  2. Find the Linux partition:

    sudo fdisk -l
    sudo blkid

  3. Check for EFI boot:

    sudo fdisk -l (look for a partition with the type 'EFI System').

  4. Mount your partition:

    sudo mount /dev/sdXY /mnt

    This is needed to chroot into your Linux mount later.

  5. Bind mount necessary directories:

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

  6. If you have EFI boot:

    sudo mount /dev/sdXY /mnt/boot/efi

  7. Chroot:

    sudo chroot /mnt

  8. Update GRUB:

    update-grub

    After this step, you may restart if it's fixed. Otherwise, continue to step 9.

  9. Reinstall GRUB if not fixed:

    grub-install /dev/sda
    update-grub
    (to detect and add Windows to the GRUB menu).

  10. Check if the EFI UUID is correct, and update it if needed:

    blkid | grep -i efi
    grep -i efi /etc/fstab

  11. Finish:

    exit
    sudo reboot

There are many steps, but the detailed instructions make them easy to follow. It's easy to Google any terms you don't understand, so don't worry.

I hope this helps fix your Linux system!

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.