If you deleted Ubuntu and are now stuck at a GRUB rescue prompt or a black screen, the fix is to restore the bootloader that your remaining operating system uses. You can do this by booting from a live USB and reinstalling GRUB for that OS, or by using the built-in startup repair of your OS installer.
Why Deleting Ubuntu Breaks GRUB
GRUB (GRand Unified Bootloader) is the program that starts when your computer powers on. It shows a menu of installed operating systems and then loads the one you choose. When you install Ubuntu alongside Windows, the Ubuntu installer usually writes GRUB to the master boot record (MBR) of your hard drive or to the EFI system partition (ESP) on UEFI systems. That means GRUB becomes the first thing your firmware runs, even if you later boot Windows.
When you delete the Ubuntu partitions, GRUB’s configuration files and its core modules are often deleted too. The bootloader still exists on the disk, but it cannot find its configuration or the files it needs to load. That is why you see errors like error: no such partition, unknown filesystem, or the grub rescue> prompt. The computer is still trying to run GRUB, but GRUB has nothing to work with.
How the Boot Process Works on UEFI vs Legacy BIOS
The exact fix depends on whether your computer uses UEFI (the modern firmware standard) or the older legacy BIOS. Most computers sold in the last decade use UEFI with a feature called Secure Boot.
- UEFI: The motherboard looks for a file named
bootx64.efiin the EFI system partition. Ubuntu’s GRUB is stored there asgrubx64.efi. When you delete Ubuntu, that file may be gone, so the firmware falls back to the Windows Boot Manager entry, or it shows an error. - Legacy BIOS: The firmware reads the first sector of the hard drive (the MBR) and executes the code there. GRUB’s first-stage bootloader lives in the MBR. If it is still there but the rest of GRUB is gone, you get the rescue prompt.
Knowing which mode you are in matters because the repair commands differ. You can check by entering your BIOS/UEFI setup (usually by pressing F2, F10, F12, or Del during startup) and looking for a “Boot Mode” or “UEFI/Legacy” setting.
Method 1: Repair GRUB from a Live Ubuntu USB
This is the most reliable way to fix GRUB when you still have Ubuntu installed, or when you want to keep GRUB as your boot manager. You will need a USB drive with Ubuntu (or any Linux live environment) and about 15 minutes.
- Create a bootable Ubuntu USB using another computer. The official Ubuntu website provides a tool for this.
- Boot from the USB. Choose “Try Ubuntu” instead of “Install Ubuntu”.
- Open a terminal (Ctrl+Alt+T).
- Find the name of your main hard drive with
lsblkorsudo fdisk -l. It will look like/dev/sda(whole disk) or/dev/nvme0n1for NVMe drives. - Mount the root partition of your installed Ubuntu. For example, if your Ubuntu root is
/dev/sda2, run:sudo mount /dev/sda2 /mnt
- If you have a separate boot partition, mount it to
/mnt/boot. If you have an EFI partition, mount it to/mnt/boot/efi. - Reinstall GRUB with these commands:
sudo grub-install --root-directory=/mnt /dev/sda sudo update-grub
For UEFI systems, use:
sudo grub-install --target=x86_64-efi --efi-directory=/mnt/boot/efi --bootloader-id=ubuntu
- Reboot and remove the USB. GRUB should appear with all your operating systems.
If you deleted Ubuntu entirely and want to go back to the Windows bootloader, skip the GRUB reinstall and use the Windows recovery method below.
Method 2: Restore the Windows Bootloader
If you no longer want Linux, the cleanest fix is to make Windows write its own bootloader back to the disk. This removes GRUB completely.
- Create a Windows installation USB (from Microsoft’s official tool) or use a Windows recovery drive.
- Boot from the USB and choose “Repair your computer” on the first screen.
- Go to Troubleshoot → Advanced Options → Command Prompt.
- Run these commands one by one:
bootrec /fixmbr bootrec /fixboot bootrec /scanos bootrec /rebuildbcd
- For UEFI systems, also run:
bcdboot C:\Windows /s S: /f UEFI
(Replace
C:with your Windows drive letter andS:with the EFI partition letter, which you can find withdiskpart.) - Exit and restart. Windows should boot directly.
If the commands fail with “The system cannot find the path specified”, your EFI partition may be missing or corrupt. In that case, use diskpart to create a new EFI partition, then run bcdboot again.
What to Do When You See the GRUB Rescue Prompt
If you are stuck at grub rescue>, you can sometimes boot your system manually without a USB. This is a temporary fix that gets you into your OS so you can run the proper repair.
- Type
lsto list all partitions. You will see something like(hd0,msdos1)or(hd0,gpt2). - Find the partition that contains your Linux kernel. Try each one with
ls (hd0,1)/until you see abootfolder orvmlinuzfiles. - Set the root and prefix:
set root=(hd0,1) set prefix=(hd0,1)/boot/grub
- Load the normal module:
insmod normal normal
- If that works, the GRUB menu appears. Boot your OS and then run
sudo update-grubandsudo grub-installfrom the terminal.
This manual method is tricky because partition numbers vary. If it does not work, go with the live USB method.
Common Mistakes and How to Avoid Them
- Mounting the wrong partition: Always verify with
lsblkthat you mounted the correct root partition. Mounting the wrong one can write GRUB to the wrong place. - Forgetting the EFI partition: On UEFI systems, you must mount the EFI partition to
/mnt/boot/efibefore runninggrub-install. Skipping this causes a “failed to get canonical path” error. - Using the wrong device name:
grub-installshould target the whole disk (/dev/sda), not a partition (/dev/sda1). - Secure Boot interference: If you have Secure Boot enabled, the reinstall may fail unless you use the signed
shimpackage. In that case, temporarily disable Secure Boot in BIOS, reinstall GRUB, then re-enable it. - Not updating GRUB after reinstalling: Running
update-grubis essential to detect all operating systems and write the correct configuration.
Alternatives and Prevention
If you want to avoid this problem in the future, consider these options:
- Keep a separate
/bootpartition that is large enough to hold GRUB modules and kernels. Even if you delete the root partition, GRUB can often still boot. - Use a boot manager like rEFInd, which scans for bootable systems at each start and does not rely on a single configuration file.
- Always keep a live USB of your main OS around. It is the universal rescue tool.
- Before deleting any Linux partitions, run
sudo grub-installandsudo update-grubone last time, or use Windows’bootrecto restore its bootloader first.
If you are not comfortable with command-line tools, you can use a graphical tool like Boot-Repair (from a live Ubuntu USB). It automates the reinstall and often fixes the issue in one click. However, it is not always available and may require adding a PPA, so the manual methods above are more universal.
Frequently Asked Questions
Will I lose my Windows files if I repair GRUB?
No. Repairing GRUB only rewrites the bootloader code on the disk. Your Windows partition and all its files remain untouched. The same applies to restoring the Windows bootloader – it does not affect your personal data.
Why did GRUB appear even though I deleted Ubuntu?
Because GRUB was installed to the master boot record or EFI partition. Deleting the Ubuntu partitions does not automatically remove the bootloader code. The firmware still tries to run it, and without its configuration files, it fails.
Can I fix GRUB from Windows without a USB?
Yes, if you can still boot into Windows. Open an elevated Command Prompt and run bcdboot C:\Windows to recreate the Windows boot entry. This will bypass GRUB. If you cannot boot into Windows, you need a recovery USB.
What is the difference between fixing MBR and EFI boot?
MBR (legacy BIOS) stores boot code in the first sector of the disk. EFI boot uses a separate partition with bootable files. The repair commands differ: grub-install targets the disk for MBR, but for EFI you specify the EFI directory and target. Windows uses bootrec for MBR and bcdboot for EFI.
How do I know if my system uses UEFI or BIOS?
In Windows, open System Information (msinfo32) and look at “BIOS Mode”. If it says UEFI, you have UEFI. If it says Legacy, you have BIOS. In Linux, run ls /sys/firmware/efi – if the directory exists, you are in UEFI mode.
Is it safe to delete the EFI partition after removing Ubuntu?
No. The EFI system partition is shared by all operating systems on the disk. Windows also uses it for its boot files. Deleting it will make Windows unbootable. Leave it alone unless you are wiping the entire disk.
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
- Android Camera for 7 Office Tasks: Step-by-Step
- Pair Phone to Pioneer Stereo After Bluetooth Reset
- Fix Windows Not Saving Remote Desktop Credentials
- Fix Error 0x8007025d in Windows 10
- Fix Alexa App Stuck on Setup
- Essential Tips for macOS Users Switching to Windows