Saturday, September 12, 2026

How to Repair GRUB After Installing Windows


Installing Windows alongside Linux in a dual-boot configuration is a practical way to use both operating systems on the same computer. However, one common problem can occur after installing or reinstalling Windows: the computer may no longer show the GRUB boot menu and may boot directly into Windows.
This happens because the Windows installation process can modify the boot configuration, especially on systems using UEFI. In many cases, the Linux installation and its files are still completely intact. The problem is simply that the bootloader used to start Linux has been replaced, disabled, or removed from the system's boot path.
Fortunately, you usually do not need to reinstall Linux. GRUB can often be repaired using a Linux Live USB and a few terminal commands.
This guide explains how to repair GRUB after installing Windows, including how to identify the Linux partitions, mount the existing installation, enter a chroot environment, reinstall GRUB, rebuild the boot configuration, and restore the Linux option to the UEFI boot menu.

Why Does Windows Break GRUB?

Before repairing GRUB, it is useful to understand why the problem occurs.
When Linux is installed alongside Windows, GRUB is commonly configured as the primary bootloader. GRUB detects Windows and Linux and provides a menu that allows you to choose which operating system to start.
For example :
  • Linux
  • Windows Boot Manager
  • Advanced Linux options
  • Recovery mode
When Windows is installed afterward, its installer may configure Windows Boot Manager as the preferred boot entry. Depending on the installation method and firmware configuration, the existing GRUB EFI files may also become inaccessible from the default boot path.
As a result, you may experience symptoms such as :
  • The computer boots directly into Windows.
  • The GRUB menu no longer appears.
  • Linux is missing from the boot menu.
  • The system displays "Windows Boot Manager" only.
  • A GRUB error appears during startup.
  • The computer reports that no bootable device is available.
  • The Linux partition is still visible from Windows, but Linux cannot start.
In most cases, the Linux installation itself has not been deleted.

Before Repairing GRUB

There are several important things to check before modifying the bootloader.
  1. Confirm That Linux Still Exists

    Boot into Windows and open Disk Management. Look for partitions that do not have a normal Windows drive letter.
    Linux partitions may appear differently from NTFS partitions. Depending on the Linux distribution and storage configuration, you may see partitions without a Windows-readable filesystem.
    Do not format or delete these partitions.
  2. Check Whether the System Uses UEFI or Legacy BIOS

    Modern computers generally use UEFI. Older computers may use Legacy BIOS or CSM.
    The repair procedure is different depending on the boot mode.
    If Windows was installed in UEFI mode, the Linux repair environment should also be booted in UEFI mode.
    Mixing UEFI and Legacy modes can prevent GRUB from being installed correctly.
  3. Prepare a Linux Live USB

    You need a bootable Linux USB containing a distribution such as Ubuntu, Debian, Linux Mint, or another compatible Linux distribution.
    Boot from the USB and select the option similar to :
    Try Linux without installing
    Do not start a new Linux installation.
    The Live environment allows you to access your existing Linux installation and repair its bootloader.

How to Repair GRUB Step by Step

Step 1: Open the Terminal

Once you have booted into the Linux Live environment, open Terminal.
Most Linux distributions provide a terminal application from the application menu.
You will use several commands to identify your Linux installation and repair GRUB.
Be careful when entering commands because selecting the wrong disk or partition can cause data loss.

Step 2: Identify Your Linux Partitions

The first step is determining which partition contains your Linux installation.
Run : sudo lsblk -f
You may see output similar to :

NAME

FSTYPE

FSVER

LABEL

SIZE

MOUNTPOINTS

sda

 

 

931G

 

 

├─sda1

vfat

 

EFI

512M

 

├─sda2

ntfs

 

 

150G

 

├─sda3

ext4

 

 

200G

 

└─sda4

swap

 

 

8G

 


On another system, the disk may appear as nvme0n1 instead of sda :

nvme0n1

 

├─nvme0n1p1

vfat

├─nvme0n1p2

ntfs

└─nvme0n1p3

ext4


