Fedora now uses Grub 2. Whenever it does a kernel upgrade, it loses my default boot option (Windows). How can I fix this?
4 Answers
I'm not sure whether there have been any changes/improvements with grubby
or 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 grub2-mkconfig
?
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:
GRUB_DEFAULT=saved
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
grub2-editenv list
-
My windows entry is not shown by
grep "submenu\|^\smenuentry" /boot/grub2/grub.cfg | cut -d "'" -f2
, this is becausemenuentrty
comes right after the start of the line, without spaces. This is probably due to the way os_prober.sh gives its output. Anyway, I follwed all this steps and my choice is still not sticking between kernel upgrades– DariopncFeb 5 at 10:58
In Fedora you currently can't make this permanently default.
If the kernel
is being updated the grubby
software used to add Grub2 menu item. And it definitely doesn't pay attention to /etc/default
.
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.
btw, after 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:
GRUB_DEFAULT="0"
Where 0 is the first entry of your grub list. Edit it the way you want. Then afterwards, run sudo update-grub2
.
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.