From 1ff783d867ae9914860f85d854f5151e5bd379d8 Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Sun, 12 May 2024 17:07:02 +0200 Subject: [PATCH] fix: partitioning: disable `orphan_file` (`FEATURE_C12`) for ext4 filesystems on 1.47+ e2fsprogs host - otherwise: ``` fsck.ext4 -a -C0 /dev/mmcblk0p1 /dev/mmcblk0p1 has unsupported feature(s): FEATURE_C12 e2fsck: Get a newer version of e2fsck! ``` - `orphan_file` can only be disabled on recent-enough e2fsprogs, thus check version and compare --- lib/functions/image/partitioning.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh index 52dbb597fc..3ef3010029 100644 --- a/lib/functions/image/partitioning.sh +++ b/lib/functions/image/partitioning.sh @@ -39,6 +39,19 @@ function prepare_partitions() { # parttype[nfs] is empty mkopts[ext4]="-q -m 2" # for a long time we had '-O ^64bit,^metadata_csum' here + # Hack: newer versions of e2fsprogs in combination with recent kernels enable orphan_file (FEATURE_C12) by default; that can't be handled by older versions of e2fsprogs + # at the same time, older versions don't know about orphan_file at all, so we can't simply disable for all. + # run & parse the version of e2fsprogs to determine if we need to disable orphan_file + declare e2fsprogs_version + e2fsprogs_version=$(e2fsck -V 2>&1 | head -1 | cut -d " " -f 2 | xargs echo -n) + # use linux-version compare to check if the version is at least 1.47 + if linux-version compare "${e2fsprogs_version}" ge "1.47"; then + display_alert "e2fsprogs version" "$e2fsprogs_version supports orphan_file" "info" + mkopts[ext4]="-q -m 2 -O ^orphan_file" + else + display_alert "e2fsprogs version" "$e2fsprogs_version does not support orphan_file" "info" + fi + # mkopts[fat] is empty mkopts[ext2]='' # mkopts[f2fs] is empty