Look for the Linux root partition, which is commonly formatted as ext4.
You should also identify the EFI System Partition (ESP), which is normally formatted as FAT32 or vfat and is usually several hundred megabytes in size.
For example :
  • /dev/nvme0n1p3 = Linux root partition
  • /dev/nvme0n1p1 = EFI System Partition
The actual partition numbers on your computer may be different.

Step 3: Mount the Linux Root Partition

Suppose your Linux root partition is :
Text/Code
/dev/nvme0n1p3
Mount it using :
Text/Code
sudo mount /dev/nvme0n1p3 /mnt
If your Linux installation uses a different partition, replace the device name with the correct one.
You can verify the contents :
Text/Code
ls /mnt
A normal Linux root filesystem should contain directories such as :
bin
boot
dev
etc
home
lib
usr
var

If these directories are present, you have probably mounted the correct Linux root partition.

Step 4: Mount the EFI System Partition

If your system uses UEFI, you also need to mount the EFI System Partition.
For example, if the EFI partition is :
Text/Code
/dev/nvme0n1p1
Create the required directory if necessary :
Text/Code
sudo mkdir -p /mnt/boot/efi
Then mount the EFI partition :
Text/Code
sudo mount /dev/nvme0n1p1 /mnt/boot/efi
Verify it :
Text/Code
ls /mnt/boot/efi
You may see an EFI directory.
Inside it, there may be directories belonging to Windows, Linux, or other bootloaders.

Step 5: Mount the Required Virtual Filesystems

Before entering the installed Linux system using chroot, mount the virtual filesystems.
Run :
Text/Code
sudo mount --bind /dev /mnt/dev
sudo mount --bind /dev/pts /mnt/dev/pts
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
A simpler alternative on many modern distributions is :
Text/Code
sudo mount --bind /dev /mnt/dev
sudo mount --bind /dev/pts /mnt/dev/pts
sudo mount -t proc /proc /mnt/proc
sudo mount -t sysfs /sys /mnt/sys
These mounts allow the installed Linux system to communicate correctly with the hardware and kernel interfaces while you repair GRUB.

Step 6: Enter the Existing Linux Installation

Now use chroot :
Text/Code
sudo chroot /mnt
You are now operating inside your installed Linux environment rather than the temporary Live USB environment.
You can confirm this by checking : ls /
You should see the directories belonging to your installed Linux system.
At this stage, commands such as grub-install and update-grub will operate on the existing installation.

Step 7: Check the Network Connection

If your Live environment has an active Internet connection, you may want to make sure DNS resolution works inside the chroot environment.
You can test :
Text/Code
ping -c 3 google.com
If it works, you can continue.
If networking does not work inside chroot, it may not be necessary for every GRUB repair. However, having network access can be useful if packages need to be reinstalled.

Step 8: Reinstall GRUB

For a UEFI-based Linux installation, reinstall GRUB using :
Text/Code
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
If the command completes successfully, you should see a message indicating that no errors were reported.
The --efi-directory=/boot/efi option tells GRUB where the EFI System Partition is mounted.
The --bootloader-id=GRUB option determines the name of the EFI bootloader directory and firmware entry.
Do not blindly use this command on a Legacy BIOS system because the GRUB installation procedure is different.

Step 9: Rebuild the GRUB Configuration

After reinstalling GRUB, rebuild its configuration :
Text/Code
update-grub
The command should scan the installed operating systems.
You may see output similar to :
Found linux image: /boot/vmlinuz-...
Found initrd image: /boot/initrd.img-...
Found Windows Boot Manager on /dev/...
done

The important part is that your Linux kernel is detected and, on many configurations, Windows Boot Manager is also detected.
If Windows is detected, GRUB should be able to display Windows as an option in the boot menu.

Step 10: Check the UEFI Boot Entries

You can check the current UEFI boot entries using :
Text/Code
efibootmgr -v
You may see entries similar to :
Boot0000* Windows Boot Manager
Boot0001* ubuntu
Boot0002* GRUB

The exact names depend on your Linux distribution and how GRUB was installed.
If a GRUB or Linux entry exists, you may need to make it the first boot option.
For example :
Text/Code
efibootmgr -o 0002,0000
Replace the numbers with the correct boot entry IDs shown on your computer.
Do not copy the numbers from this example.
Use the values reported by your own efibootmgr -v command.

