From: Jo Zzsi Date: Sun, 28 Dec 2025 14:11:45 +0000 (-0500) Subject: feat(dracut): disable xattr when creating cpios X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=941b18d;p=thirdparty%2Fdracut-ng.git feat(dracut): disable xattr when creating cpios Disable xattr when creating cpio, but do not change the default for squashfs/erofs. Move setting the default for DRACUT_CP later in the code to account for the newly set defaults. Fixes: https://github.com/dracut-ng/dracut-ng/issues/1561 --- diff --git a/dracut.sh b/dracut.sh index d8dbcc5c8..f8a8954fa 100755 --- a/dracut.sh +++ b/dracut.sh @@ -1477,12 +1477,6 @@ fi export LC_MESSAGES=C kernel -if [[ $EUID == "0" ]] && ! [[ ${DRACUT_NO_XATTR-} ]]; then - export DRACUT_CP="cp --reflink=auto --preserve=mode,timestamps,xattr,links -dfr" -else - export DRACUT_CP="cp --reflink=auto --preserve=mode,timestamps,links -dfr" -fi - if ! [[ ${dracutbasedir-} ]]; then dracutbasedir=${BASH_SOURCE[0]%/*} [[ $dracutbasedir == dracut-functions* ]] && dracutbasedir="." @@ -2784,6 +2778,17 @@ fi dracut_module_included "squash-lib" && mkdir -p "$squashdir" +# disable xattr when creating cpio, but do not change the default for squashfs/erofs +if ! dracut_module_included "squash-lib"; then + export DRACUT_NO_XATTR="${DRACUT_NO_XATTR:=1}" +fi + +if [[ $EUID == "0" ]] && ! [[ ${DRACUT_NO_XATTR-} ]]; then + export DRACUT_CP="cp --reflink=auto --preserve=mode,timestamps,xattr,links -dfr" +else + export DRACUT_CP="cp --reflink=auto --preserve=mode,timestamps,links -dfr" +fi + _isize=0 #initramfs size modules_loaded=" " # Allow all modules to update the config. Do this before installing anything.