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: Sun, 17 Oct 2021 09:57:54 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 16.10.2021 20:51, Ulf Zibis wrote:
> 
> Am 16.10.21 um 18:14 schrieb Andrei Borzenkov:
>> On 16.10.2021 18:23, Ulf Zibis wrote:
>>> /dev/sda9/boot/grub/grub.cfg (( created by "sudo update-grub" ))
>>> <=========================================================
>>> #
>>> # DO NOT EDIT THIS FILE
>>> #
>>> # It is automatically generated by grub-mkconfig using templates
>>> # from /etc/grub.d and settings from /etc/default/grub
>>> #
>>>
>>> ### BEGIN /etc/grub.d/00_header ###
>>> if [ -s $prefix/grubenv ]; then
>> Your boot setup is rather unclear but assuming your have three
>> partitions, and each partition has its own /boot/grub - "configfile"
>> command does not change $prefix variable. So every loaded config file
>> continues to refer to /boot/grub of your primary grub instance.
> 1. Your assumption is correct.
> 2. Except in the 1st partition, there is no x86_64-efi folder in
> /boot/grub/, so no grub instance can run from there.
> 3. But what is the problem, when always /boot/grub/grubenv of the
> primary partition is used to load and save the last selected menu nr.?
> 
>>>    set have_grubenv=true
>>>    load_env
>>> fi
> 
> [.......]
> 
>>> terminal_output gfxterm
>>> if [ "${recordfail}" = 1 ] ; then
>>>    set timeout=30
>> This could be one reason. recordfail stores variable in primary grubenv,
>> but boot script that runs in this Linux instance tries to clear it in
>> different grubenv. So after you have booted this Linux instance once,
>> recordfail variable is stuck in primary grubenv.
> 
> 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. Check environment variables during boot
- are they set as you expect them?

>>> Both are existant:
>>> - /dev/sda1/boot/grub/grubenv
>>> - /dev/sda9/boot/grub/grubenv
>>>
>>> With the alternative below, at least "GRUB_TIMEOUT=5" works as expected,
>>> but "GRUB_DEFAULT=saved" never works.
>>>
>>> /dev/sda1/boot/grub/grub.cfg (( Version 2 ))
>>> <=========================================================
>>> [.......]
>>> menuentry "Menü von Ubuntu-32 18.04 auf /dev/sda9" {
>>>      insmod part_gpt
>>>      insmod ext2
>>>      insmod configfile
>>>      insmod test
>>>      insmod loadenv
>>>      insmod all_video
>>>      insmod ieee1275_fb
>>>      insmod vbe
>>>      insmod vga
>>>      insmod video_bochs
>>>      insmod video_cirrus
>>>      insmod gettext
>>>      insmod gzio
>>>      insmod xzio
>>>      insmod lzopio
>>>      insmod linux
>>>      insmod linuxefi
>>>      search --no-floppy --fs-uuid --set=root
>>> ec7ee724-6bed-4ee0-8056-8ecf44bb46b9
>>>          set prefix=($root)'/boot/grub'
>>>          configfile $prefix/grub.cfg
>>>      # configfile /boot/grub/grub.cfg
>>> }
>>> [.......]
>>> =========================================================>
>>>
>>> So I'm wondering, as grubenv now seems correctly found.
>>>
>>> Does one have an idea, how to make "GRUB_DEFAULT=saved" working here?
>>>
>>> Thanks in advance,
>>> -Ulf
>>>
>>>
>>
>>
> 




reply via email to

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