
When using a system with dual boot between Windows and Linux, it is common to encounter problems in the boot loader after installing or removing one of the systems. The classic error message when starting your PC can leave you with a heavy heart: Windows won't boot, or the system is stuck in GRUB with no trace of Windows. Don't panic, because Restore the Windows Bootloader after installing or removing Linux It is within everyone's reach if you follow the right steps.
In this guide you will find All solutions to recover Windows boot loader After an adventure with Linux on your computer. From specific commands in the terminal to graphical utilities, we'll cover each method so you can boot your computer normally and, if necessary, maintain the ability to boot both systems.
Why does Windows boot disappear after installing or removing Linux?
The boot manager is an essential part of the system: it allows you to select which operating system to start each time you turn on your PC. If you have used dual boot with Linux and WindowsYou've probably seen the Linux GRUB menu. When Linux is installed, it usually writes GRUB to the boot sector of the disk, replacing the Windows boot loader. When you erase Linux, if you simply delete the partition, the GRUB in the boot sector no longer finds its files, and the system is completely damaged. strung up, throwing errors like “the operating system was not found” or a simple blinking cursor on the screen.
How to know if the problem is in the Bootloader
A very clear symptom is that, after uninstall Linux on a Windows computer, the computer does not boot and displays messages such as “grub rescue”, “no such partition” or simply goes black after turning it on. It's not a physical disk failure or that you've lost your files.; the correct loader is simply missing from the boot sector.
Initial checks before restoring boot
- Check the boot order in the BIOS/UEFIMake sure the drive where Windows is installed is the first one listed. This can save you hours of unnecessary work.
- Check if you have Windows recovery partitionsIf you have them, leave them alone: they can save your system or make future recoveries easier.
- Back up your important data before manipulating partitions or the boot sector. Better safe than sorry.
Recovering the Windows Bootloader after Installing or Deleting Linux
There are several methods for restoring Windows startup, both automatic and manual. I'll explain all the available methods so you can choose the one that best suits your situation.
1. Automatic repair using Windows tools
Windows includes a utility to automatically repair the boot:
- Create a Bootable Windows installation USB from another computer if you don't have one. You can learn how to do this at How to create a bootable USB with Windows 10.
- Connect this USB to the problematic PC and boot from it (you may need to choose to boot from the BIOS boot menu with F12, Esc, F2, Del, etc.).
- On the first screen select the language and press Next.
- Choose Repair equipment (bottom left, DO NOT select Install).
- Accede to Solve problems > Advanced > Startup repair. You can also check out other ways to fix errors at How to troubleshoot Windows boot errors.
- Select the Windows installation you want to repair and let the tool do the work.
This method usually works in most simple cases.If you're still having problems after a reboot, try the advanced methods below.
2. Restore Windows Bootloader from the command line
If the automatic mode does not solve it, it is time to intervene manually using the Command line. To do this, boot from the Windows installation USB and enter Symbol of the system From the Advanced. Here you can also find out how Repair Windows boot with Bootrec.
Once inside:
- Write and execute:
bootrec /fixmbrbootrec /fixbootbootrec /scanosbootrec /rebuildbcd
- Restart your computer to see if Windows boots up normally.
With these commands, The MBR (Master Boot Record) and Windows boot data are rewritten. Note: If you have a UEFI system with an EFI partition, it's a good idea to use the /fixboot option and make sure Windows is installed in UEFI mode.
3. Repair the boot sector (MBR or EFI partition) with Bootsect
In some cases, after using bootrec, it is necessary manually restore the boot sector with the command bootsect. From the same command prompt, run:
bootsect /nt60 C: /mbr
Change the letter C: to the drive where Windows is installedThis will leave the partition's boot sector clean, using the Windows boot format.
4. Fix Partition Errors with Diskpart
If the system still won't boot, the system partition may be disabled. From the command prompt:
diskpart
list disk
select disk 0 # Sustituye 0 por tu disco principal
list partition
select partition 1 # La que corresponda a Windows
active
exit
Then run bootrec /fixboot again and reboot. This re-enables the primary partition for booting.
5. Check system integrity with SFC and CHKDSK
On computers that experience additional crashes or errors, it may be helpful to repair corrupt files:
sfc /scannow
chkdsk C: /f /r
This searches for and repairs errors in files and on the disk, which can interfere with the boot process.
6. Reinstall the bootloader with BCDboot
If nothing above has worked, try reinstall the bootloader via bcdboot. From the command line:
bcdboot C:\Windows /s C: /f ALL
Replace the letters with the ones corresponding to your Windows installation. This will recreate the boot structure from scratch.
7. Use third-party programs to restore the boot
There are applications optimized for repair the bootloader without messing with commands:
- EasyBCD: Graphical interface for modifying and restoring Windows boot and managing dual-boot systems.
- Rescatux or LiveCDs: Distributions that can restore the MBR, EFI partition, or even recover GRUB from a Live environment.
- FixBootFull: Utility included in some LiveCDs to fix damaged boot sectors.
These programs can be run by booting your computer from a bootable Live CD or USB drive. Simply burn the ISO image to a CD, DVD, or USB drive, boot from that media, and follow the program's instructions.
8. Recover GRUB after reinstalling Windows
The reverse is just as common: you install or reinstall Windows after having Linux, and the latter disappears from the boot menu. The system boots directly to Windows, ignoring your Linux. What happens here is that Windows rewrites its own boot loader and removes GRUB.
To restore GRUB and be able to choose Linux or Windows at boot:
- Boot the PC with a Ubuntu Live CD or USB or your Linux distro.
- Enter a terminal like root or using sudo.
- Mount the root partition of your Linux installation:
mount /dev/sda1 /mnt(Replace /dev/sda1 with the correct partition) - Install GRUB on the main disk:
grub-install --root-directory=/mnt /dev/sda - Restart your computer. The boot menu should appear again with both systems!
If you want to add password protection to GRUB, you can generate a key using:
grub
md5crypt
Paste the generated line into /boot/grub/menu.lst adding:
password --md5 <tu_hash_md5>
9. Specific solutions to preserve both systems
If after restoring the Windows bootloader you lose access to Linux (or vice versa), there is a technique to Add the Linux entry to the Windows bootloader, keeping both without overwriting the boot sector:
- From Linux, save the boot sector of the Linux partition with:
dd if=/dev/sda3 of=/linux.boot bs=512 count=1(Set sda3 to your Linux disk/partition)
- Copy that file linux.boot to the Windows partition.
- Boot from the Windows USB and open the command line.
- Run the commands to repair the Windows MBR and Bootloader:
bootrec.exe /FixMbrbootrec.exe /FixBoot - Once in Windows, open an administrator console (cmd) and create a new entry in the Linux bootloader:
bcdedit /create /d 'Linux' /application BOOTSECTORCopy the resulting identifier ({ID}).
- Associate the Linux partition and bootloader file:
bcdedit /set {ID} device partition=c:(Adjust the unit if necessary)bcdedit /set {ID} path \linux.boot - Add the entry to the boot menu and set the timeout:
bcdedit /displayorder {ID} /addlastbcdedit /timeout 10
Done! You'll now have the option to boot both Windows and Linux without overwriting bootloaders.
Final tips and common warnings
- Avoid deleting partitions called Windows Recovery Environment, Microsoft System Recovery o EFI System Partition; are vital to recover the system and boot into UEFI.
- Linux LVM and BIOS Boot Partition They should only be handled if you know what you're doing. If you have any questions, seek help or consult further documentation.
- Always do backup before touching partitions or the boot sector. Data loss is very rare, but it can happen if steps are taken incorrectly.
- If Windows still won't boot, try a system restore from the installation media before completely reinstalling the operating system. You can also consult How to customize the boot menu in Windows to better manage options.
Restoring Windows boot after experimenting with Linux may seem complicated, but following these steps will have you covered: from restoring Windows only, to recovering dual boot, or even protecting access to GRUB. Remember to always use commands carefully, and if in doubt, consult specialized forums or ask the community for help. This way, your PC will be working again, and you can continue enjoying both systems in harmony, without any issues when you turn it on.
