diff --git a/kdumpctl b/kdumpctl index 690584e..7f82f4f 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1597,6 +1597,12 @@ reset_crashkernel() fi } +# to tell if it's package install other than upgrade +_is_package_install() +{ + [[ -f /tmp/kexec_tools_package_install ]] +} + # update the crashkernel value in GRUB_ETC_DEFAULT if necessary # # called by reset_crashkernel_after_update and inherit its array variable @@ -1606,6 +1612,10 @@ update_crashkernel_in_grub_etc_default_after_update() local _crashkernel _fadump_val local _dump_mode _old_default_crashkernel _new_default_crashkernel + if _is_package_install; then + return + fi + _crashkernel=$(_read_kernel_arg_in_grub_etc_default crashkernel) if [[ -z $_crashkernel ]]; then @@ -1681,6 +1691,12 @@ reset_crashkernel_for_installed_kernel() local _installed_kernel _running_kernel _crashkernel _crashkernel_running local _dump_mode_running _fadump_val_running + # During package install, only try to reset crashkernel for osbuild + # thus to avoid calling grubby when installing os via anaconda + if _is_package_install && ! _is_osbuild; then + return + fi + if ! _installed_kernel=$(_find_kernel_path_by_release "$1"); then exit 1 fi diff --git a/kexec-tools.spec b/kexec-tools.spec index ba9f0ea..c9c1ce7 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -265,6 +265,11 @@ if [ ! -f /run/ostree-booted ] && [ $1 == 2 ] && grep -q get-default-crashkernel kdumpctl get-default-crashkernel fadump > /tmp/old_default_crashkernel_fadump 2>/dev/null %endif fi +# indicate it's package install so kdumpctl later will only reset crashkernel +# value for osbuild. +if [ $1 == 1 ]; then + touch /tmp/kexec_tools_package_install +fi # don't block package update :