Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers 3

up vote 8 down vote accepted

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.

share|improve this answer
    
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. –  Nysepho Jun 6 '13 at 19:49
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.