Fedora Kinoite - How to enable GRUB_SAVEDEFAULT=true and GRUB_DEFAULT=saved?

Hi all,

I have a dual-boot computer with Win 11 and GNU Linux.

Initially, I was using Manjaro KDE but after multiple issues on update (sometimes solved with chroot, sometimes leading to a full reinstallation), I decided to test an Atomic distro and naturally ended with Fedora Kinoite.

Initially, I had some random issues with frozen system after suspend that now seem solved without really understanding why… well, nevermind…

One last point I would like to improve is this one :
I would like to activate the GRUB_SAVEDEFAULT=true and GRUB_DEFAULT=saved options I used before to let the computer boot on the last booted OS (dual boot, yes).

With :
sudo nano /boot/grub2/user.cfg

I manage to add the Win11 boot partition and improve the Grub resolution but no more.

What can I add to my following user.cfg to make it work:

# Add Windows 11 Pro Menu Entry as First Menu Item
menuentry 'Windows 11' --class windows {
  search --fs-uuid --no-floppy --set=root 6607-74E5
  chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
}

#Set screen resolution
set gfxmode=1920x1080
set gfxpayload=keep

#Other common resolutions... just in case...
#set gfxmode=1920x1080,1280x800,1024x768,1280x1024


#Load Graphic Terminal
insmod gfxterm
insmod gfxmenu

#Use GRUB graphic terminal
terminal_input gfxterm
terminal_output gfxterm

# Grub Delay to allow choice
set timeout=5
set timeout_style=menu

Thank you very much for your help,

Hi and welcome to :fedora: !

From my current and previous tests, there are two things I have noticed.

One is that GRUB variable names have to be used here and not GRUB generator variables, given that the file /boot/grub2/user.cfg is imported into /boot/grub2/grub.cfg itself, and therefore GRUB’s scripting language is needed. You can test this by using set default=1 (as opposed to set GRUB_DEFAULT=1) for example.

The other thing is that set default=saved with its counterpart set savedefault=true don’t seem to be working. Assuming that the syntax is correct, one explanation is that GRUB on Fedora atomic desktops doesn’t update the GRUB environment block (located in /boot/grub2/grubenv) or doesn’t work with it at all. This is also backed by the fact that the boot_success flag inside the file is not updated on Kinoite (and on my Silverblue install the file /boot/grub2/grubenv is outright missing).

Hi,

Thank you for your answer.

Regarding the fact Kinoite does not update the grubenv file, I am not so sure as grubenv seems to be updated:

ccadiou@Host-001:/var/home/ccadiou$ sudo ls -l /boot/grub2/
total 16
-rw-r--r--. 1 root root   53 13 janv. 18:40 bootuuid.cfg
-rw-------. 1 root root 3164 13 janv. 18:40 grub.cfg
-rw-------. 1 root root 1024  1 févr. 21:05 grubenv
-rw-r--r--. 1 root root  720 16 janv. 19:58 user.cfg

Now, the grubenv is almost empty !
Here is the content of Fedora Kinoite 43 on my computer:


# GRUB Environment Block
# WARNING: Do not edit this file by tools other than grub-editenv!!!
boot_success=1
###############################################################################################################################>

If I try to set the saved_entry parameter, I have no success:


ccadiou@Host-001:/var/home/ccadiou$ sudo grub2-editenv /boot/grub2/grubenv set saved_entry
grub2-editenv : erreur : paramètre saved_entry incorrect.

Well, nevermind… The system is running well anyway and I can live with the need to choose the OS at start-up.

Thanks a lot !

grub2-editenv is not meant to be used on Fedora atomic desktops. GRUB is here static. And because of that, savedefault is probably not called on purpose.

Also keep in mind that dual-boot on Fedora Atomic is not considered fully functional yet, but I haven’t had any issues dual-booting Silverblue with Windows.

You’re welcome. I hope you have a great journey with Fedora in general and with Fedora’s atomic desktops in particular.

Hi,

Just to clarify on what I wrote above “Regarding the fact Kinoite does not update the grubenv file, I am not so sure as grubenv seems to be updated…”,

I rebooted the computer today and grubenv date and time of last modification was not changed.

What modified the date and time was my attempt to “unset saved_entry”.
The command “set saved_entry” returns an error with no date and time modification but the “unset saved_entry” applies a modification and changes the time stamp.

So you are right, the grubenv file is left untouched after a shutdown/start-up cycle.

That makes sense. You could also notice that while on non-atomic Fedora the boot_success variable is reset to 0 at boot-up, and then set to 1 after a couple of minutes (2 minutes IIRC) in the graphical session, this variable is not changed by Fedora Kinoite.

FWIW, if you notice using Fedora more often than Windows, then you could be using set default=1, which is still working, and that would move the default GRUB entry to the latest Fedora deployment, instead of the first entry, which is Windows in your case.

Sure,
I will probably choose Fedora Kinoite as the default option. I selected your last answer as the solution (impossible to select multiple posts…)

At the moment, I keep Windows 11 on one separate drive because this old computer (with no TPM chip…) is equipped with a crossfire of AMD Radeon HD7870 and Gnu-Linux was never at ease with this type of configuration.
I boot in Windows to launch some titles one gpu card can not manage alone.
I will open another thread about that later as I have a few alerts in dmesg due to this crossfire…

Thanks,

1 Like