From: Daan De Meyer Date: Tue, 14 Feb 2023 21:13:43 +0000 (+0100) Subject: centos: Mount root partition rw by default on CentOS Stream 8 X-Git-Tag: v15~325^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1349%2Fhead;p=thirdparty%2Fmkosi.git centos: Mount root partition rw by default on CentOS Stream 8 --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index e988edf6b..a396b120c 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -776,6 +776,8 @@ def install_unified_kernel(state: MkosiState, roothash: Optional[str]) -> None: else: cmdline = [] + cmdline += state.installer.kernel_command_line(state) + if roothash: cmdline += [roothash] diff --git a/mkosi/distributions/__init__.py b/mkosi/distributions/__init__.py index af42b4e0d..226d93471 100644 --- a/mkosi/distributions/__init__.py +++ b/mkosi/distributions/__init__.py @@ -33,3 +33,7 @@ class DistributionInstaller: @classmethod def filesystem(cls) -> str: raise NotImplementedError + + @staticmethod + def kernel_command_line(state: "MkosiState") -> list[str]: + return [] diff --git a/mkosi/distributions/centos.py b/mkosi/distributions/centos.py index d8fb01adc..7384ad5f1 100644 --- a/mkosi/distributions/centos.py +++ b/mkosi/distributions/centos.py @@ -37,6 +37,18 @@ class CentosInstaller(DistributionInstaller): # https://marc.info/?l=linux-xfs&m=167450838316386&w=2. return "ext4" + @staticmethod + def kernel_command_line(state: MkosiState) -> list[str]: + kcl = [] + + # systemd-gpt-auto-generator only started applying the GPT partition read-only flag to gpt-auto + # mounts from v240 onwards, while CentOS Stream 8 ships systemd v239, so we have to nudge gpt-auto to + # mount the root partition rw by default. + if state.config.bootable and int(state.config.release) <= 8: + kcl += ["rw"] + + return kcl + DistributionInstaller.kernel_command_line(state) + @classmethod @complete_step("Installing CentOS…") def install(cls, state: "MkosiState") -> None: