Add kdump dracut config

Resolves: RHEL-49590
Upstream: https://github.com/rhkdump/kdump-utils
Conflict: Yes, kexec-tools is split into 3 parts upstream, some changes should
be applied to kdump-utils Makefile, but RHEL-9 kexec-tools doesn't have that.
Also missing upstream commits:
    - 1732a3b(mkdumprd: Omit rdma module)
    - 7fec2f56(mkdumprd: simplify handling of dracut arguments)

commit dacb34341113fa925c15e28a7ce56a80dd370e2f
Author: Lichen Liu <lichliu@redhat.com>
Date:   Tue Nov 5 12:07:42 2024 +0800

    Add kdump dracut config

    In some cases, customizing the first kernel's initrd is necessary by
    modifying the dracut `omit_dracutmodules` options, such as in Bootc
    or CoreOS scenarios [1]. However, these changes can unintentionally
    break existing functionality in kdump. For instance, setting
    `omit_dracutmodules='nfs'` prevents the `nfs` module from being added.

    Additionally, some dracut configurations [2] use
    `dracutmodules+='some modules'` instead of
    `add_dracutmodules+='some modules'`. When `dracutmodules` is non-empty,
    dracut includes only the specified modules, which can result in an
    initrd that lacks necessary modules, causing kdump to fail.

    Dracut upstream support --add-confdir now, kdump can use this
    option when building kdump initramfs.

    This patch moved the hardcoded dracutmodules from mkdumprd to the new
    conf file /lib/kdump/dracut.conf.d/99-kdump.conf, it is easier to check
    and modify to omit or add certain modules. This patch also initialize
    dracutmodules to empty to avoid the influence of other configurations.

    See also:
    [1] https://github.com/rhkdump/kdump-utils/issues/11
    [2] https://issues.redhat.com/browse/RHEL-49590?focusedId=25197134&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-25197134

    Suggested-by: Dave Young <dyoung@redhat.com>
    Suggested-by: Colin Walters <walters@verbum.org>
    Signed-off-by: Lichen Liu <lichliu@redhat.com>

Signed-off-by: Lichen Liu <lichliu@redhat.com>
This commit is contained in:
Lichen Liu 2024-12-05 10:45:27 +08:00
parent 4a3b7d1337
commit 315f200ee7
No known key found for this signature in database
GPG Key ID: 2ED8215EF57B3D6C
3 changed files with 16 additions and 2 deletions

3
99-kdump.conf Normal file
View File

@ -0,0 +1,3 @@
dracutmodules=''
add_dracutmodules=' kdumpbase '
omit_dracutmodules=' plymouth resume ifcfg earlykdump '

View File

@ -46,6 +46,7 @@ Source35: kdump-migrate-action.sh
Source36: kdump-restart.sh
Source37: 60-fadump.install
Source38: supported-kdump-targets.txt
Source39: 99-kdump.conf
#######################################
# These are sources for mkdumpramfs
@ -179,7 +180,7 @@ mkdir -p -m755 $RPM_BUILD_ROOT%{_udevrulesdir}
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
mkdir -p -m755 $RPM_BUILD_ROOT%{_bindir}
mkdir -p -m755 $RPM_BUILD_ROOT%{_libdir}
mkdir -p -m755 $RPM_BUILD_ROOT%{_prefix}/lib/kdump
mkdir -p -m755 $RPM_BUILD_ROOT%{_prefix}/lib/kdump/dracut.conf.d
mkdir -p -m755 $RPM_BUILD_ROOT%{_sharedstatedir}/kdump
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/kdumpctl
@ -201,6 +202,7 @@ install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8
install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh
install -m 755 %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-initramfs.sh
install -m 755 %{SOURCE31} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-logger.sh
install -m 644 %{SOURCE39} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/dracut.conf.d/99-kdump.conf
%ifarch ppc64 ppc64le
install -m 755 %{SOURCE32} $RPM_BUILD_ROOT/usr/sbin/mkfadumprd
install -m 755 %{SOURCE35} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-migrate-action.sh

View File

@ -27,7 +27,7 @@ SAVE_PATH=$(get_save_path)
OVERRIDE_RESETTABLE=0
extra_modules=""
dracut_args=(--add kdumpbase --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict --hostonly-nics '' -o "plymouth resume ifcfg earlykdump")
dracut_args=(--quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict --hostonly-nics '')
MKDUMPRD_TMPDIR="$(mktemp -d -t mkdumprd.XXXXXX)"
[ -d "$MKDUMPRD_TMPDIR" ] || perror_exit "dracut: mktemp -p -d -t dracut.XXXXXX failed."
@ -486,6 +486,15 @@ elif ! is_fadump_capable && \
add_mount "$status_target"
fi
# Use kdump managed dracut profile.
[[ $kdump_dracut_confdir ]] || kdump_dracut_confdir=/lib/kdump/dracut.conf.d
if [[ "$(dracut --help)" == *--add-confdir* ]] && [[ -d "$kdump_dracut_confdir" ]]; then
dracut_args+=("--add-confdir" "$kdump_dracut_confdir")
else
dracut_args+=(--add kdumpbase)
dracut_args+=(--omit "plymouth resume ifcfg earlykdump")
fi
dracut "${dracut_args[@]}" "$@"
_rc=$?