0

I have the following options on my machine in Grub when I boot it up:

Fedora (5.10.21-200.fc33.x86_64) 33 (Workstation Edition)
Fedora (5.10.19-200.fc33.x86_64) 33 (Workstation Edition)
Fefora (5.8.15-301.fc33.x86_64) 33 (Workstation Edition)
Fedora (0-rescue-af432317147a47c59c193b055d8a658f) 33 (Workstation Edition)
Windows Boot Manager (on /dev/nvme0n1p1)
System setup

I want to change my default boot option to Windows. I read this question on changing the boot priority, but when I ran the following command, nothing came up:

grep "submenu\|^\smenuentry" /boot/efi/EFI/fedora/grub.cfg

When I looked in the /boot/loader/entries/ directory for *.conf files, the only things visible were these:

# ll /boot/loader/entries
total 16
-rw-r--r--. 1 root root 410 Mar  6 16:35 af432317147a47c59c193b055d8a658f-0-rescue.conf
-rw-r--r--. 1 root root 337 Mar  6 17:39 af432317147a47c59c193b055d8a658f-5.10.19-200.fc33.x86_64.conf
-rw-r--r--. 1 root root 337 Mar 12 09:27 af432317147a47c59c193b055d8a658f-5.10.21-200.fc33.x86_64.conf
-rw-r--r--. 1 root root 334 Mar  6 16:35 af432317147a47c59c193b055d8a658f-5.8.15-301.fc33.x86_64.conf

So how do I set Windows as the default boot option?

1
  • 1
    Normally, you would do this by setting the GRUB_DEFAULT option in /etc/default/grub, then recreating grub.cfg. I guess the instructions for F18 are still correct. – berndbausch Mar 13 at 3:18
1

The following is relevant as for Fedora 32/33/34. Like it often happens in Linux this manual might become outdated in the future.

  1. First make sure GRUB_DEFAULT=saved is set in /etc/default/grub - edit the file if necessary using sudo with nano, vi, joe.

  2. Run

awk -F\' '$1=="menuentry " {print $2}' /boot/efi/EFI/fedora/grub.cfg
Windows Boot Manager (on /dev/sda4)
System setup

to see your non-Fedora/non-Linux-kernel entries. The BIOS path for this file is /boot/grub2/grub.cfg.

  1. Run:
sudo grub2-set-default "Windows Boot Manager (on /dev/sda4)"

grub2-set-default also takes a number as an argument. You're done.


You can also use sudo efibootmgr --bootorder to change your default EFI boot option though it's will not always work since lots of modern PCs have a zero boot delay, thus don't allow to press any keys to choose a non-default EFI boot option, i.e. you could lose access to your Fedora.


Fedora's documentation on grub2 can be found here.

4
  • Using grub2-set-default did not work: running sudo grub2-set-default 'Windows Boot Manager (on /dev/nvme0n1p1)' yielded the following output: /usr/bin/grub2-editenv: error: invalid environment block. repeated three times. I rebooted and Fedora is still the default. – wheeler Apr 15 at 13:35
  • I did some googling, the recommendation for that error was to delete the /boot/grub2/grubenv/ and /boot/efi/EFI/fedora/grubenv files. I did that and the grub2-set-default command seemed like it worked (there was no output). However, upon rebooting, Fedora is still set to the default boot option, so grub2-set-default is not working. – wheeler Apr 15 at 13:44
  • @wheeler Can you show your sudo head -n -1 /boot/efi/EFI/fedora/grubenv ? – Artem S. Tashkinov Apr 15 at 13:51
  • Also sudo cat /etc/default/grub – Artem S. Tashkinov Apr 15 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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