Ask Your Question
2

Set default boot on dual boot system.

asked 2018-04-19 02:48:19 -0500

Musterknabe gravatar image

updated 2018-04-19 02:49:30 -0500

Preface

This question has been asked a thousand times, I know, I searched the Internet, but for me, it still didn't work.

Summary

I'm currently sitting on a computer having both Windows 10 and Fedora 27 installed as dual boot. I use Windows for gaming and Fedora for working when I do home office, so I don't need Fedora on this machine that often. The problem is, since I installed Fedora AFTER I installed Windows my machine boots to Fedora per default. I want to change that so that I can boot to Windows.

Configuration

Grub-Customizer

As said before, I searched the Internet and the first answer was to use grub-customizer which isn't possible in the newest version of GNOME IIRC, so that was a solution I couldn't use.

Manually editing /etc/default/grub

Another article state to simply change the GRUB_DEFAULT in the /etc/default/grub file to the correct value. In order to get the correct value I should check the /boot/grub2/grub.cfg and search for the menuentry with Windows. Now there were two options

Setting the default by index

First option was to count the menuentries until the Windows Boot Manager appears starting with 0 (so like an array). Since Windows was the 5th occurence of the menuentry I used GRUB_DEFAULT=4. I saved these settings with sudo grub2-mkconfig -o /boot/grub2/grub.cfg, rebooted and.... still booting into Fedora

Setting the default by name

Second option was to just get the name of the menuentry, so in my case Windows Boot Manager (on /dev/sdb2) and put that as the default, so my/etc/default/grub looked like this GRUB_DEFAULT="Windows Boot Manager (on /dev/sdb2)". I executed the grub2-mkconfig command again, rebooted..... still booting into Fedora.

Here's a paste of my /boot/grub2/grub.cfg : https://pastebin.com/fyWE1prf

There must be something I'm doing horribly wrong, but I don't know what it is.

edit retag flag offensive close merge delete

Comments

Is this a (U)EFI or legacy-based machine?

florian gravatar imageflorian ( 2018-04-19 09:18:28 -0500 )edit

3 Answers

Sort by » oldest newest most voted
1

answered 2018-04-19 03:14:02 -0500

Musterknabe gravatar image

updated 2018-04-19 03:15:10 -0500

Okay, I kinda got grub-customizer to run. I opened up the terminal, entered su to become root and then simply could call grub-customizer without any error. The grub-customizer also added the line

GRUB_SAVEDEFAU=false

to the /etc/default/grub config, so maybe this was the problem.

Edit: Due to karma missing, I cannot accept my own answer.

edit flag offensive delete link more
3

answered 2018-04-19 16:10:02 -0500

cmurf gravatar image

/boot/grub2 is the wrong location for grub.cfg on Fedora for UEFI computers. Fedora uses a non-standard location: /boot/efi/EFI/fedora/grub.cfg - I can tell your system uses UEFI because your grub.cfg uses the GRUB commands linuxefi and linuxinitrd.

The kernel packages have a tendency to overwrite the GRUB default with the latest kernel, I'm clearly seeing grubenv is overwritten and has the most recent kernel embedded in that file. So I think messing around with GRUB to do what you want is getting a bit out into the weeds, and might make things harder to troubleshoot later, but as there's a dozen ways to do the same thing all that matters is that you understand your setup. What I would do is change the NVRAM boot order using efibootmgr so that Windows boots directly.

Example:

$ efibootmgr
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0001,3001,0002,2001,2002,2004
Boot0001* Fedora
Boot0002* Windows Boot Manager
Boot2001* EFI USB Device
Boot3001* Internal Hard Disk or Solid State Disk
$

Since BootOrder lists 0001 (Fedora) before 0002 (Windows), the firmware always loads GRUB first. To switch this around so Windows boots first.

$ sudo efibootmgr --bootorder 2,1
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0002,0001
Boot0001* Fedora
Boot0002* Windows Boot Manager
Boot2001* EFI USB Device
Boot3001* Internal Hard Disk or Solid State Disk
$

Now it boots directly to Windows 10 first from now on. So how do you switch to Fedora? You can do one time boots to Fedora from Windows:

  • Start menu
  • Power icon
  • Shift key + click on Restart
  • In the Choose an Option menu, click on Use a Device
  • Click on Fedora
edit flag offensive delete link more
-3

answered 2018-04-19 15:12:15 -0500

updated 2018-04-19 15:14:08 -0500

grub-mkconfig makes a new menu, but doesn't install it. You need to do:

sudo grub2-install /dev/sdb

That will install the boot menu into the MBR on /dev/sdb. If you are using UEFI boot, then see the man page for grub2-install for appropriate options.

edit flag offensive delete link more

Comments

Running grub2-install on UEFI is bad advice. It causes all kinds of problems including breaking Secure Boot. "grub2-install shouldn't be used on EFI systems" https://fedoraproject.org/wiki/GRUB_2

cmurf gravatar imagecmurf ( 2018-04-19 16:02:32 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-04-19 02:48:19 -0500

Seen: 598 times

Last updated: Apr 19