0

I deleted the partition which Linux was installed on. So after I boot I get to grub rescue.

I have searched the Web for anything nothing seems to work. I have tried to set boot and prefix but it just gives me an error. I can't live boot cause I'm on vacation so I don't have an USB or CD. Is there any options I haven't tried?

Info:

GRUB 2.0
PC: Lenovo Think pad
OS: Windows 10

Also I'm willing to factory reset if you can do that.

Gansheim
  • 871
  • Short of you obtaining an USB or CD with a bootable Ubuntu image on it and reloading it to your laptop not much you can do. – Gansheim Apr 13 '17 at 14:49
  • You need Windows media if your goal is to boot Windows and Ubuntu media if your goal is to reinstall. This assumes both OSes were installed in legacy. Otherwise, in UEFI mode, you can simply make the Windows boot manager entry the first boot priority. That said, recovery, fixing or reinstalling Windows is obviously off-topic here. –  Apr 13 '17 at 14:50
  • 2
    If originally Windows 10 and UEFI, you should just be able to directly boot Windows from UEFI boot menu, often f10 or f12, check manual. see also: http://askubuntu.com/questions/63610/how-do-i-remove-ubuntu-in-the-bios-boot-menu-uefi – oldfred Apr 13 '17 at 16:10

1 Answers1

2

The problem is caused by the fact that GRUB relies on a configuration file that's stored in the Ubuntu root (/) or /boot partition, /boot/grub/grub.cfg. There are also GRUB modules (drivers) in the same location. When you deleted your Ubuntu partition, those files were rendered inaccessible.

Methods of recovering from this problem depend on whether the computer boots in EFI/UEFI mode or in BIOS/CSM/legacy mode.

EFI-Mode Booting

In this case, the solution is usually easy: You can use the computer's built-in boot manager to boot Windows directly. The tricky part is accessing the built-in boot manager, since how you do this varies from one computer to another. It's usually done by hitting a high-numbered function key (F8 or above) early in the boot process, but sometimes it's a lower-numbered function key, Esc, Enter, or conceivably something else. Look for boot-time prompts, check your manual, ask the manufacturer, or just try random keys from the set of keys I've mentioned. Occasionally a computer can be configured to disable the ability to enter this menu, or you might get into it and find that the Windows entry is missing. In such a case you may need to try more desperate measures. My own rEFInd boot manager, installed on a CD-R or USB flash drives (the preceding linked page has downlown links for both types of media) may be able to help in such a case. If you can get rEFInd to boot, it should show an option to boot Windows.

Once you've booted Windows, you can use the third-party GUI EasyUEFI to change the boot order, putting the Windows boot loader first. This should fix the problem. As an alternative to EasyUEFI, you could use the bcdedit tool by typing the following command in an Administrator Command Prompt window:

bcdedit /set {bootmgr} path \EFI\Microsoft\Boot\bootmgfw.efi

The bcdedit command creates a fresh entry, so this will work even if the Windows entry is missing from the built-in boot manager. (EasyUEFI can do this, too, but adjusting the boot order is more obvious in its GUI.)

BIOS-Mode Booting

This is the trickier case. Several solutions occur to me, but most of these require the use of external media with appropriate recovery tools:

  • GRUB commands -- One method to temporarily boot Windows without extra tools is to issue the appropriate GRUB commands yourself at the grub> prompt. This Stack Exchange question and answers describes how to do this.
  • Super GRUB 2 Disk -- The Super GRUB 2 Disk is an emergency recovery tool that should help you boot Windows, but you'll need to write it to a CD-R or USB flash drive to boot.
  • Windows recovery tools -- If you can prepare a Windows emergency disk, you should be able to write the Windows boot loader to the MBR from a Command Prompt window by typing BOOTREC /FIXMBR. This command should also get things working permanently if you can boot your main Windows installation via one of the preceding methods. There may be other Windows-specific recovery tools or procedures, but I'm not an expert on them.
  • Ubuntu recovery tools -- If you can boot an Ubuntu (or other Linux) emergency system, you may be able to write an MBR that bypasses GRUB and boots Windows directly. This page describes one way to do this.
  • Re-install Ubuntu -- You can re-install Ubuntu to get a GRUB that works, thus restoring your ability to boot Windows.
  • Undelete the Ubuntu partitions -- You can use a tool like TestDisk to recover your Ubuntu partition(s), thus restoring grub.cfg and other GRUB files and making GRUB work again. Of course, you'll need to boot an emergency disk to run TestDisk.

Most of these BIOS-mode approaches will also work with an EFI-mode boot, although some require tweaks. For instance, BOOTREC /FIXMBR will not work on an EFI-mode installation; you'd instead use EasyUEFI or bcdedit to do the equivalent.

Rod Smith
  • 44,284
  • 7
  • 63
  • 105