Fedora now uses Grub 2. Whenever it does a kernel upgrade, it loses my default boot option (Windows). How can I fix this?
I'm not sure whether there have been any changes/improvements with
anaconda pertaining to this issue. Has anyone tried to follow these guidelines from fedora's wiki page:
Manual changes might however be overwritten with grub2-mkconfig next time the >system is upgraded with anaconda. Some customizations can be placed in /etc/grubd/40_custom or /boot/grub2/custom.cfg and will survive running grub2-mkconfig.
Otherwise, what specifically could be placed in the above-mentioned files that would survive kernel upgrades and/or running
This is taken from Fedora's Grub wiki page:
Due to grub2-mkconfig (and os-prober) we cannot predict the order of the entries in /boot/grub2/grub.cfg, so we set the default by name/title instead.
Open /etc/default/grub and ensure this line exists:
Apply the change to grub.cfg by running:
grub2-mkconfig -o /boot/grub2/grub.cfg
Now list all possible menu entries
grep "submenu\|^\smenuentry" /boot/grub2/grub.cfg | cut -d "'" -f2
Now set the desired default menu entry
grub2-set-default "<submenu title>><menu entry title>"
Verify the default menu entry
In Fedora you currently can't make this permanently default.
kernel is being updated the
grubby software used to add Grub2 menu item. And it definitely doesn't pay attention to
Citation from Fedora wiki:
Grubby in Fedora patches the configuration when a kernel update is performed and will try to not make any other changes than what is necessary.
kernel updated I do
package-cleanup --oldkernels --count=1 and
grub2-mkconfig -o /boot/grub2/grub.cfg to get rid of old kernels.
I don't use fedora, and I'm not 100% sure if the changes will be permanent (after kernel upgrades), but I think you need to edit the file
/etc/default/grub. On row number 6 you will see:
Where 0 is the first entry of your grub list. Edit it the way you want. Then afterwards, run
Fedora has changed, at least on UEFI systems. This is partially described in https://systemd.io/BOOT_LOADER_SPECIFICATION/
The list of linux kernels to boot is gleaned from /boot/loader/entries/*.conf (Note: this is not within the ESP.)
If you take the name of one of those files, without the directory path and without .conf, you can use it in the command that looks like this:
sudo grub2-set-default 2733f1c892a5422c98bdb188c4f62737-5.10.9-201.fc33.x86_64
This worked for me. I don't know how sticky the result is.
Note: if you are trying to default to an old kernel, you may need to make sure that it isn't deleted by updates. Change installonly_limit in /etc/dnf/dnf.conf to 0.