In this post I’ll explain in detail how to remove Linux boot-loader and switch back to Windows. There can be many reasons why you need this.
Let’s start with the basics. In earlier Windows operating systems up to Windows XP, boot loader was called NT Loader or NTLDR. In later versions, i.e. for Windows Vista, 7 and Windows 8/8.1, boot manager is called BOOTMGR and is a file
Windows/System32 directory. This small file loads your system.
Where as in most of the Linux distributions these days use GNU Grand Unified Boot-loader, commonly known as GRUB or GNU GRUB.
Now when you install any Linux distribution in dual-boot with Windows OS, the GRUB overtakes default Windows boot loader and at system boot lists the operating systems installed on the machine, including any Windows installation.
But if you have deleted your Linux distribution accidentally or removed Linux installation by deleting the partition allotted to the OS, the boot loader is not restored and while booting as error is displayed on the screen with
grub rescue prompt. Most likely:
error: no such partition. Entering rescue mode... grub rescue >_
So if you are on such black screen and Boot-Repair Guide on Ubuntu didn’t work and you are wondering what to do… stop panicking because there are solutions to everything.
First, you should try restoring Master Boot Record or MBR for your machine. This information identifies the location of OS on your hard disk to load it into main memory or RAM.
While booting your machine, boot into Ubuntu or Fedora Live USB/DVD or any other Linux OS and run following commands from terminal. Note that commands may change according to your distribution. Hit enter after every command.
sudo apt-get install mbr sudo install-mbr -i n -p D -t 0 /dev/sda
First command installs MBR and the second command writes it on your hard disk. In
sda is the for your hard disk. This will resolve and restore the master boot records.
Now when you boot into your system, you may come across text MBR followed by an error:
The application or operating system could not be loaded because a required file is missing or contain errors. File: WindowsSystem32winload.exe Error Code: 0xc000XXXX You'll need to use the recovery tools on your installation media. If you don't have any installation media (like a disc or USB device), contact your system administrator or PC manufacturer.
You’ll need an installation disc of the Windows OS for this. Insert the installation disc and boot from it. Now we’ll rebuild BCD booting from the disc.
- In Windows setup screen, click on Repair your computer.
- Click on Troubleshoot and select Advanced Options.
- Click on Command Prompt and enter following commands. Hit enter after each.
Bootrec /fixmbr Bootrec /fixboot Bootrec /rebuildbcd
Restart the computer and you’ll boot into Windows.