Step 11: Exit the chroot Environment

Once the repair is complete, leave the installed Linux environment : exit
You are now back in the Live USB environment.
Next, unmount the filesystems.
A convenient command is :
Text/Code
sudo umount -R /mnt
If the command reports that something is busy, close applications that may be accessing /mnt and try again.
You can also unmount the individual filesystems manually if necessary.

Step 12: Restart the Computer

Remove the Linux Live USB and restart the computer :
Text/Code
sudo reboot
If the GRUB repair was successful, the GRUB menu should appear.
You should normally see options for Linux and Windows.
Select Linux to verify that your original installation still works.
Then restart again and select Windows to confirm that the Windows installation also works.

What If GRUB Still Does Not Appear?

If the computer still boots directly into Windows, the problem may be related to the UEFI boot order rather than GRUB itself.
Enter your computer's UEFI/BIOS setup.
The key used to enter firmware settings varies between manufacturers. Common keys include :
  • F2
  • F10
  • F12
  • Delete
  • Esc
Look for a menu called Boot, Boot Order, or UEFI Boot Options.
If a Linux or GRUB entry exists, move it above Windows Boot Manager.
Save the changes and restart.
On some systems, you can also temporarily select the Linux bootloader from the one-time boot menu.

What If grub-install Reports an EFI Error?

One common problem is an error indicating that EFI variables are not accessible.
For example :
EFI variables are not supported on this system.
This often means that the Live USB was booted in Legacy mode instead of UEFI mode.
Restart the computer and select the UEFI version of the Linux USB from the boot menu.
You may see two USB options, such as :
USB Storage Device
UEFI: USB Storage Device

Choose the option beginning with UEFI.
Then repeat the repair process.

What If Windows Is Not Detected?

If update-grub does not detect Windows, first check that the Windows partition still exists.
You can run :
Text/Code
lsblk -f
and :
Text/Code
sudo fdisk -l
On systems using UEFI, Windows normally has an EFI bootloader stored on the EFI System Partition.
You can also check :
Text/Code
ls /boot/efi/EFI
You may see directories such as :
Microsoft
Boot
ubuntu

The exact directory names vary.
If the Microsoft EFI files are still present, Windows may simply need to be added correctly to the GRUB configuration.
On some Linux distributions, the os-prober package may be required to detect other operating systems.
For Debian-based distributions, you can install it with :
Text/Code
apt install os-prober
Then enable OS detection if required by your distribution's configuration.
Afterward, run :
Text/Code
update-grub

Repairing GRUB on Legacy BIOS Systems

If your computer uses Legacy BIOS instead of UEFI, the procedure is different.
For example, if the main disk is /dev/sda, you may reinstall GRUB to the disk with :
Text/Code
grub-install /dev/sda
Then rebuild the configuration :
Text/Code
update-grub
The important distinction is that Legacy BIOS GRUB is installed to the boot sector or appropriate BIOS boot area, while UEFI systems use an EFI System Partition.
Therefore, always determine the boot mode before choosing the GRUB installation command.

Avoid Reinstalling Linux Too Quickly

One of the biggest mistakes after Windows overwrites or changes the bootloader is immediately reinstalling Linux.
If your Linux partitions are still present, a complete Linux reinstallation may be unnecessary.
Reinstalling Linux can :
  • Delete existing applications.
  • Reset system configuration.
  • Remove personal settings.
  • Potentially overwrite existing data.
  • Require you to reinstall software.
  • Create unnecessary partition changes.
In many dual-boot situations, repairing GRUB is significantly safer than reinstalling the operating system.

How to Prevent GRUB Problems in the Future

Although Windows updates or installations can sometimes change boot settings, several precautions can make recovery easier.

Keep a Linux Live USB

Always keep a bootable Linux USB available.
It can be used to :
  • Repair GRUB.
  • Access files.
  • Troubleshoot boot problems.
  • Recover important data.
  • Inspect disk partitions.

Back Up Important Files

A bootloader repair normally does not affect personal files, but you should still maintain regular backups.
Keep important documents, photos, projects, and other data on another storage device or a reliable backup service.

