From: Daan De Meyer Date: Fri, 10 Mar 2023 15:07:59 +0000 (+0100) Subject: centos: Only enable supported ext4 filesystem features on C8S X-Git-Tag: v15~300 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f29ab1ca8ff4bddbc5fd194c85545da49d6fb67;p=thirdparty%2Fmkosi.git centos: Only enable supported ext4 filesystem features on C8S Fixes #1378 --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index cf8bfa266..91da303a7 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -3141,8 +3141,12 @@ def invoke_repart(state: MkosiState, skip: Sequence[str] = [], split: bool = Fal cmdline += ["--definitions", definitions] + env = dict(TMPDIR=str(state.workspace)) + for fs, options in state.installer.filesystem_options(state).items(): + env[f"SYSTEMD_REPART_MKFS_OPTIONS_{fs.upper()}"] = " ".join(options) + with complete_step("Generating disk image"): - output = json.loads(run(cmdline, stdout=subprocess.PIPE, env={"TMPDIR": state.workspace}).stdout) + output = json.loads(run(cmdline, stdout=subprocess.PIPE, env=env).stdout) roothash = usrhash = None for p in output: diff --git a/mkosi/distributions/__init__.py b/mkosi/distributions/__init__.py index 1243a9025..ded241a59 100644 --- a/mkosi/distributions/__init__.py +++ b/mkosi/distributions/__init__.py @@ -39,6 +39,10 @@ class DistributionInstaller: def filesystem(cls) -> str: raise NotImplementedError + @classmethod + def filesystem_options(cls, state: "MkosiState") -> dict[str, list[str]]: + return {} + @staticmethod def kernel_command_line(state: "MkosiState") -> list[str]: return [] diff --git a/mkosi/distributions/centos.py b/mkosi/distributions/centos.py index e821dc17f..7a9cb6dda 100644 --- a/mkosi/distributions/centos.py +++ b/mkosi/distributions/centos.py @@ -38,6 +38,18 @@ class CentosInstaller(DistributionInstaller): # https://marc.info/?l=linux-xfs&m=167450838316386&w=2. return "ext4" + @classmethod + def filesystem_options(cls, state: MkosiState) -> dict[str, list[str]]: + # Hard code the features from /etc/mke2fs.conf from CentOS 8 Stream to ensure that filesystems + # created on distros with newer versions of e2fsprogs are compatible with e2fsprogs from CentOS + # Stream 8. + + return { + "8": { + "ext4": ["-O", "none,has_journal,extent,huge_file,flex_bg,metadata_csum,64bit,dir_nlink,extra_isize"], + }, + }.get(state.config.release, {}) + @staticmethod def kernel_command_line(state: MkosiState) -> list[str]: kcl = []