Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=2243068
Currently, when kexec-tools is installed, the kernel will automatically
have the crashkernel parameter set up. In the case where users only want
the kexec reboot feature, this is not what users want as a 1G-RAM system
will lose 192M memory. Considering Fedora's systemd preset policy has
kdump.service disabled and RHEL' has kdump.service enabled, this patch
makes kexec-tools only reset crashkernel when kdump.service is enabled.
Reported-by: Chris Murphy <bugzilla(a)colorremedies.com>
Cc: Philipp Rudo <prudo(a)redhat.com>
Cc: Adam Williamson <awilliam(a)redhat.com>
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
kdumpctl | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index b6d5994d..01433e28 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1649,6 +1649,10 @@ reset_crashkernel_for_installed_kernel()
_update_crashkernel "$_installed_kernel"
}
+_should_reset_crashkernel() {
+ [[ $(kdump_get_conf_val auto_reset_crashkernel) != no ]] && systemctl is-enabled
kdump &> /dev/null
+}
+
main()
{
# Determine if the dump mode is kdump or fadump
@@ -1715,12 +1719,12 @@ main()
reset_crashkernel "$@"
;;
_reset-crashkernel-after-update)
- if [[ $(kdump_get_conf_val auto_reset_crashkernel) != no ]]; then
+ if _should_reset_crashkernel; then
reset_crashkernel_after_update
fi
;;
_reset-crashkernel-for-installed_kernel)
- if [[ $(kdump_get_conf_val auto_reset_crashkernel) != no ]]; then
+ if _should_reset_crashkernel; then
reset_crashkernel_for_installed_kernel "$2"
fi
;;
--
2.41.0