sodcalculator

10 Tech How-To

Restore GRUB Boot Menu After Windows Install

Guide 10-45325 · Updated · Step by step

If you installed Windows after Linux, or repaired Windows and lost the GRUB boot menu, this guide restores it so you can boot into Linux again. You will need a live Linux USB drive and a working internet connection on the computer you are fixing.

What You’ll Need

  • A live Linux USB drive (Ubuntu, Linux Mint, Fedora, or any distro that includes GRUB tools)
  • Access to the computer’s BIOS/UEFI settings (usually F2, F10, F12, or Del during startup)
  • An internet connection (optional but recommended for installing the GRUB package if missing)

Step-by-Step

  1. Boot from the live USB. Insert the USB drive, restart the computer, and press the boot menu key (often F12 or Esc) to select the USB drive. Choose “Try” or “Live Session” when prompted.
  2. Open a terminal. Once the live desktop loads, open a terminal window (Ctrl+Alt+T on most distros).
  3. Identify your Linux partition. Run sudo fdisk -l or lsblk to list all disks and partitions. Look for the partition with your Linux system — it is usually ext4 or btrfs and may have a label like “ubuntu” or “root”. Note the device name (e.g., /dev/sda5 or /dev/nvme0n1p2).
  4. Mount the Linux root partition. Create a mount point and mount the partition:
    sudo mkdir /mnt/linux
    sudo mount /dev/sdXY /mnt/linux
    Replace /dev/sdXY with your actual partition (e.g., /dev/sda5).
  5. Mount critical system directories. These are needed for GRUB to properly detect your system:
    sudo mount --bind /dev /mnt/linux/dev
    sudo mount --bind /proc /mnt/linux/proc
    sudo mount --bind /sys /mnt/linux/sys
    If you have a separate EFI partition (for UEFI systems), mount it too:
    sudo mount /dev/sdXY /mnt/linux/boot/efi
    (Find the EFI partition with lsblk -f — it is FAT32 and usually 100–500 MB.)
  6. Chroot into your Linux system. This makes the terminal behave as if you are inside your installed Linux:
    sudo chroot /mnt/linux
  7. Reinstall GRUB. For UEFI systems (most modern computers):
    grub-install
    For older BIOS/MBR systems, specify the disk (not partition):
    grub-install /dev/sda
    (Replace /dev/sda with your main disk — check lsblk to confirm.)
  8. Update GRUB configuration. This scans for Windows and other operating systems:
    update-grub
    On some distros, the command is grub-mkconfig -o /boot/grub/grub.cfg.
  9. Exit chroot and unmount. Type exit to leave the chroot, then unmount everything:
    sudo umount -R /mnt/linux
  10. Reboot. Remove the USB drive and restart. The GRUB menu should appear with both Linux and Windows entries.

Common Mistakes

  • Mounting the wrong partition. If you mount a data partition instead of the root, chroot will fail or GRUB will install to the wrong place. Always verify with lsblk -f to see filesystem types and sizes.
  • Forgetting to mount /boot/efi. On UEFI systems, if you skip this, grub-install may fail with an error about EFI variables or an invalid target.
  • Running grub-install without chroot. Installing GRUB from the live environment directly to your disk without chroot can work but often misses custom settings and drivers. Always chroot first.
  • Using the wrong device for BIOS systems. For BIOS/MBR, you must specify the whole disk (/dev/sda), not a partition (/dev/sda1). Using a partition will fail.
  • Not running update-grub. Installing GRUB without updating the config means Windows won’t appear in the menu, and you may only boot Linux.

Tips

  • Back up your data first. While this process is safe, any disk operation carries a small risk. Have a backup of important files.
  • Check if you are UEFI or BIOS. Run ls /sys/firmware/efi in the live environment. If the folder exists, you are UEFI; if not, you are BIOS. This determines which grub-install command to use.
  • If you have multiple Linux distros, the one you chroot into will own the boot menu. Choose the one you use most often.
  • Use the same distro version as installed. If possible, use a live USB of the same distro and version as your installed system. This avoids version mismatches in GRUB.
  • Set the boot order in BIOS. After restoring GRUB, ensure your disk (not Windows Boot Manager) is first in the boot order, otherwise the computer may still boot straight to Windows.

Troubleshooting

  • grub-install fails with “failed to get canonical path”. This usually means /boot/efi is not mounted. Mount it and try again.
  • grub-install fails with “EFI variables are not supported”. Boot the live USB in UEFI mode (disable CSM/Legacy in BIOS) and try again. If it still fails, run modprobe efivars before chrooting.
  • After reboot, you get a GRUB prompt (grub>). This means GRUB is installed but cannot find its config. Type exit, then reboot into the live USB and redo the steps, making sure update-grub ran without errors.
  • Windows does not appear in the GRUB menu. Run os-prober inside the chroot before update-grub. If it finds nothing, mount your Windows EFI partition (if separate) and run update-grub again.
  • The computer boots straight to Windows. Go into BIOS and change the boot order so your Linux disk (or “Ubuntu”) is first. If Windows Boot Manager still appears first, move it down.
  • GRUB menu appears but Linux fails to boot. This is often a separate issue (e.g., corrupted kernel). Boot from the live USB, chroot, and run update-initramfs -u or reinstall the kernel package.

Frequently Asked Questions

Will this erase my Windows installation? No. GRUB only replaces the bootloader; it does not touch Windows partitions or files. Windows will still be intact and bootable from the GRUB menu.

Can I do this without a live USB? No. You need a live environment to access your installed system because Windows has overwritten the bootloader and you cannot boot into Linux normally.

What if I have multiple Linux distros installed? Chroot into the one you want to control the boot menu. After running update-grub, it will detect and add the other Linux distros to the menu automatically.

How long does this take? The whole process takes about 10–15 minutes, mostly waiting for commands to finish. The actual commands take less than a minute each.

Do I need to reinstall Linux? No. Your Linux installation is still intact; only the bootloader was overwritten. This process restores it without touching your files or programs.

Why did Windows remove GRUB in the first place? Windows installers write their own bootloader to the disk and do not detect or preserve existing Linux bootloaders. This is a known behavior of Windows setup, not a deliberate deletion of your data.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →