From: Topi Miettinen Date: Wed, 26 Feb 2020 12:48:18 +0000 (+0200) Subject: Don't resolve libraries lazily if tmpdir is mounted with 'noexec' X-Git-Tag: 050~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ecbdff68af39ccbf91ca2ea553b168588fc870f1;p=thirdparty%2Fdracut.git Don't resolve libraries lazily if tmpdir is mounted with 'noexec' If the temporary directory for images is mounted with 'noexec', dracut would construct unbootable images because most dynamic libraries aren't installed. Avoid this by not resolving library dependencies lazily if the temporary directory is mounted with 'noexec'. Signed-off-by: Topi Miettinen --- diff --git a/dracut.sh b/dracut.sh index 908d34481..3219dd86a 100755 --- a/dracut.sh +++ b/dracut.sh @@ -945,6 +945,12 @@ readonly TMPDIR="$(realpath -e "$tmpdir")" printf "%s\n" "dracut: Invalid tmpdir '$tmpdir'." >&2 exit 1 } + +if findmnt --raw -n --target "$tmpdir" --output=options | grep -q noexec; then + [[ $debug == yes ]] && printf "%s\n" "dracut: Tmpdir '$tmpdir' is mounted with 'noexec'." + noexec=1 +fi + readonly DRACUT_TMPDIR="$(mktemp -p "$TMPDIR/" -d -t dracut.XXXXXX)" [ -d "$DRACUT_TMPDIR" ] || { printf "%s\n" "dracut: mktemp -p '$TMPDIR/' -d -t dracut.XXXXXX failed." >&2 @@ -969,7 +975,7 @@ if [[ $early_microcode = yes ]] || ( [[ $acpi_override = yes ]] && [[ -d $acpi_t mkdir "$early_cpio_dir" fi -[[ -n "$dracutsysrootdir" ]] || export DRACUT_RESOLVE_LAZY="1" +[[ -n "$dracutsysrootdir" || "$noexec" ]] || export DRACUT_RESOLVE_LAZY="1" if [[ $print_cmdline ]]; then stdloglvl=0