Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On my old laptop (legacy BIOS, MBR disk), this was perfectly possible to get working:

  • I turn on the computer and see the Windows Boot Manager

  • I use EasyBCD (or BootPart, or something else) to add an option to the BCD menu which allows me to boot into GRUB, and then into Ubuntu

I can't figure how to do this on my new laptop (UEFI, GPT disk), whether in UEFI or legacy mode.

Currently I've installed (and even booted!) Ubuntu on my laptop, but only with the help of an external GRUB (on a USB flash drive).

How can I add GRUB as an option in the Windows Boot Manager on a UEFI laptop?

(No, I don't want to change my primary boot loader. So no, I don't want to overwrite the Windows boot loader with GRUB.)

share|improve this question

AFAIK, you can't. To the best of my knowledge, the Windows boot loader doesn't provide any means to launch non-Windows EFI boot loaders. I could be wrong about this, though; I admit that my knowledge of the Windows boot loader is limited.

Instead, you can configure any of a number of EFI boot loaders and boot managers for Linux to handle the boot-selection job. When everything works fine, GRUB can do this job; but as of version 13.04, Ubuntu doesn't set up GRUB correctly for dual-booting when it installs. There can also be other problems caused by EFI bugs. To work around the Ubuntu GRUB configuration problem, two solutions are easiest:

  • Run Boot Repair on the system. If this works, it will re-install and reconfigure GRUB so that it can launch Windows.
  • Install my rEFInd boot manager. This is most easily done by installing the Debian package under Ubuntu. (Be sure that your ESP is mounted at /boot/efi, though.) Once installed, rEFInd should enable booting directly into Windows or directly into Linux, bypassing GRUB.

Note that neither of these solutions completely replaces the Windows boot loader; they both just make another boot program (GRUB or rEFInd) run before the Windows boot loader. You can stop reading here if you like, but some background may be helpful in understanding this:

When booting a multi-boot computer, a boot manager gives you a way to choose between two or more OSes, typically through a menu. Most EFIs include an awkward but built-in boot manager. rEFInd is also a boot manager, and GRUB includes a boot manager. A boot loader, by contrast, loads an OS kernel and any associated files and starts the kernel running. The EFI doesn't include a boot loader, so every OS must provide one. GRUB is a boot loader for Linux (but not for Windows) in addition to being a boot manager, the Linux kernel (since version 3.3.0) can function as its own boot loader, and Windows provides its own boot loader. rEFInd is not a boot loader; to boot Linux, it relies on the EFI stub loader or some other boot loader to load the kernel.

Thus, it's not possible to replace the Windows boot loader with GRUB, since GRUB is not a Windows boot loader. GRUB can use its boot manager features to chainload to the Windows boot loader, though.

share|improve this answer
    
I was worried that might be the answer. :( +1 thanks for the detailed response. If there's no other way then I have to install GRUB I guess -- but the question in my mind is now, how do I go back to the Windows boot loader once I have done so? That's also part of what scares me. There's lots of tutorials telling me how to install GRUB but none of them tell me how to return the laptop to its previous state, so it makes me even more reluctant to install GRUB. – Mehrdad Sep 2 '13 at 17:25
    
On an EFI-based computer, you can either remove an unwanted boot loader file from the EFI System Partition (ESP) or edit the boot options stored in NVRAM using a tool such as Linux's efibootmgr. If you use rEFInd, there's no need to worry; it installs itself completely to the ESP, so even if you delete your Linux partitions, you'll still be able to boot Windows, albeit through rEFInd unless/until you delete rEFInd or adjust your NVRAM entries. – Rod Smith Sep 2 '13 at 17:52
    
IF you just want to boot Windows you can in your UEFI change the boot order to boot Windows. Or use one time boot key possibly f12 to choose to boot Windows. No reinstall of Windows boot loader is required like with BIOS as all are in different folders in efi partition. To totally remove grub then follow Rod Smiths instructions. – oldfred Sep 2 '13 at 18:11

Scenario is Windows boot manager is first boot choice on UEFI.

You can always use boot device selection key (F12 on DELL) from firmware which gives you the list of all installed OS as boot choice.

If the boot process is too fast you can always set Windows boot menu to text style with timeout say 10 seconds and from there escape to firmware boot selection using (ESC key on DELL, should be common).

If you are in Windows 7/8/8.1 and want to boot directly to Linux(Ubuntu) you can use a tool called BootNext which allows direct booting to any installed OS (Windows, Linux) on UEFI.

share|improve this answer

It is possible after all - adding .efi boot loaders into Windows Boot Manager but at least on my motherboard is a very bad idea because the change is permanent - eg. after booting to Ubuntu from Windows Boot Manager you will always boot to Ubuntu because it directly edits the UEFI boot config.

Also achieving this can be done only by manually editing the BCD file. You can check the accepted answer to this question: Windows 8.1 UEFI x64 is not able to boot-up UEFI Images for more details.

share|improve this answer

All these instructions are working in Ubuntu 16.04. I don't know if something is different in Ubuntu 13.04.

If you just don't want to use Grub as bootloader, because you don't like it, I can't help you with what you are asking. But if you don't want to use Grub only because it overwrites Windows bootloader, then there is a way to have Grub2 installed without Grub2 to overwrite Windows bootloader.

If you want the second one:

One thing you can do is to use Grub2 as default bootloader. Grub2 will recognize Windows bootloader and will add it to the Grub2 list. Go to BIOS settings and change boot priority to Ubuntu partition. Now every time you boot your pc, you will be at Grub2 menu. In order to use Grub2 as your default bootloader without Grub2 to overwrite Windows bootloader, you need to reinstall Ubuntu with "Something Else" option and install Grub2 in your root Ubuntu partition and not to any Windows partition or to the entire disk when you asked about where to install it.

Be carefull: If you just unistall Ubuntu, but previously, when you installed Ubuntu, you installed Grub2 in a Windows partition or in the entire disk, then you will not have access to any of Windows or Ubuntu, because the Windows uploader will be already overwritten and if you delete Ubuntu, you will delete the only bootloader left on your system (Grub2).

That's sure if you unistall and then reinstall Ubuntu. If you reinstall Ubuntu without to uninstall it first, I am not sure what will happen. So, just to be sure everything will be ok, uninstall Ubuntu with the instructions in the following link:

http://www.everydaylinuxuser.com/2016/04/how-to-remove-ubuntu-from-computer-dual.html

In the link there is a mistake: The correct command for changing the order is

sudo efibootmgr -o 1

and not sudo efibootmgr -0 1

{it is an o (letter, from order), and not 0=zero).}

