snapshotmanager / boom-boot

Boom Boot Manager
GNU General Public License v2.0
30 stars 4 forks source link

Users of distributions that support grub_* optional keys need to enable them manually #9

Closed bmr-cymru closed 1 year ago

bmr-cymru commented 2 years ago

Boom supports optional extensions to the Boot Loader Specification that define new keys. This includes the three "grub_" optional keys available on Red Hat and Fedora systems. Currently a user needs to manually enable any optional keys in an OsProfile in order to be able to use them in a boot entry:

# boom create --title 10 --grub-arg 172 --root-lv /dev/snapper/boom_snap
Profile with os_id='9a774ee' does not support --grub-arg

This is a requirement since these keys are not part of the BLS, and are not required to be supported by a compliant implementation: to avoid creating unbootable BLS entries on such systems an OsProfile must explicitly opt in to the optional keys:

# boom profile create --from-host --optional-keys "grub_arg grub_users grub_class"
Created profile with os_id e0ef3eb:
  OS ID: "e0ef3ebf3862de64e4082062f0063422796dcca6",
  Name: "Red Hat Enterprise Linux", Short name: "rhel",
  Version: "9.0 (Plow)", Version ID: "9.0",
  Kernel pattern: "/vmlinuz-%{version}", Initramfs pattern: "/initramfs-%{version}.img",
  Root options (LVM2): "rd.lvm.lv=%{lvm_root_lv}",
  Root options (BTRFS): "rootflags=%{btrfs_subvolume}",
  Options: "root=%{root_device} ro %{root_opts}",
  Title: "%{os_name} %{os_version_id} (%{version})",
  Optional keys: "grub_arg grub_users grub_class", UTS release pattern: "el9"

# boom create --title "Boom Grub Optional Keys Test" --grub-users "foo bar" --root-lv rhel/root
Created entry with boot_id 3b7bb70:
  title Boom Grub Optional Keys Test
  machine-id 68f613d8774e41e792fad28212cfedae
  version 5.14.0-70.13.1.el9_0.x86_64
  linux /vmlinuz-5.14.0-70.13.1.el9_0.x86_64
  initrd /initramfs-5.14.0-70.13.1.el9_0.x86_64.img
  options root=/dev/rhel/root ro rd.lvm.lv=rhel/root
  grub_users foo bar
  grub_arg --unrestricted
  grub_class kernel

It's possible to modify an OsProfile after creation to enable these keys:

# boom profile edit f44fb52 --optional-keys "grub_users grub_class grub_arg"
Edited profile:
  OS ID: "f44fb528ff8360ad67e2fe0274750b838da0bd6a",
  Name: "Red Hat Enterprise Linux", Short name: "rhel",
  Version: "8.1 (Ootpa)", Version ID: "8.1",
  Kernel pattern: "/vmlinuz-%{version}", Initramfs pattern: "/initramfs-%{version}.img",
  Root options (LVM2): "rd.lvm.lv=%{lvm_root_lv}",
  Root options (BTRFS): "rootflags=%{btrfs_subvolume}",
  Options: "root=%{root_device} ro %{root_opts}",
  Title: "%{os_name} %{os_version_id} (%{version})",
  Optional keys: "grub_users grub_class grub_arg", UTS release pattern: "el8"

But these are very low-level details to expect users to know and memorise, just in order to create new boot entries. We already have a heuristic to automatically set the UTS release pattern for Red Hat and Fedora distributions so it seems reasonable that --from-host should be able to automatically enable these optional keys for those distributions.

bmr-cymru commented 1 year ago

Fixed in commit 0cb2d8d