From 54a5bcc4ee86f8647fbe4c3766910fb28add5cac Mon Sep 17 00:00:00 2001 From: Xunlei Pang Date: Fri, 7 Jul 2017 15:48:56 +0800 Subject: [PATCH] mkdumprd: omit crypt when there is no crypt kdump target Resolves: bz1451717 https://bugzilla.redhat.com/1451717 When there is no crypt related kdump target, we can safely omit "crypt" dracut module, this can avoid the pop asking disk password during kdump boot in some cases. This patch introduces omit_dracut_modules() before calling dracut, we can omit more modules to reduce initrd size in the future. We don't want to omit any module for fadump, thus we move is_fadump_capable() into kdump-lib.sh as a helper to use. Signed-off-by: Xunlei Pang Acked-by: Dave Young --- kdump-lib.sh | 12 ++++++++++++ kdumpctl | 12 ------------ mkdumprd | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/kdump-lib.sh b/kdump-lib.sh index a33f172..3f0af91 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -6,6 +6,7 @@ DEFAULT_PATH="/var/crash/" FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" +FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" perror_exit() { echo $@ >&2 @@ -481,3 +482,14 @@ get_dracut_args_target() { echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f1 } + +is_fadump_capable() +{ + # Check if firmware-assisted dump is enabled + # if no, fallback to kdump check + if [ -f $FADUMP_ENABLED_SYS_NODE ]; then + rc=`cat $FADUMP_ENABLED_SYS_NODE` + [ $rc -eq 1 ] && return 0 + fi + return 1 +} diff --git a/kdumpctl b/kdumpctl index ff7d01c..9a0385c 100755 --- a/kdumpctl +++ b/kdumpctl @@ -13,7 +13,6 @@ DUMP_TARGET="" DEFAULT_INITRD="" DEFAULT_INITRD_BAK="" TARGET_INITRD="" -FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered" #kdump shall be the default dump mode DEFAULT_DUMP_MODE="kdump" @@ -936,17 +935,6 @@ handle_mode_switch() fi } -is_fadump_capable() -{ - # Check if firmware-assisted dump is enabled - # if no, fallback to kdump check - if [ -f $FADUMP_ENABLED_SYS_NODE ]; then - rc=`cat $FADUMP_ENABLED_SYS_NODE` - [ $rc -eq 1 ] && return 0 - fi - return 1 -} - check_current_fadump_status() { # Check if firmware-assisted dump has been registered. diff --git a/mkdumprd b/mkdumprd index 062b033..644b5ce 100644 --- a/mkdumprd +++ b/mkdumprd @@ -372,11 +372,24 @@ check_crypt() return 1 } +crypt_exists=0 +omit_dracut_modules() +{ + # Skip fadump case + is_fadump_capable && return + + # Omit "crypt", BZ1451717 + if [ "$crypt_exists" == "0" ]; then + add_dracut_arg "--omit" "crypt" + fi +} + if ! check_resettable; then exit 1 fi if ! check_crypt; then + crypt_exists=1 echo "Warning: Encrypted device is in dump path. User will prompted for password during second kernel boot." fi @@ -461,6 +474,8 @@ then add_dracut_arg "--add-drivers" "$extra_modules" fi +omit_dracut_modules + dracut "${dracut_args[@]}" "$@" _rc=$? sync