[Top][All Lists]

[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: Ulf Zibis
Subject: Re: GRUB_DEFAULT=saved with GRUB_SAVEDEFAULT=true doesn't work here
Date: Thu, 21 Oct 2021 20:32:04 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

Am 21.10.21 um 19:57 schrieb Andrei Borzenkov:

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

Much thanks for your examination.

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.

I think, not "configfile" should clear $chosen, as I understand it as "include".

Even without "configfile" we have 2 situations:
menuentry AAA {
    menuentry BBB {
submenu AAA {
    menuentry BBB {

So the logic could be, that "menuentry" should clear $chosen if not enclosed from 
What you think?

So it seems, that I still should use "menuentry" in the primary grub.cfg and should unset $chosen (or better 
clear with "$chosen=" ?) inside the "menuentry" before I execute "configfile", as a 


reply via email to

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