grub-devel
[Top][All Lists]
Advanced

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

Re: Menu for booting BTRFS snapshots


From: Robert LeBlanc
Subject: Re: Menu for booting BTRFS snapshots
Date: Sat, 4 Mar 2017 09:34:42 -0700

On Sat, Mar 4, 2017 at 3:37 AM, Andrei Borzenkov <address@hidden> wrote:
> Отправлено с iPhone
>
>> 4 марта 2017 г., в 4:02, Robert LeBlanc <address@hidden> написал(а):
>>
>>
>> menuentry 'RXE Snapshot' {
>>       load_env -f /snaps/rxe-boot/grub2/grubenv
>>       configfile /snaps/rxe-boot/grub2/grub.cfg
>> }
>>
>
> Grub.cfg as created by grub-mkconfig loads $prefix/grubenv which overrides 
> whatever you got from your other grubenv. $prefix does not change when you 
> run different config.
>
> It is not the first time I see similar issue. I think grubenv should be 
> searched relative to current $config_directory, it is not as much property of 
> loaded binary, as property of current configuration.
>
> Could you try to change your snapshot grub.cfg this way and see if it helps? 
> You can then remove explicit grubenv load.

When I woke up this morning, I thought, maybe I need to do load_env in
the new config instead of the menuentry of the old config. Then I saw
your response with the same thing. I thought about doing some fancy
detection stuff like 10_linux does to re-export $prefix, but decided
against that as I didn't want to mess with the detected root device at
boot. I didn't need any other things like password protected boot or
anything that could need an updated $prefix, so I just took the easy
way out and did this.

--- /root/00_header     2017-03-04 09:25:34.974046629 -0700
+++ /etc/grub.d/00_header       2017-03-04 09:27:06.479049038 -0700
@@ -45,8 +45,8 @@
 cat << EOF
 set pager=1

-if [ -s \$prefix/grubenv ]; then
-  load_env
+if [ -s /snaps/rxe-boot/grub2/grubenv ]; then
+  load_env -f /snaps/rxe-boot/grub2/grubenv
 fi
 EOF
 if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then

That does exactly what I want. Thanks for the pointer.

>> # cat /mnt/btrfs/boot/grub2/grubenv
>> # GRUB Environment Block
>> saved_entry=RXE Snapshot
>> ###########################
>
> Grub-editenv list would be enough.

Didn't know about that command. Thanks.

----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904  C70E E654 3BB2 FA62 B9F1



reply via email to

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