From: Daan De Meyer Date: Sat, 6 Jul 2024 19:02:31 +0000 (+0200) Subject: Various fixes for grub packages in default tools trees X-Git-Tag: v24~52^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7120b08fd5e2b7acb153cdcd8ca3b740abd338d4;p=thirdparty%2Fmkosi.git Various fixes for grub packages in default tools trees - Install grub2-tools on all architectures on CentOS/Fedora instead of just x86-64. - Only install grub-pc-bin on x86-64 on Debian/Ubuntu as it is not available on other architectures - Install grub-common instead of grub2 as grub-common contains all the binaries we need and grub2 configures the system to use grub as the bootloader which we don't want when these packages might be installed on user's systems via mkosi dependencies. - Do not install grub2 on OpenSUSE due to the same problem, it configures the system to use grub as the bootloader which we don't want. Unfortunately there is no subpackage with only the grub binaries on OpenSUSE. Reported as https://bugzilla.opensuse.org/show_bug.cgi?id=1227464. The tests are changed to not try to build or boot opensuse images with bios. --- diff --git a/mkosi.conf.d/15-x86-64.conf b/mkosi.conf.d/15-x86-64.conf index 5603cb84a..1b0c4b30c 100644 --- a/mkosi.conf.d/15-x86-64.conf +++ b/mkosi.conf.d/15-x86-64.conf @@ -2,6 +2,10 @@ [Match] Architecture=x86-64 +# We cannot install the grub tools in the OpenSUSE tools tree due to +# https://bugzilla.opensuse.org/show_bug.cgi?id=1227464. +# TODO: Remove this again when the above bug is resolved. +ToolsTreeDistribution=!opensuse [Content] @BiosBootloader=grub diff --git a/mkosi/resources/mkosi-tools/mkosi.conf.d/10-centos-fedora/mkosi.conf b/mkosi/resources/mkosi-tools/mkosi.conf.d/10-centos-fedora/mkosi.conf index d78c79485..dc1e4913c 100644 --- a/mkosi/resources/mkosi-tools/mkosi.conf.d/10-centos-fedora/mkosi.conf +++ b/mkosi/resources/mkosi-tools/mkosi.conf.d/10-centos-fedora/mkosi.conf @@ -12,6 +12,7 @@ Packages= createrepo_c dnf-plugins-core git-core + grub2-tools openssh-clients policycoreutils python3-cryptography diff --git a/mkosi/resources/mkosi-tools/mkosi.conf.d/10-debian-ubuntu/mkosi.conf b/mkosi/resources/mkosi-tools/mkosi.conf.d/10-debian-ubuntu/mkosi.conf index 1b0a8f9c3..b72e86f4e 100644 --- a/mkosi/resources/mkosi-tools/mkosi.conf.d/10-debian-ubuntu/mkosi.conf +++ b/mkosi/resources/mkosi-tools/mkosi.conf.d/10-debian-ubuntu/mkosi.conf @@ -15,7 +15,7 @@ Packages= debian-archive-keyring erofs-utils git-core - grub2 + grub-common libarchive-tools libcryptsetup12 libtss2-dev diff --git a/mkosi/resources/mkosi-tools/mkosi.conf.d/10-centos-fedora/mkosi.conf.d/10-grub.conf b/mkosi/resources/mkosi-tools/mkosi.conf.d/10-debian-ubuntu/mkosi.conf.d/grub.conf similarity index 82% rename from mkosi/resources/mkosi-tools/mkosi.conf.d/10-centos-fedora/mkosi.conf.d/10-grub.conf rename to mkosi/resources/mkosi-tools/mkosi.conf.d/10-debian-ubuntu/mkosi.conf.d/grub.conf index 0cff30f4a..2ab4230d4 100644 --- a/mkosi/resources/mkosi-tools/mkosi.conf.d/10-centos-fedora/mkosi.conf.d/10-grub.conf +++ b/mkosi/resources/mkosi-tools/mkosi.conf.d/10-debian-ubuntu/mkosi.conf.d/grub.conf @@ -5,4 +5,4 @@ Architecture=x86-64 [Content] Packages= - grub2-tools + grub-pc-bin diff --git a/mkosi/resources/mkosi-tools/mkosi.conf.d/10-opensuse.conf b/mkosi/resources/mkosi-tools/mkosi.conf.d/10-opensuse.conf index c48f44248..f0dc0e052 100644 --- a/mkosi/resources/mkosi-tools/mkosi.conf.d/10-opensuse.conf +++ b/mkosi/resources/mkosi-tools/mkosi.conf.d/10-opensuse.conf @@ -16,7 +16,6 @@ Packages= git-core glibc-gconv-modules-extra grep - grub2 openssh-clients ovmf patterns-base-minimal_base diff --git a/mkosi/resources/mkosi.md b/mkosi/resources/mkosi.md index be8a943ee..5521f46a9 100644 --- a/mkosi/resources/mkosi.md +++ b/mkosi/resources/mkosi.md @@ -1505,6 +1505,7 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`, | `findutils` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | `git` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | `grep` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | + | `grub-tools` | ✓ | ✓ | ✓ | ✓ | ✓ | | | `jq` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | `kmod` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | `less` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | diff --git a/tests/test_boot.py b/tests/test_boot.py index 478cf4920..491011d16 100644 --- a/tests/test_boot.py +++ b/tests/test_boot.py @@ -68,7 +68,9 @@ def test_format(config: ImageConfig, format: OutputFormat) -> None: if have_vmspawn() and format in (OutputFormat.disk, OutputFormat.directory): image.vmspawn(options=options) - if format != OutputFormat.disk: + # TODO: Remove the opensuse check again when https://bugzilla.opensuse.org/show_bug.cgi?id=1227464 is resolved + # and we install the grub tools in the openSUSE tools tree again. + if format != OutputFormat.disk or config.tools_tree_distribution == Distribution.opensuse: return image.qemu(options=options + ["--qemu-firmware=bios"]) @@ -79,6 +81,11 @@ def test_bootloader(config: ImageConfig, bootloader: Bootloader) -> None: if config.distribution == Distribution.rhel_ubi: return + # TODO: Remove this again when https://bugzilla.opensuse.org/show_bug.cgi?id=1227464 is resolved and we install + # the grub tools in the openSUSE tools tree again. + if bootloader == Bootloader.grub and config.tools_tree_distribution == Distribution.opensuse: + return + firmware = QemuFirmware.linux if bootloader == Bootloader.none else QemuFirmware.auto with Image(