Just joking. Linux is very respectful and wouldn’t do anything like that.
What has actually happened is that the default selection in GRUB is Fedora and so, if I’m not quick enough at fiddling with the arrow keys, Fedora gets booted instead of Windows (which I’d like to be my default).
Was I lucky enough to still have Windows?
It’s been a long time since I made a Fedora installation on a PC with two drives, and I was expecting Anaconda to ask me where the bootloader should have been installed.
Guess? Well, it didn’t.
I still am not sure if I’ve been lucky, or if Anaconda was mindful enough to install the bootloader on the drive with Fedora, leaving the Windows drive untouched.
I would have appreciated some kind of notification, or warning, or a chance to change and make the final decision.
Also, I would have appreciated the possibility to choose the default entry in the menu.
Guess it will be a feature request for some future release.
What do I do now?
Apart from what I would have liked and never was, I want to change the default to Windows, so I can just push the button in the morning and leave for a nourishing breakfast, and then find Windows ready for me to work on it for a handful of extremely pleasant productive hours (sarcasm intended).
A thing I wish there was in Fedora is a GUI for messing around with the bootloader. At least for tampering with the most frequent changes like the timeout, the default entry, and the kernel arguments.
But, no! You have to do it the command-line way.
My system uses UEFI, so if one wants to replicate this, just make sure one is also on UEFI. This is not a tutorial, but it’s just a reminder for my future self of what I did.
So, that’s what I did!
Given I’m a reckless person who does not want to be sudo-ing all the time in one single session, I typed:
$ sudo -i
Unsafe? Sue me, sudoers!
Then, I checked what entries and what indexes there were on my systems:
# grubby --info=ALL
index=0
...
title="Fedora Linux (6.18.5-200.fc43.x86_64) 43"
...
index=1
...
title="Fedora Linux (6.18.4-200.fc43.x86_64) 43"
...
index=2
...
title="Fedora Linux (6.18.3-200.fc43.x86_64) 43"
...
index=3
...
title="Fedora Linux Rescue"
Where’s my Windows chainloader (I don’t know what it is, I just know the name and I’m bragging) entry?
Turns out that grubby — which is the official method in Fedora for tampering with the bootloader — does not manage Windows: os-prober does (what even is os-prober?).
So, a set of grub2 command is required.
First thing, I need to know the exact name of the menu entry:
# grep -E "submenu|^\s*menuentry" /boot/grub2/grub.cfg
menuentry_id_option="--id"
menuentry_id_option=""
menuentry 'Windows Boot Manager (on /dev/nvme0n1p1)' --class windows --class os $menuentry_id_option 'osprober-efi-8830-5645' {
menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
The text I need is the bold one: ‘Windows Boot Manager (on /dev/nvme0n1p1)’.
Again, if one is trying to do the same, note that the device name will almost certainly be different.
Then, I need to change the default entry:
# grub2-set-default 'Windows Boot Manager (on /dev/nvme0n1p1)'
Check that everything has gone smoothly:
# grub2-editenv list
saved_entry=Windows Boot Manager (on /dev/nvme0n1p1)
menu_auto_hide=1
boot_success=0
boot_indeterminate=2
One reboot later…
After a proper Windows boot and once checked that everything was fine, it’s time to make the change permanent!
Yeah, that was not permanent.
With the
GRUB_DEFAULT=saved
set in /etc/default/grub.cfg, the boot item defaults back to the latest Linux kernel after every installation of a new kernel (and in Fedora it happens frequently!).
So I edited the /etc/default/grub.cfg and changed
GRUB_DEFAULT='Windows Boot Manager (on /dev/nvme0n1p1)'
I also made sure there was no line
GRUB_SAVEDEFAULT=true
If it’s there, either delete the line or set it to
GRUB_SAVEDEFAULT=false
This should ensure that no new Linux kernel is set as the default menu entry in the future.
As the final step, I had the configuration file regenerated to have the new settings baked in (yes! this sentence sounds mysterious to you as it is to me).
# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found Windows Boot Manager on /dev/nvme0n1p1@/efi/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
done
A couple of reboots later…
Everything seems fine, and Windows is back on top of Linux — right where it belongs.
Ok, sorry! I might have gone too far with this last sentence.