From 45ca882ffcbb2ae5234b00b2f8d7a5cc5f54394b Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 30 Jul 2024 15:07:22 -0400 Subject: [PATCH] mkdumprd: Skip global config setting dracutmodules= The Fedora/RHEL bootc base images have dracut drop-ins which set `dracutmodules+=`. However that seems override explicit module inclusion on the command line, which is a dracut bug: https://github.com/rhkdump/kdump-utils/issues/11 Work around this by making our own copy of the global config, and omitting config drop-ins which trigger this behavior. I think longer term, this project should probably own its own global dracut config, actually. But that's a much larger set of work. Signed-off-by: Colin Walters --- mkdumprd | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/mkdumprd b/mkdumprd index 27eed5e3..f4290523 100644 --- a/mkdumprd +++ b/mkdumprd @@ -319,10 +319,41 @@ check_crypt() done } +temp_dracut_confdir= +# This is a workaround for dracut argument inheritance not doing +# what one would expect. xref https://issues.redhat.com/browse/RHEL-49590 +# and https://github.com/rhkdump/kdump-utils/issues/11 +maybe_synthesize_tmp_confdir() +{ + local confs + confs=$(shopt -s nullglob; echo /usr/lib/dracut/dracut.conf.d/*.conf) + if test -z "${confs}"; then + return + fi + temp_dracut_confdir=$(mktemp -d -t kdump.XXXXXX) + for c in ${confs}; do + if grep -qEe '^dracutmodules.*=' "${c}"; then + echo "Skipping system config which overrides dracutmodules: ${c}" + continue + fi + echo "Using config: ${c}" + cp -p $c ${temp_dracut_confdir}/ + done + echo "Synthesized temp configdir: ${temp_dracut_confdir}" + add_dracut_arg --confdir "${temp_dracut_confdir}" + # and now ensure dracut can't see our overrides. This relies on + # kdump.service being in a new mount namespace. + mount --bind -o ro /usr/share/empty /usr/lib/dracut/dracut.conf.d +} + if ! check_crypt; then dwarn "Warning: Encrypted device is in dump path, which is not recommended, see kexec-kdump-howto.txt for more details." fi +# Early on, synthesize our own confdir which drops system config +# that overrides dracutmodules as that causes bugs. +maybe_synthesize_tmp_confdir + # firstly get right SSH_KEY_LOCATION keyfile=$(kdump_get_conf_val sshkey) if [[ -f $keyfile ]]; then