Antynea / grub-btrfs

Include btrfs snapshots at boot options. (Grub menu)
GNU General Public License v3.0
688 stars 73 forks source link

Add support for GRUB patches from SUSE #321

Closed StollD closed 3 months ago

StollD commented 4 months ago

Some GRUBs out there (Fedora, openSUSE) have an option that makes all paths relative to the default subvolume of the filesystem. This can be used to include /boot in your snapshots and roll them back without having to regenerate grub.cfg.

However, enabling that option will break grub-btrfs, because loading the kernel from a different snapshot requires the paths to be absolute. To make this work, GRUB has to be told explicitly to access the root subvolume when booting to a snapshot.

I hope this is acceptable, because it's essentially a workaround for a downstream patch of GRUB.

Schievel1 commented 4 months ago

hm, if that is a downsteam patch some distros apply to grub, couldn't this PR be applied as a downstream patch for those distros as well? I mean when the package is created.

StollD commented 4 months ago

I can only speak about Fedora, but grub-btrfs is not packaged there. I've been installing it with make install, so I figured I would propose this here. Especially since I don't know if it might apply to any other distro out there.

Schievel1 commented 3 months ago

I have been considering this for a while now, but in the end I think grub-btrfs should stay distro agnostic. Nevertheless this would work for me if you name the variable a bit different (not mentioning a distro but instead describe what it actually does) and maybe add a few lines about that feature in the readme.

StollD commented 3 months ago

I just noticed that I never actually linked the patchset I am talking about, so I'd like to apologize for that.

The SUSE_BTRFS_SNAPSHOT_BOOTING variable is not defined by me, it is defined by the patchset itself and enables the behaviour I described. I can't change its name, and I wouldn't want to document it in the readme because it is not defined by grub-btrfs.

I can add a comment or reword the commit to better explain the purpose of that variable though, whatever you prefer.

Schievel1 commented 3 months ago

ooh so this is not something the grub-btrfs user has to set in the config, it is available to all scripts in /etc/grub.d?

StollD commented 3 months ago

Yeah, it is set in /etc/default/grub