9

I installed Ubuntu alongside Windows 8, however have decided to unisntall Ubuntu.

First I booted into Parted Magic and, using GParted deleted all the ext4 and swap partitions.

This leaves me with the same partitions I had before I installed Ubuntu:

/dev/sda1 ntfs WINRE_DRV
/dev/sda2 fat32 SYSTEM_DRV (my UEFI partition)
/dev/sda3 fat32 LRS_ESP
/dev/sda4 unknown Microsoft Reserved Partition
/dev/sda5 ntfs Windows8_OS
/dev/sda6 ntfs LENOVO
/dev/sda7 ntfs PBR_DRV

I expected deleting the partitions would be enough to remove Ubuntu and allow me to boot back into Windows 8, however whenever I boot I get the following error:

error: no such partition.

which is followed by GRUB rescue:

grub rescue>

In my UEFI partition, there are two directories BOOT and EFI. In BOOT is a single file - boot.sdi. In the EFI directory are another two directories, BOOT and Microsoft. Inside BOOT are two files, bkpbootx64.efi and bootx64.efi. The Microsoft directory has a directory in it named Boot. Inside it are the normal Microsoft EFI files (as far as I can tell).

Thinking there were still GRUB files left, I ran find . -iname "*grb*" and find . -iname "*grub*" in the UEFI partition, however only found one empty file, bootx64.efi.grb (which I deleted).

How is GRUB still installed, and how can I uninstall it?

I'm pretty new to UEFI and so things may need explained in detail. The computer is a Lenovo IdeaPad Z580.

edit: I forgot to mention, I deleted the ubuntu folder in the UEFI partition.

edit 2: I managed to get back into Windows through a "System Recovery" option in the laptop's BIOS settings. This may or may not have solved the issue.

edit 3: okay, I can boot almost normally now. When I boot, I see No partition active for a couple of seconds then Windows boots. How can I remove that?

5 Answers 5

29

I realize you've fixed the problem, but I want to point out what went wrong and how it should be fixed (both by end users and by Ubuntu's developers).

First, Ubuntu's developers have decided -- most unwisely -- to create a GRUB configuration that relies on files in the Ubuntu root (/) partition, as well as on the EFI System Partition (ESP). This makes GRUB vulnerable to removal of or damage to the Linux partition, and therefore makes it difficult to boot the computer after removing Ubuntu or if the Ubuntu installation is damaged in some way. This vulnerability is unnecessary; it is possible to configure GRUB to look for all its support and configuration files on the ESP. If GRUB were configured in this way (as Fedora does), then deleting Ubuntu would not affect GRUB's ability to redirect to Windows. The system would still boot through GRUB, but it would at least still boot. So, shame on Ubuntu for setting GRUB up the wrong way.

Second, based on the filenames you mentioned, you seem to have run Ubuntu's Boot Repair tool at some point. This tool automatically renames the Windows boot loader, EFI/Microsoft/Boot/bootmgfw.efi, and places a copy of GRUB in its place. It does the same thing with the EFI fallback boot loader, EFI/BOOT/bootx64.efi, and drops another copy of GRUB in as EFI/Microsoft/Boot/bootx64.efi, for reasons that I don't claim to fathom. This is a done as a workaround for a bug in a handful of EFIs. The trouble is that Boot Repair does this by default. On most computers, it is not necessary. When it's subsequently desirable to make changes to the boot configuration, this renaming and replication of GRUB becomes a complication, since users are left guessing about what's going on. So, shame on Boot Repair's developers for being unsubtle about their repairs. (In their defense, though, it would be very difficult for Boot Repair to reliably detect which computers have the bugs that require moving boot files in the way that it does by default.)

One more point is important: In a properly-functioning EFI system, a list of boot programs is held in NVRAM. The EFI tries each of the programs in this list in sequence; if one fails or is absent, the next one is tried. When Ubuntu installs, it adds its version of GRUB to the top of the list. Most EFIs also enable users to specify which boot program to use from a built-in boot manager, but this built-in boot manager is crude on most EFIs.

Sum all these factors up, and the simplest solution to the original problem becomes:

  1. Undo the Boot Repair tool's changes. This can be done using the Boot Repair tool itself; it has an Advanced Options menu with a check-box called "Restore EFI Backups". Use that and the multiple copies of GRUB will be removed and Windows' boot loader will be restored. Alternatively, this can be done manually. Most importantly, the backup of bootmgfw.efi (probably called bkpbootmgfw.efi, although some versions of Boot Repair have used other names) should be copied to EFI/Microsoft/Boot/bootmgfw.efi on the ESP.
  2. Delete GRUB in its official/proper location -- EFI/ubuntu/grubx64.efi for Ubuntu. If Secure Boot was active, deleting EFI/ubuntu/shimx64.efi would be necessary instead. In fact, deleting the whole EFI/ubuntu directory, or at least renaming it, would do the job in any case.

That's it. With those two things accomplished, the EFI will skip the Ubuntu boot option because it's not longer valid and go on to boot Windows. Some EFIs will also automatically remove the Ubuntu boot option from their boot managers' menus, too, although this practice is not universal.

Note that in your case, Matthew, I don't recommend doing these things; you've got a working configuration, and as they say, "if it ain't broke, don't fix it." You may have a few stray files left on your ESP, but they aren't doing any harm, so it's best to just leave it alone. I've presented my answer in the hope that somebody else will find it useful.


EDIT: The above was correct when I first wrote it, and the principles remain the same; however, Boot Repair no longer automatically renames the Windows boot loader and replaces it with another copy of GRUB. (Boot Repair can do this optionally, but the option is buried on an advanced options menu, so it's no longer done by default.) This fact makes recovery from this problem easier today than it was in 2013. In most cases, you need only delete the EFI/ubuntu directory on the ESP to make the system boot directly to Windows. If GRUB still appears after you do this, you may have used the Boot Repair option to back up and rename boot files, in which case using it to undo those actions is in order, as noted earlier.

Another option is to use the computer's built-in boot manager (usually accessed by hitting a function key, Esc, or Enter soon after you turn on the computer) to bypass GRUB and boot to Windows. You can then use EasyUEFI to adjust the boot order and/or delete the ubuntu entry from the boot list. This action won't delete GRUB from the ESP, but it will bypass GRUB.

2
  • Thanks for this answer! It explains the problem very well. I had indeed ran Boot Repair but forgot to include that in this question. I've marked this as the answer as this could definitely help someone in the future and is a much cleaner way of fixing the problem.
    – Torvero
    Jun 6, 2013 at 19:49
  • I'm late, but I'll ask anyways; you said it also replaces the default EFI bootloader with GRUB. Is there any way to recover it, assuming it's still replaced with the Ubuntu 18.04 installer? Aug 24, 2018 at 13:14
4

I know this thread is old, but I came across it in my own search when trying to solve this problem for myself, and I found a solution that worked for me when none of the other answers had so I needed to share!

I had dual-booted Ubuntu on my laptop alongside Windows 10. I decided to remove Ubuntu, and had deleted it's partition, but grub still kept interrupting my boot loader. After trying numerous suggestions left on forums, I finally just came across an insanely simple, and graphical way to remove it on my own lol. (So, disclaimer, I have no idea if any other versions of Windows has this option or not)

But all I did was F12 while the computer was booting to get into the boot options. And under Other Options I selected BIOS Setup. On the left-hand side I selected Boot Sequence and right there it listed my different boot options, and I could select them to change their order or remove them or whatever I wanted. All I had to do was make sure only "ubuntu" was marked, and then I clicked Delete Boot and exited. It continued to the log-in screen and I restarted my laptop just to double check it solved my problem and it had!

2
  • Seems like the internet is full of non-uefi solutions, but this just works! Oct 7, 2019 at 7:17
  • Worked on a ThinkPad X1, Elementary OS 6. Thanks. Aug 22, 2021 at 12:31
1

Okay, so this won't work for every computer I assume, but this is what fixed it for me.

First, I booted to "System Recovery" through the BIOS options on my laptop. This allowed me to get into Windows, however whenever I booted after that I got a message saying No partition active for a second before Windows booted. I got rid of this by doing the following:

  1. Booting into Windows
  2. SHIFT + Clicking "Restart"
  3. Troubleshooting
  4. Advanced
  5. Command prompt
  6. Running bootrec.exe /fixmbr

and rebooting. Now the message no longer appears and everything seems normal.

1

What I did is that after uninstalling Ubuntu -you can do that with some of the uninstallers, or by simply booting into Ubuntu live CD or USB stick and formatting Linux partitions with GParted- I formatted the EFI partition as well (FAT32) and then did Windows boot recovery from Windows installation disk.

I have to mention i read dozens of advice and tutorials and lost bunch of time with methods that don't work. In the end I did the only thing that seemed logical to me be4 reinstalling windows and it worked like a charm.

0
1

On a Surface Pro, it is possible to circumvent Grub 2 by selecting the "Re-install secure boot keys" option from the UEFI menu.

1
  • You may have to fiddle a bit with the options beyond this - I think I had to say something like "only allow Windows keys". I still get a message about invalid boot config, but it will continue to boot after.
    – bbarker
    Aug 12, 2016 at 3:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .