All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Chang <mchang@suse.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: RFC: A partition for grubenv, etc.
Date: Wed, 26 May 2021 17:16:21 +0800	[thread overview]
Message-ID: <20210526091621.GB3985@mercury> (raw)
In-Reply-To: <CAJCQCtRkJ+LJB2CMg=meqn4jsV08wWPwf26DtBFAvOFcGYfH5A@mail.gmail.com>

On Tue, May 25, 2021 at 04:58:23PM -0600, Chris Murphy wrote:
> Hi,
> 
> It's not possible for GRUB pre-boot environment to write to grubenv
> when it's on Btrfs, ZFS, LVM, mdadm raid, or LUKS. Also, at least XFS
> upstream is super skeptical of anything except kernel code making any
> kind of modification inside the file system region, and I suspect it's
> the same concern with ext4 developers too. While there are file system
> specific locations for bootloader usage, they're all different and
> quite small. XFS has none. ext4 has 512 bytes. Btrfs has maybe 1 or 2
> MiB, ZFS (?), mdadm (?) and LVM (?).
> 
> Proposal: A new partition type for MBR and GPT, functionally a
> replacement for the BIOS Boot partition, but it would be a partition
> owned by the bootloader for whatever it wants to use it for. It'd be
> up to the bootloader to figure out how to segment it for bootloader
> and environmental portions. We definitely need both MBR and GPT
> partition types, it should be a partition exclusively reserved for the
> bootloader. This effectively deprecates the use of the MBR gap, and
> BIOS Boot partition types, and further it deprecates the use of file
> systems (all of them, for consistency sake) for the use of grubenv.
> 
> Variation: Keep BIOS Boot and repurpose it to include grubenv, while
> also specifying an MBR type code for its equivalent.

The grubenv should be treated as property per grub.cfg, not per image.
This means that the grubenv partition may have to be divided into slots
to store settings for each and every grub.cfg, and then additional data
to record the change (add/removal) and identification - which sounds
like to work out a filesystem.

So the question is why not use filesystem writable by grub for the
proposed grubenv partition ? For UEFI we already have one, the EFI
System Partition.

Thanks,
Michael

> 
> 
> Use case: For example, Fedora has a "hidden grub menu" feature where
> by a variable in grubenv is reset (written to) by grub pre-boot. And
> then a systemd unit changes that variable to indicate a successful
> boot once some time and/or tests have been met. If grubenv indicates
> successful boot, the next boot's grub menu is hidden. If it wasn't
> successful the next boot's grub menu is displayed. It's only possible
> to achieve this with some reliable bidirectional way of communicating
> between the preboot and booted environments, which is the point of
> grubenv, but it can't work much of the time due to the above
> limitations.
> 
> -- 
> Chris Murphy
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel



  parent reply	other threads:[~2021-05-26  9:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25 22:58 RFC: A partition for grubenv, etc Chris Murphy
2021-05-26  8:07 ` Konrad Rzeszutek Wilk
2021-05-26  8:35   ` Toomas Soome
2021-05-27  2:23   ` Chris Murphy
2021-05-26  9:16 ` Michael Chang [this message]
2021-05-27  2:36   ` Chris Murphy
2021-05-27  8:59     ` Michael Chang
2021-05-27 18:49       ` Luiz Angelo Daros de Luca
2021-05-27 23:10         ` Chris Murphy
2021-05-28  3:42         ` Michael Chang
2021-05-27 22:08       ` Chris Murphy
2021-07-28 12:23         ` Daniel Kiper
2021-09-24  2:59           ` Chris Murphy
2021-10-26 14:22             ` Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210526091621.GB3985@mercury \
    --to=mchang@suse.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.