Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1708455 - Dual Boot grub with bootloader spec doesn't save last booted in menu
Summary: Dual Boot grub with bootloader spec doesn't save last booted in menu
Keywords:
Status: CLOSED DUPLICATE of bug 1704926
Alias: None
Product: Fedora
Classification: Fedora
Component: grub2
Version: 30
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Peter Jones
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-05-10 01:06 UTC by Andrew Duggan
Modified: 2020-04-04 21:36 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-01-15 17:05:52 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Andrew Duggan 2019-05-10 01:06:57 UTC
Description of problem:
After upgrade to fedora 30 from 29, (which enabled bootloader spec) grub no longer set the last booted OS correctly.  Always choose Windows 10 as the default. In Fedora 29 Same machine prior to upgrade grub would recall which OS (or kernel) last booted and have that has the default entry in the list.

Version-Release number of selected component (if applicable):
2.02-78.fc30

How reproducible:
Always

Steps to Reproduce:
1. Boot to Windows 10. - Shutdown
2. Restart computer - choose Fedora 30 (5.0.10-300) Shutdown
3. Restart computer 

Actual results:
Grub menu still shows Windows 10 as default


Expected results:
Grub menu selects Fedora 30 (5.0.19-300) as last booted.

Additional info:

Contents of /etc/default/grub

GRUB_TIMEOUT="15"
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT="saved"
GRUB_SAVEDEFAULT="true"
GRUB_DISABLE_SUBMENU="true"
#GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="resume=UUID=226e613d-a795-401c-bec0-061f21ff14da rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_BACKROUND="/boot/efi/EFI/fedora/themes/breeze/hp-Logo.png"
GRUB_THEME="/boot/efi/EFI/fedora/themes/breeze/theme.txt"
GRUB_ENABLE_BLSCFG="true"

Disabling Bootloader spec (install grubby-deprecated and change GRUB_ENABLE_BLSCFG="false" with a grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg.

Comment 1 Andrew Duggan 2019-05-10 01:13:42 UTC
No doubt will be closed with a WONTFIX (if not ignored) but adding features (bootloader spec) as the default setup should not break / deprecate / remove existing useful functionality (such as grub being able to set and remember the last booted entry in the list).
Dual booting to windows on a laptop has been something I have been doing with Fedora since Fedora Core 2 (15 years now) -- grub and (grub2) setting and remembering the last booted entry in the list has been a useful for this common use case.

Comment 2 laurent.chrismann 2019-11-10 12:39:12 UTC
Still true with F31.

From my experiments, Grub "retrieves its memory of saved last booted OS" when an update brings a new version of Linux. After such an update, Grub remembers the last (Fedora) booted OS... until you ask again a boot on Windows, and fall back in the same bug (saved option desperately stuck to Windows)... until the next Linux version update, and so on.

Comment 3 calaver4 2019-12-23 15:32:08 UTC
Looking in grub.cfg I've seen that the f31 section no longer use menuentry statement but use Boot Loader Specification so the savedefault function is not called.
savedefault function is the one that save your choice in grubenv file and use it the next time you boot your PC.

Windows boot section uses menuentry statement ad savedefault function si called as expected.

Comment 4 Andrew Duggan 2019-12-23 15:56:54 UTC
FWIW, I have found can get this to behave correctly, if I run a 

grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg 

after each kernel update.  I do it before the reboot just so I don't forget.

The first reboot will still have the last booted kernel selected, but after that which ever entry was selected last is the default).



While not related, I keep my UEFI partition umounted (noauto in fstab) unless doing a kernel update or the grub2-mkconfig, since hibernating between dual boot windows and fedora will corrupt that partition. (Windows doesn't have it mounted, but some Windows updates do touch it.) 

So for fedora updates I mount the UEFI partition, do the updates, run the grub2-mkconfig (reboot into the new kernel).

This way I can dual boot and hibernate between Windows and Fedora

In a ideal world, grubby would mount the efi partition, do it's updates then dismount it like Windows apparently does, but it's not an ideal world.

Comment 5 Gene Snider 2019-12-29 00:34:34 UTC
Executing "sudo grubby --set-default-index=0" after booting back to Fedora 31 from Windows seems to be a good work around on my system.  It boots into the most recent kernel on subsequent boots, until I boot Windows.

Gene

Comment 6 Fritz Elfert 2020-01-07 12:10:14 UTC
DUPLICATE of https://bugzilla.redhat.com/show_bug.cgi?id=1704926

Comment 7 Javier Martinez Canillas 2020-01-15 17:05:52 UTC

*** This bug has been marked as a duplicate of bug 1704926 ***

Comment 8 thechexmo 2020-04-04 06:19:58 UTC
Iĺl explain how i managed to fix this on my laptop

Run the following line:
sudo gedit /etc/default/grub        

Then change the following lines (if there are not, add them):
GRUB_TIMEOUT="10"            <--This might not be necessary for you but i needed to
GRUB_DEFAULT="saved"         <--This option loads the last entered entry
GRUB_SAVEDEFAULT="true"      <--This option makes grub save the entry youre bootin in


Then save and run the following to apply the changes:
sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

Comment 9 thechexmo 2020-04-04 21:36:31 UTC
(In reply to thechexmo from comment #8)
> Iĺl explain how i managed to fix this on my laptop
> 
> Run the following line:
> sudo gedit /etc/default/grub        
> 
> Then change the following lines (if there are not, add them):
> GRUB_TIMEOUT="10"            <--This might not be necessary for you but i
> needed to
> GRUB_DEFAULT="saved"         <--This option loads the last entered entry
> GRUB_SAVEDEFAULT="true"      <--This option makes grub save the entry youre
> bootin in
> 
> 
> Then save and run the following to apply the changes:
> sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg


Edit: at the time i posted that i did not realized i was having the same issue shown in bug 1704926


Note You need to log in before you can comment on or make changes to this bug.