bugGNU GRUB - Bugs: bug #50861, saved_entry is read from...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #50861: saved_entry is read from environment block without GRUB_DEFAULT=saved

Submitter:  xuiqzy <xuiqzy>
Submitted:  Sun 23 Apr 2017 05:40:20 PM UTC
   
 
Category:  Booting Severity:  Major
Priority:  5 - Normal Item Group:  Software Error
Status:  None Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Open Release:  other
Release:  Reproducibility:  Every Time
Planned Release:  None

Jump to the original submission

Wed 26 Apr 2017 03:05:10 AM UTC, comment #8: 

grub cannot write to btrfs, so the only solution for now is to reset next_boot when OS is booted or place /boot/grub on different FS type.

Andrei Borzenkov <arvidjaar>
Group Member
Tue 25 Apr 2017 11:12:25 PM UTC, comment #7: 

The output from grub-probe -t fs /boot/grub/grubenv is btrfs.
I can confirm that /boot is a part of my main subvolume where /, /home and everything else except /boot/efi reside on.

xuiqzy <xuiqzy>
Mon 24 Apr 2017 02:07:32 PM UTC, comment #6: 

What "grub-probe -t fs /boot/grub/grubenv" says?

Andrei Borzenkov <arvidjaar>
Group Member
Mon 24 Apr 2017 01:58:14 PM UTC, comment #5: 

[13:29:49] xuiqzy@xuiqzy-laptop /home/xuiqzy (0)

> grub-editenv - list

[13:30:22] xuiqzy@xuiqzy-laptop /home/xuiqzy (0)

> sudo grub-reboot "Firmware Setup"

[13:30:42] xuiqzy@xuiqzy-laptop /home/xuiqzy (0)

> grub-editenv - list

next_entry=Firmware Setup
-- reboot --
entered firmware setup even though grub-reboot shouldn't work with GRUB_DEFAULT not set to saved, but why else would you use grub-reboot, so maybe actually nice behavior
-- reboot --
entered firmware setup again instead of falling back to default or saved entry, totally undesirable behavior no matter what GRUB_DEFAULT is set to
-- reboot --
manually selected normal OS entry to boot into
[13:32:16] xuiqzy@xuiqzy-laptop /home/xuiqzy (0)

> grub-editenv - list

next_entry=Firmware Setup


It boots into this Firmware Setup entry until I clear the next_entry variable in the environment block.

xuiqzy <xuiqzy>
Mon 24 Apr 2017 03:25:31 AM UTC, comment #4: 

Show output of "grub-editenv - list" before grub-reboot, immediately after grub-reboot before reboot and after reboot.

Andrei Borzenkov <arvidjaar>
Group Member
Sun 23 Apr 2017 11:50:51 PM UTC, comment #3: 

Thanks for your quick reply! :)
Sorry for not describing it enough on a high level.
I am executing grub-reboot, which sets next_entry, not saved_entry as I said, sorry (checked what file was modified on disk after executing the command).
Then I reboot and the entry from grub-reboot is selected even though it shouldn't be as GRUB_DEFAULT isn't set to saved in /etc/default/grub and I did generate /boot/grub/grub.cfg in the right location afterwards.

This would probably be a nice feature: to boot into another entry while keeping the GRUB_DEFAULT fixed on a specific entry (documentation had to change).
But it doesn't revert to the entry in GRUB_DEFAULT or the entry in saved_entry, thus booting into the entry selected via grub-reboot until another one is selected in the grub boot menu directly.

Can I somehow change the title or original submission comment / description of the bug?

xuiqzy <xuiqzy>
Sun 23 Apr 2017 06:14:44 PM UTC, comment #2: 

grub-reboot does not touch saved_entry since quite some time. It is unclear what your problem actually is. Please explain your problem instead of your conclusions about what may cause it.

Andrei Borzenkov <arvidjaar>
Group Member
Sun 23 Apr 2017 05:52:23 PM UTC, comment #1: 

This would not be annoying as someone who executes grub-reboot wants to reboot to that grub entry.
But it doesn't revert back to the previous default configured in GRUB_DEFAULT, as there probably isn't another saved default, and so you have to manually intercept the GRUB menu if you are stuck with e.g. a Firmware Setup entry.

xuiqzy <xuiqzy>
Sun 23 Apr 2017 05:40:20 PM UTC, original submission:  

On Grub 2.02~rc2, when setting the saved_entry variable for example with the grub-reboot tool, the next boot this variable is read and the matching entry is booted.

But this is done regardless of the setting of GRUB_DEFAULT, which should control this setting according to the documentation. It's the same behavior whether it's set to a specific menuentry or to 0 (as in the example below).

When generating the grub.cfg config file the following code is generated, which is probably the problematic part:

if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

xuiqzy <xuiqzy>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by arvidjaar (Posted a comment)
  • -email is unavailable- added by xuiqzy (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code