help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GRUB_DEFAULT=saved with GRUB_SAVEDEFAULT=true doesn't work here


From: Andrei Borzenkov
Subject: Re: GRUB_DEFAULT=saved with GRUB_SAVEDEFAULT=true doesn't work here
Date: Thu, 21 Oct 2021 20:57:14 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 21.10.2021 18:40, Ulf Zibis wrote:
> 
> Am 17.10.21 um 08:57 schrieb Andrei Borzenkov:
>> On 16.10.2021 20:51, Ulf Zibis wrote:
>>> Yes, this makes sense, why the timeout doesn't work as expected. Thanks
>>> for your hint.
>>>
>>> But it doesn't explain, why the saved default menu coḿes not in use.
>>>
>>> I suspect, if you have noticed my alternative grub.cfg far below. Please
>>> also have a look ...
>>>
>> I am not a sorcerer. At the very least show content of grubenv in both
>> primary partition and rhis one.
> 
> The primary one shows:
> # GRUB Environment Block
> recordfail=1
> saved_entry=Menü von Ubuntu-32 18.04 auf
> /dev/sda9>gnulinux-simple-ec7ee724-6bed-4ee0-8056-8ecf44bb46b9
> ####################################...
> But this file is 4 weeks old, so currently seems not in use.
> 
> With nothing chosen, the secondary one on /dev/sda9 shows:
> # GRUB Environment Block
> saved_entry=Menü von Ubuntu-32 18.04 auf
> /dev/sda9>gnulinux-simple-ec7ee724-6bed-4ee0-8056-8ecf44bb46b9
> ####################################...
> This is menu 0 in /dev/sda9/boot/grub/grub.cfg
> 
> If I have chosen submenu 1 + menu 0 the secondary one on /dev/sda9 shows:
> # GRUB Environment Block
> saved_entry=Menü von Ubuntu-32 18.04 auf
> /dev/sda9>gnulinux-advanced-ec7ee724-6bed-4ee0-8056-8ecf44bb46b9>gnulinux-4.15.0-161-generic-advanced-ec7ee724-6bed-4ee0-8056-8ecf44bb46b9
> 

That's wrong from the perspective of grub.cfg on sda9. It does not have
any submenu with the name "Menü von Ubuntu-32 18.04 auf /dev/sda9", so
$saved_entry never matches any existing menu entry and grub defaults to
the very first one.

Quick fix is to unset variable "chosen" in grub.cfg on sda9. It can
actually be anywhere outside (sub-)menu entries, as the value is used
only when grub actually executes menu entry.

The problem is, grub constructs the value of $chosen variable when it
executes menu entry - it appends its ID (or name if ID is not defined)
to existing value thus building full path from the top. This variable is
also exported. When grub executes "configfile" command it retains all
exported variables, so value of "$chosen" becomes wrong in the inner
configfile.

This sounds like a bug. Command "configfile" starts with new empty menu;
so any reference to previous menu entry is by definition invalid. It
should clear $chosen as well at the same time.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]