Save last booted entry in dual boot in 2 different hard drives


So, I’ve had a dual boot Windows / Fedora for quite some time in my MSI laptop, having Windows installed in the SSD drive and Fedora in the HDD drive. I use grub2 to boot into the OS I want and I had Windows selected as the default boot since I installed Fedora.
However, recently I wanted to change it so the default would be the last OS I booted into. After looking around, I found that I had to use GRUB_DEFAULT=saved and GRUB_SAVEDEFAULT=true in /etc/default/grub then use grub2-mkconfig -o /boot/grub2/grub.cfg to save this new configuration.

The issue I found was that, when booting into Windows, I have this message: error: ../../grub-core/fs/fshelp.c:257:file '/grub2/grubenv' not found
Then I can just press any key and it boots into Windows, but it won’t remember the last boot when I restart the computer. This error does not appear when booting into Fedora.

I’ve found several topics talking about this issue, but none seemed to solve it. The file /boot/grub2/grubenv does exist and it has a symbolic link to ../efi/EFI/fedora/grubenv, which also exists.
I have to guess one of the disks storing one of those files is not mounted when booting into Windows, but I don’t know enough about this topic to solve the issue.

Does anyone have an idea on a solution?

Thanks in advance!


You are looking in the right area. In order for Grub to save the last booted OS, the /boot partition must be mounted with RW. AFAIK, this doesn’t happen until the OS is booted.

I could also be off the mark.