On 29/06/21 7:16 pm, Kairui Song wrote:
After fadump embedded the fadump initramfs in the normal initramfs,
kdumpctl will mistakenly rebuild the initramfs everytime.
kdumpctl checks the hostonly-kernel-modules.txt file in initramfs
to check if required drivers are included, but the normal initramfs
is built in non-hostonly mode, so it doesn't have a
hostonly-kernel-modules.txt file. The check will always fail.
So let mkfadumprd make a copy of the hostonly-kernel-modules.txt in the
fadump initramfs and let kdumpctl check that file instead.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
Thanks for fixing this, Kairui.
Acked-by: Hari Bathini <hbathini(a)linux.ibm.com>
> ---
> kdumpctl | 8 ++++++--
> mkfadumprd | 8 ++++++--
> 2 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/kdumpctl b/kdumpctl
> index 26247d1..e4334c5 100755
> --- a/kdumpctl
> +++ b/kdumpctl
> @@ -443,9 +443,13 @@ check_drivers_modified()
>
> # Include watchdog drivers if watchdog module is not omitted
> is_dracut_mod_omitted watchdog || _new_drivers+=" $(get_watchdog_drvs)"
> -
> [ -z "$_new_drivers" ] && return 0
> - _old_drivers="$(lsinitrd $TARGET_INITRD -f
/usr/lib/dracut/hostonly-kernel-modules.txt | tr '\n' ' ')"
> +
> + if is_fadump_capable; then
> + _old_drivers="$(lsinitrd "$TARGET_INITRD" -f
/usr/lib/dracut/fadump-kernel-modules.txt | tr '\n' ' ')"
> + else
> + _old_drivers="$(lsinitrd "$TARGET_INITRD" -f
/usr/lib/dracut/hostonly-kernel-modules.txt | tr '\n' ' ')"
> + fi
>
> ddebug "Modules required for kdump: '$_new_drivers'"
> ddebug "Modules included in old initramfs: '$_old_drivers'"
> diff --git a/mkfadumprd b/mkfadumprd
> index 4af4ae6..aecf2a8 100644
> --- a/mkfadumprd
> +++ b/mkfadumprd
> @@ -44,14 +44,18 @@ fi
>
> ### Unpack the initramfs having dump capture capability
> mkdir -p "$MKFADUMPRD_TMPDIR/fadumproot"
> -if ! (pushd "$MKFADUMPRD_TMPDIR/fadumproot" > /dev/null &&
lsinitrd --unpack "$MKFADUMPRD_TMPDIR/fadump.img" && \
> +if ! (pushd "$MKFADUMPRD_TMPDIR/fadumproot" > /dev/null &&
lsinitrd --unpack "$FADUMP_INITRD" && \
> popd > /dev/null); then
> derror "mkfadumprd: failed to unpack '$MKFADUMPRD_TMPDIR'"
> exit 1
> fi
>
> ### Pack it into the normal boot initramfs with zz-fadumpinit module
> -_dracut_isolate_args="--rebuild $REBUILD_INITRD --add zz-fadumpinit -i
$MKFADUMPRD_TMPDIR/fadumproot /fadumproot"
> +_dracut_isolate_args="--rebuild $REBUILD_INITRD --add zz-fadumpinit \
> + -i $MKFADUMPRD_TMPDIR/fadumproot /fadumproot \
> + -i $MKFADUMPRD_TMPDIR/fadumproot/usr/lib/dracut/hostonly-kernel-modules.txt
> + /usr/lib/dracut/fadump-kernel-modules.txt"
> +
> if is_squash_available; then
> _dracut_isolate_args="$_dracut_isolate_args --add squash"
> fi
>