After that go to Disk Management from Windows and make your space for Ubuntu allocated again.

Then install Ubuntu again. Just make sure to install in UEFI to be compatible with your Windows UEFI. This can be selected in the program that makes your DVD or usb bootable. For UEFI select GPT for UEFI. During the installation select "Something Else", in order to configure the installation manually. Create a root partition with "/" (with "Primary" and "Beginning of the disk" selected) as your main Ubuntu partition and a Swap partition (with "Primary" and "Beginning of the disk" selected) with size same as your RAM. To the same page at the bottom there is an option about where to install Ubuntu bootloader (Grub2). In specific, "Device for boot loader installiation". Install it on the "/" partition of Ubuntu. If you do that, the two bootloaders will be separated and the Grub2 will not overwrite Windows bootloader. From then, if you want to change the bootloader you are booting to, you can do this from BIOS settings, Boot Priority.

Now, boot using Ubuntu boot priority from BIOS and start Ubuntu.

You can customize Grub2 to meet your preferences:

Open terminal and type:

apt install gksu

and after that type:

gksu gedit /etc/default/grub

In order to put windows first in the list priority:

Change GRUB_DEFAULT to the number order that Windows are in your Grub2 list when you Boot, starting from 0 to be the first option. If Windows is at the top, put: GRUB_DEFAULT=0, if second GRUB_DEFAULT=1, if third GRUB_DEFAULT=2...

You can also change the order the entries are shown, but this will change your option about default boot selection you did previously. So if you want to change the order they are shown, first change the order and then change the GRUB_DEFAULT.

In order to change the order, you will need to install a program that is called "Grub Customizer".

Open a second terminal, don't close the one with grub folder, because we are not done with that yet. Install it by typing these 3 commands:

sudo add-apt-repository ppa:danielrichter2007/grub-customizer

sudo apt-get update

sudo apt-get install grub-customizer

Open the program and fix the order as you like. You can also hide some entries and the program will keep them aside if you want something back afterwards. It does not delete entries. Just hide them from being shown in Grub2 when you boot. From the list on the right you can just restore every one of them separately.

Back to Grub file:

You can also turn off or change the time before Grub boot automatically to the default entry.

In the same document, there is an option GRUB_TIMEOUT. Put the seconds you want.

By default is 10 seconds. GRUB_TIMEOUT=10

If you want to turn the countdown off, and make Grub2 wait for your selection for as much time as you want/need/like, put -1.

GRUB_TIMEOUT=-1

Save the document, close the document after you save it and type in the terminal:

sudo update-grub

in order for the changes to take effect.

Last, you can change the picture of the background of Grub2. Just copy or move the photo you want using terminal and superuser password (su root) at

/boot/grub

and off course open terminal and run:

sudo update-grub

for the changes to take effect.

As you can see, you can have the two bootloaders completely separate the one from the other. You can uninstall each of the OS you want, since each bootloader is installed in its OS.

Ath the same time, Grub can do everything you want either through terminal or GUI!

share|improve this answer

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.