On Thu, Jul 10, 2025 at 9:21 PM Michael Chang <mch...@suse.com> wrote: > > On Btrfs, GRUB cannot update the environment block (grubenv) because > file based writes via blocklists are incompatible with Btrfs COW (Copy > On Write) design. Although GRUB’s filesystem drivers are read only, > environment updates rely on raw block access to fixed locations, which > is not safe on Btrfs due to its dynamic block relocation. > > To address this, we introduce support for storing the GRUB environment > block in a fixed block within Btrfs reserved bootloader area, an unused > region in the device header intended for bootloader use. > > This patch adds fs_envblk helpers to grub-editenv for accessing the > reserved area directly. Variables that require runtime write access > during boot, such as next_entry, will be mirrored into this external > block. Other variables will remain stored in the file based grubenv so > they can keep per snapshot. > > The embedding logic is also updated to mark the reserved area as used to > avoid conflicts with embedded core images. > > This enables support for runtime environment updates on Btrfs root > volumes, allowing tools like grub-reboot to boot an entry once. > > Signed-off-by: Michael Chang <mch...@suse.com> > ---
Looks good to me and seems to work. Reviewed-by: Neal Gompa <ngomp...@gmail.com> -- 真実はいつも一つ!/ Always, there's only one truth! _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel