How to make UEFI bios start GRUB, not Windows?
Solution 1
There are quite a few different ways to do this, including:
-
The EFI setup utility -- Most EFIs provide setup utilities that you can access by hitting a special key at boot time (Esc, Del, or a function key, typically; but what key it is varies from one system to another). These often, but not always, provide a way to adjust the boot order. If your firmware provides such an option, you should be able to use it to move GRUB to the top position. (GRUB is likely to be called
ubuntu
, given that you installed it from that distribution.) -
An EFI shell -- You can use the
bcfg
command in an EFI version 2 shell, as described on the Arch Linux wiki. If your system isn't already set up with an easy-to-access shell, this approach is likely to be harder to use than the others, but it is OS-agnostic. -
EasyUEFI -- The third-party Windows EasyUEFI program is likely to be the easiest way to do what you want. You can click the
ubuntu
entry in EasyUEFI's list and move it to the top. -
bcdedit
-- The Windowsbcdedit
command can alter the NVRAM-based boot order. Specifically, opening an Administrator Command Prompt window and typingbcdedit /set "{bootmgr}" path \EFI\ubuntu\shimx64.efi
(optionally followed bybcdedit /set "{bootmgr}" description "ubuntu"
to keep the description sensible) should do the trick. -
efibootmgr
-- This Linux tool can adjust the boot order. Begin by typingsudo efibootmgr
alone to see the options. Note the number (Boot####
) associated with theubuntu
entry, and the current boot order (on theBootOrder
line). You can then enter a new boot order with theubuntu
entry at the top by using the-o
option. For instance, if the current boot order is 0000,0003,0007,0004 andubuntu
is 0007, you'd typesudo efibootmgr -o 0007,0000,0003,0004
to adjust the boot order. -
refind-mkdefault
-- This script comes with rEFInd, and it's a way to automate the preceding procedure. If you're not using rEFInd, you'd need to download the script here and make it executable (chmod a+x refind-mkdefault
). You'd then run it assudo ./refind-mkdefault -L ubuntu
orsudo ./refind-mkdefault -L shimx64
to make GRUB the default boot entry.
There are potential problems and complications with any of these options. The most likely complicating factor is if there are old or alternative ubuntu
boot entries. It's important that you move the correct one to the top position in the boot order; if you move the wrong one, you'll end up with either no change in behavior or something non-functional booting, which would make it harder to boot. If you use efibootmgr
, the BootCurrent
line may help you to tell which option you should set as the default.
There are other ways to do it that are overkill. Re-installing GRUB (via Boot Repair or grub-install
) should do the trick, for instance. These approaches run the risk of damaging a known-working GRUB configuration, though.
Note also that some EFIs are buggy and there are other issues that can make it difficult to get GRUB to boot reliably. You may want to check out these questions and answers on AskUbuntu if you run into such problems:
- efibootmanager -o changes are lost on reboot
- Windows 8 removes Grub as default boot manager
- How can I repair grub? (How to get Ubuntu back after installing Windows?)
Solution 2
I've been having this exact problem the past few weeks. I figured it out using these options. Before doing any of these things I recommend you to go into your BIOS/UEFI and check the boot order and make sure where grub is installed is first in order.
So how I see it is you have two options.
Option 1
What I would recommend to you is install Windows 10 first. Then install ubuntu. But I know it is kinda taboo to just say "reinstall your software" so I'll offer an alternative too.
Option 2
With your current setup I would recommend you to boot into a Live Ubuntu CD/flash drive and install and run boot-repair
. Click the "Recommended Repair" option and follow the instructions given. Go through it carefully and read all the commands before executing. This will override the current grub installation with a new one which should hopefully fix it.
Solution 3
I see several solutions:
- Edit your UEFI to adjust the default. On linux you can use
efibootmgr
. On Windows I'm not sure but I think you can boot into a recovery option that lets you configure the UEFI. Or you might prefer to install something like rEFInd. - Change the folder name on the EFI partition. I think it prefers, or falls back to, a folder called
boot
. - Just use the Windows boot loader, I think it can be configured to boot other OSes.
Solution 4
I just had my mother board replaced in my laptop and grub disappeared completely.
I know this is marked as fixed but I thought that it may be useful for you.
To make grub appear as a boot option. I needed to add a EFI to bios.
I went to the "boot list option" in my bios. Clicked on "Add Boot Option" (I am aware that this is bios specific). This gave me an option for file name, which in my case was
\EFI\ubuntu\grubx64.efi
and gave it a name grub
I then moved the grub
entry to the top of the boot sequence, and now it shows as the default entry.
I.e. what I'm saying is you may just need to locate the correct EFI file and move it to the top of your boot sequence / order.
Solution 5
None of above options worked for me with old HP 655 laptop. I found out solution is to set windows boot manager inactive:
sudo -s
efibootmgr
efibootmgr -b 4 --inactive
Replace 4 with your number of windows boot manager. Run efibootmgr again and you should see star disappear to mark inactivity.
After my computer boots to grup boot menu and windows can be still chosen from that.
Related videos on Youtube
Jon Watte
Updated on September 18, 2022Comments
-
Jon Watte over 1 year
The TL;DR, added in the edit:
The question is:
How can I make the BIOS prefer GRUB over Windows Boot Manager on the same UEFI boot partition?
The problem is not with Grub; Grub does the right thing when the BIOS starts it. The problem is not with "the disk isn't bootable," because both the Windows UEFI bootstrap and the Grub UEFI bootstrap are bootable. The problem is which UEFI bootstrap the BIOS chooses to boot from.
I'm setting up a new computer, and want it to by default boot into Ubuntu, but have the option to select Windows on boot. This is especially important if power goes out and comes back; I won't even be in the house.
I started out by installing Ubuntu 17.04 on my internal NVMe disk, partitioned with GPT to use half the disk, and a separate UEFI boot partition. GRUB boots that just fine, and I see the GRUB boot menu on start-up where I can select whatever items GRUB knows about.
Then I installed Windows 10 Pro from a recently downloaded ISO. It installed Windows Boot Manager onto the same UEFI partition, and left the Ubuntu intact (great!) and that boots fine into Windows 10.
However, it did "something" that makes the UEFI firmware immediately select the Windows Boot Manager rather than GRUB on power-up. The only way to boot Linux now is to use the BIOS boot manager (F11 on my BIOS) and select the GRUB boot loader manually. The UEFI BIOS knows that there are multiple bootable installs on the UEFI partition, because I can choose between them in the boot manager. However, when I'm in the setup menu in the UEFI BIOS, it just lets me choose "UEFI boot my internal drive" in the boot priority selection -- it doesn't let me choose which particular boot loader on that partition to use. And, by default, it chooses Windows, not GRUB.
The internets (and this site) suggests that the old way to fix this is to run
update-grub
(so GRUB recognizes Windows) and thengrub-install
(to put GRUB back on the device.) I have done this, but unfortunately, it still has the behavior as described above, where the BIOS by default chooses Windows Boot Manager. (update-grub
does find the Windows Boot Manager install, and adds that to the menu, and that menu item works when I manually choose the GRUB partition in the UEFI boot manager.)What can I do to make GRUB the "default" boot on my UEFI boot partition?
Using a MSI X399 Carbon motherboard.
Second edit: Because the correct answer ends up being mentioned in a comment to a response, I'll repeat it here:
"BCDEDIT" in an admin shell on Windows is the working solution. The others don't work.
-
Admin about 5 yearsYou just have to install Windows then Linux. Not the other way around. I have the exact opposite problem. When power goes out then gets back, my computer goes into grub and boots into Linux, smh. One thing tho, is that I have each system on their own drive. On the boot order, I pick the drive with Linux and Grub in it.
-
Admin about 5 yearsIt's amazing how many people suggest things that are already suggested by other people, and I already said didn't work, either in my original post, or in the comments below. The correct solution was "BCDEDIT" in a Windows admin shell. None of the other suggestions solved it (and most of them, I had already tried, as per my question.)
-
-
Jon Watte over 6 yearsThansk for the suggestions, but I had already tried those. The first time I installed things, I went Windows 10 first, then Ubuntu 17.04, then Boot Repair. It still defaulted to Windows, and then I wiped and re-installed with Ubuntu first, which brings me to where I am now.
-
Jon Watte over 6 yearsThe problem is not with Grub. As I said in the post, if I can make the BIOS choose the Grub UEFI boot option, then I get the Grub boot-up menu, which lets me choose Windows or Ubuntu. This is the menu I want by default. Unfortunately, the BIOS chooses Windows Boot Manager by default.
-
chisp2000 over 6 yearsI assume you've tried to adjust the boot order in your UEFI, right?
-
Mr. Raspberry over 6 yearsAs I said, you can fix it in grub boot order by configuring Ubuntu as the first system to start. Use grub-customizer to do this using GUI. linuxandubuntu.com/home/…
-
Jon Watte over 6 yearsYes, as I say: "when I'm in the setup menu in the UEFI BIOS, it just lets me choose "UEFI boot my internal drive" in the boot priority selection -- it doesn't let me choose which particular boot loader on that partition to use"
-
Jon Watte over 6 yearsI could edit boot order using efibootmgr, but the BIOS ignores it and starts Windows anyway. Changing the boot folder name (or even copying grub into "boot") doesn't work until I remove the Microsoft one. The Windows boot loader doesn't boot non-Windows OS-es (at least not unsigned ones.)
-
Jon Watte over 6 yearsAgain, Grub doesn't even get started by the BIOS. Grub boot order doesn't matter. GRUB_DEFAULT doesn't matter. That's not the problem here.
-
Jon Watte over 6 yearsAs I described in the question, the EFI setup utility wouldn't let me pick ubuntu as a default, although it let me do that in manual boot menu. It would just let me pick the drive, and then starts Windows from that. efibootmgr attempted to change the boot order, but BIOS didn't pay attention on reboot. EasyBCD didn't work -- it didn't let me add more menu items. However, "BCDEDIT" in an admin shell actually did work, so thanks for that option!
-
jiggunjer over 6 years@JonWatte Maybe the uefi bootloader is different, I remember booting ubuntu from windows 7 bootloader on a 32-bit bios machine. Maybe it can still chainload grub2? Since
efibootmgr
doesn't work, I know I won't be buying MSI. -
Jon Watte over 6 yearsYeah, this MSI motherboard has some other problems too and is going back to Amazon in exchange for a Gigabyte.
-
telcoM over 5 yearsNote that EasyBCD and EasyUEFI are two different programs from the same vendor. Sadly it seems that the free version of EasyUEFI is no longer available - only trial versions are offered. However, BOOTICE is another free program that can edit the UEFI boot settings: original Chinese site, English-language site with description and screenshots.
-
m3nda almost 5 yearsUsing
sudo efibootmgr -n 0002
is much better than modify current SO order. It changesBootNext: 0001
and leaveBootCurrent: 0002
for next time, leaving your current GRUB entries untouched. Just add a bash withchmod +x
and wrapping that command with along the reboot one.