From ecbdff68af39ccbf91ca2ea553b168588fc870f1 Mon Sep 17 00:00:00 2001 From: Topi Miettinen Date: Wed, 26 Feb 2020 14:48:18 +0200 Subject: [PATCH] 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 --- dracut.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 -- 2.47.3