I’d like to change the default boot option from Fedora to Windows. I’ve tried to read the docs but I’m a bit confused.
If I show my sudo ls /boot/loader/entries I see
giuliohome@localhost ~]$ sudo ls /boot/loader/entries
And the second conf (without rescue in its name) contains the title for Fedora 31 title Fedora (0-rescue-1cb178663c5e44d1a4ff2c09f5819ae7) 31 (Thirty One)
and other things
Then I see the Windows options by issuing another command:
[giuliohome@localhost ~]$ sudo grep -P "submenu|^menuentry" /boot/grub2/grub.cfg | cut -d "'" -f2
Windows Recovery Environment (on /dev/sda1)
Windows 7 (on /dev/sda2)
I’m confused because there is no way to see together Fedora and Windows entries and I’d like to do a modification but I’m afraid to do it wrong causing some damage
Btw, I also wonder why grubby is not recognized as a command
giuliohome@localhost ~]$ sudo grubby --default-kernel
sudo: grubby: command not found
Anyway, according to this doc paragraph, I think that I should do
grub2-set-default "Windows 7 (on /dev/sda2)"
Am I understanding it well? Is the above command correctly spelt (I’m not sure how to correctly render the "<submenu title><menu entry title>" part, so I simply copied from the output of the previous suggested command to list all possible menu entries) for my situation? Is it the safest way to change the boot default? After it, there is no need of a grub2-mkconfig -o /boot/grub2/grub.cfg, is there? Anything else I’m supposed to do/check?
Hello @giuliohome, and welcome. The link you provided seems a bit stale on the info, I would refer you to the Fedora Sys Admin Guide on the topic. You should be able to issue the following to see all menu entries grubby --info=all to get a listing of your menu entries. Then you can set the default kernel with grub2-set-default 'entry-number or name' and this should be able to be done without needing to remake the grub config file, since it makes the changes to a file sourced by grub.cfg.
Last metadata expiration check: 7:37:39 ago on Fri 31 Jan 2020 11:17:42 AM +07.
=============================== Name Exactly Matched: grubby ===============================
grubby.x86_64 : Command line tool for updating bootloader configs
=================================== Name Matched: grubby ===================================
grubby-deprecated.x86_64 : Legacy command line tool for updating bootloader configs
dnf install grubby
PS: I can’t test BLS modern approach there, because i’ve no Win’.
Thank you both very much! Indeed I started by looking at the doc posted from @jakfrost but I was perplexed because grubby was missing in my installation.
I have installed grubby as suggested by @vits95, then when I execute the command sudo grubby --info=ALL (notice that it needs the uppercase letters and a root auth, even if I understand that mine is a BOOT not a UEFI) I still can’t see my third and fourth Windows entries (that I can get with the other command in my original post from the “stale” doc) but I only see:
Is it important the fact that I can’t see the Windows entries from the output above or can I safely ignore it?
Now, should I proceed with
grub2-set-default 'Windows 7 (on /dev/sda2)'
which one is better? So is it with single quotes ' and not double quotes " when used with a name, isn’t it? While it is followed by just a number in the second case (as per the example in the doc). From which command can I have confirmation that the number or the name of the Windows entry is correct? Thanks again.
@giuliohome, It’s good to see you resolved your issue. There is also the grub-customizer GUI tool that I have only just noticed. I haven’t used it, but it is a part of the fedora repo. As for Grubby, it has been progressing towards a script for some time and now is totally such. The original Grubby is now grubby-deprecated for use on older ‘legacy systems’. The grub-customizer seems to have all the necessary bits, I think I will see how well it works on Silverblue.
The first option means the firmware checks NVRAM which points to shim which points to GRUB which points to Windows bootloader.
The second means NVRAM points to the Windows bootloader, bypassing shim+GRUB.
The first option can be interrupted by holding Esc to get the GRUB boot menu. The second, to boot Fedora, takes a trick in Windows: shift key+reboot then there’s an option to boot from another device ( tends vary depending on Windows version), and if you choose that you’ll see a Fedora option.
Still another way, most UEFI firmware have a (clunky) built in boot manager, typically accessed by F key shortcut.
Yes, I have recently looked at it on my SB install and it sometimes works, sometimes states it is doing something but no showing what, process is shown as sleeping and I have to end it since it basically will go indefinitely sleeping from then on it seems. So @giuliohome, please don’t use the customizer as it seems unreliable at this moment.