Use the Same Boot Mode

If your existing operating systems use UEFI, continue using UEFI when installing or repairing them.
Avoid mixing Legacy BIOS and UEFI unless you have a specific reason and understand the consequences.

Be Careful During Windows Installation

When installing Windows on a computer that already contains Linux, carefully check the target disk and partitions.
Do not delete Linux partitions accidentally.
If Windows is installed to the same disk, it may share the existing EFI System Partition.

Final Thoughts

Repairing GRUB after installing Windows is usually possible without reinstalling Linux. The most important thing is to determine whether your computer uses UEFI or Legacy BIOS, identify the correct Linux root partition, mount the EFI System Partition when necessary, and reinstall GRUB using the appropriate method.
For modern UEFI systems, the general process is :
  1. Boot a Linux Live USB.
  2. Identify the Linux root partition.
  3. Mount the Linux filesystem.
  4. Mount the EFI System Partition.
  5. Bind the required virtual filesystems.
  6. Enter the installed system with chroot.
  7. Reinstall GRUB.
  8. Run update-grub.
  9. Check the UEFI boot order.
  10. Unmount the partitions and restart.
The key point is that Windows taking control of the boot process does not necessarily mean that Linux has been deleted. In many cases, the Linux installation and personal data remain untouched, while only the bootloader configuration needs to be restored.
By understanding how GRUB, UEFI, and Windows Boot Manager interact, you can troubleshoot dual-boot problems more confidently and avoid unnecessary operating system reinstallation.

Related Posts :

Frequently Asked Questions (FAQ)

Why does GRUB disappear after installing Windows?

GRUB may disappear because the Windows installation changes the boot configuration or makes Windows Boot Manager the default bootloader. The Linux installation is usually still intact, but the computer may no longer start through GRUB.

Can I repair GRUB without reinstalling Linux?

Yes. In most cases, you can repair GRUB without reinstalling Linux. A Linux Live USB can be used to mount the existing Linux installation, enter it with chroot, reinstall GRUB, and rebuild the boot configuration.

How do I repair GRUB after installing Windows in UEFI mode?

Boot a Linux Live USB in UEFI mode, identify the Linux root partition and EFI System Partition, mount them, enter the installed system using chroot, and run the appropriate grub-install command followed by update-grub.

What command reinstalls GRUB on a UEFI system?

For a typical 64-bit UEFI Linux installation, the command is:
Text/Code
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
Afterward, run :
Text/Code
update-grub
The exact command may vary depending on the Linux distribution and system configuration.

How do I know which partition contains my Linux installation?

You can use the following command from a Linux Live environment :
Text/Code
sudo lsblk -f
Look for a Linux filesystem such as ext4. You should also identify the EFI System Partition, which is usually formatted as vfat or FAT32.

Why does my computer boot directly into Windows instead of GRUB?

The UEFI firmware may have Windows Boot Manager configured as the first boot option. If GRUB is still installed, you can often fix the problem by changing the UEFI boot order so that the Linux or GRUB entry is placed before Windows Boot Manager.

What should I do if grub-install says EFI variables are not supported?

This commonly happens when the Linux Live USB was booted in Legacy BIOS mode while the installed operating system uses UEFI. Restart the computer and boot the Live USB using its UEFI option, then repeat the GRUB repair process.

How can I make Windows appear in the GRUB boot menu?

After repairing GRUB, run :
Text/Code
update-grub
GRUB will normally search for other operating systems. If Windows is not detected, you may need to install and configure os-prober, depending on your Linux distribution.

Will repairing GRUB delete my Windows or Linux files?

Normally, repairing GRUB does not delete your personal files or operating systems. However, commands involving partitions and bootloaders must be entered carefully because selecting the wrong partition or disk can cause data loss.

Is it better to repair GRUB or reinstall Linux after installing Windows?

Repairing GRUB is generally preferable if the existing Linux installation and partitions are still intact. Reinstalling Linux is usually unnecessary because the problem is often limited to the bootloader or boot configuration.
Show comments
Hide comments
No comments:
Write komentar

Dapatkan Update Artikel Terbaru Via Email