Hi Hari,
On Fri, Feb 1, 2019 at 10:55 PM Hari Bathini <hbathini(a)linux.ibm.com> wrote:
>
> When a network-based dump target is configured, the interface name is
> prefixed with 'kdump-'. While this has no consequence for production
> kernel when kdump is configured, the network interface name is changed
> for production kernel as well when fadump is configured. Avoid that
> and ensure network interface is renamed only while capturing vmcore.
>
> Signed-off-by: Hari Bathini <hbathini(a)linux.ibm.com>
> ---
>
> Changes in v2:
> * Removed network interface config files (prefixed with 'kdump-') while
> booting production kernel.
>
>
> dracut-kdump-boot.sh | 16 ++++++++++++++++
> dracut-module-setup.sh | 1 +
> kexec-tools.spec | 3 +++
> 3 files changed, 20 insertions(+)
> create mode 100644 dracut-kdump-boot.sh
>
> diff --git a/dracut-kdump-boot.sh b/dracut-kdump-boot.sh
> new file mode 100644
> index 0000000..e5b8c27
> --- /dev/null
> +++ b/dracut-kdump-boot.sh
> @@ -0,0 +1,16 @@
> +#!/bin/sh
> +
> +# An Initrd with dump capturing support can boot a production kernel
> +# as well (FADump). In such scenario, avoid enforcing such parameters
> +# in production kernel that make sense only while capturing dump.
> +[ ! -f /etc/fadump.initramfs ] && return
> +
> +if [ ! -f /proc/device-tree/rtas/ibm,kernel-dump ]; then
> + rm -f /etc/cmdline.d/40kdump-ip.conf
> + rm -f /etc/cmdline.d/41kdump-bridge.conf
> + rm -f /etc/cmdline.d/42kdump-bond.conf
> + rm -f /etc/cmdline.d/43kdump-vlan.conf
> + rm -f /etc/cmdline.d/44kdump-team.conf
> + rm -f /etc/cmdline.d/60kdumpnic.conf
> + rm -f /etc/cmdline.d/70kdump-bootdev.conf
> +fi
> diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
> index 578a7b3..09db5e9 100755
> --- a/dracut-module-setup.sh
> +++ b/dracut-module-setup.sh
> @@ -800,6 +800,7 @@ install() {
> cp "$moddir/kdump-emergency.target"
"$initdir/$systemdsystemunitdir/emergency.target"
> # Also redirect dracut-emergency to kdump error handler
> ln_r "$systemdsystemunitdir/emergency.service"
"$systemdsystemunitdir/dracut-emergency.service"
> + inst_hook cmdline 30 "$moddir/kdump-boot.sh"
>
> # Check for all the devices and if any device is iscsi, bring up iscsi
> # target. Ideally all this should be pushed into dracut iscsi module
> diff --git a/kexec-tools.spec b/kexec-tools.spec
> index cd90e3d..17442ad 100644
> --- a/kexec-tools.spec
> +++ b/kexec-tools.spec
> @@ -44,6 +44,7 @@ Source106: dracut-kdump-capture.service
> Source107: dracut-kdump-emergency.target
> Source108: dracut-early-kdump.sh
> Source109: dracut-early-kdump-module-setup.sh
> +Source110: dracut-kdump-boot.sh
>
> Requires(post): systemd-units
> Requires(preun): systemd-units
> @@ -204,6 +205,8 @@ cp %{SOURCE108}
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlyk
> cp %{SOURCE109}
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_early_kdump_prefix
%{SOURCE109}}
> chmod 755
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_prefix
%{SOURCE108}}
> chmod 755
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_early_kdump_prefix
%{SOURCE109}}
> +cp %{SOURCE110}
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix
%{SOURCE110}}
> +chmod 755
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix
%{SOURCE110}}
>
>
> %define dracutlibdir %{_prefix}/lib/dracut
> _______________________________________________
> kexec mailing list -- kexec(a)lists.fedoraproject.org
> To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
> Fedora Code of Conduct:
https://getfedora.org/code-of-conduct.html
> List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives:
https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org
Thanks for the update.
As we talked in another thread, it's true that in production kernel we
don't need to setup network for dump, so it makes sense to delete the
cmdline.d files to disable interface renaming and disable network.
But the problem is the dump target setup hooks/cmdline.d files still
exists. For example, if the remote target is a nfs target, we will
have a nfs entry in /etc/fstab (in initramfs), and dracut will still
try to setup, but due to network is not available so it will fail. An
extra error message will be generated:
[FAILED] Failed to mount /kdumproot/mnt/nfs.
See 'systemctl status kdumproot-mnt-nfs.mount' for details.
[DEPEND] Dependency failed for Remote File Systems.
...snip...
Then boot progress keep going on.
With iscsi, iscsi related cmdline and hook still exits. So it still
brings up the network unconditionally, as iscsi will add extra netroot
cmdline parameter, dracut detects that, and automatically setup all
interfaces even though the network related configs are deleted. But
the auto-configuration will break if the network is configured using
static IP, and it will hang the boot progress.
Right, it seems not easy to split all kdump enabled things out.
Probably the easiest way is separate the normal initrd and the kdump
initrd but pack them together, while capture kernel booting just extrace kdump initrd to
overwrite the initramfs root, and while normal booting just to ahead?
But it will indeed cause a bigger initrd..
>
> --
> Best Regards,
> Kairui Song