From 941b18d0f2536be860142e4a260aefa7aa5b4a06 Mon Sep 17 00:00:00 2001 From: Jo Zzsi Date: Sun, 28 Dec 2025 09:11:45 -0500 Subject: [PATCH] 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 --- dracut.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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. -- 2.47.3