The original idea credit to Hari,
See
https://lists.fedorahosted.org/archives/list/kexec@lists.fedoraproject.or...
But removing network conf file has some potential issue, so tackle the
problem with 'sed'
On 03/05/2020 11:44 AM, Pingfan Liu wrote:
Currently, while building the initrd with dump capture support, if a
network-based dump target is specified, network is configured in the initial
ramdisk which includes an interface name change if necessary.
When fadump is configured, the initrd used for booting production kernel is
rebuilt with dump capturing support. This initrd applies the network
configuration changes, intended for capturing a dump, while booting the
production kernel as well, potentially changing the network interface name in
production kernel. Avoid enforcing kdump specific network parameters while boot
production kernel to tackle that problem.
In fadump initrd, using a cmdline hook to strip "kdump-" from *.conf, so
production kernel can not be affected.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
dracut-kdump-boot.sh | 27 +++++++++++++++++++++++++++
dracut-module-setup.sh | 4 ++++
kexec-tools.spec | 3 +++
3 files changed, 34 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..6210084
--- /dev/null
+++ b/dracut-kdump-boot.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+ip_conf="/etc/cmdline.d/40ip.conf"
+bridge_conf="/etc/cmdline.d/41bridge.conf"
+bond_conf="/etc/cmdline.d/42bond.conf"
+team_conf="/etc/cmdline.d/44team.conf"
+vlan_conf="/etc/cmdline.d/43vlan.conf"
+files="$ip_conf $bridge_conf $bond_conf $team_conf $vlan_conf"
+
+rename_eth()
+{
+ for f in $files
+ do
+ if [ -f "$f" ]; then
+ sed -i 's/kdump-//' $f
+ fi
+ done
+}
+
+# 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
+ rename_eth
+fi
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 8691f9c..1237896 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -835,6 +835,10 @@ 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"
+ if is_fadump_capable; then
+ inst_hook cmdline 50 "$moddir/kdump-boot.sh"
+ fi
+
# 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 d80b108..7559186 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -51,6 +51,7 @@ Source107: dracut-kdump-emergency.target
Source108: dracut-early-kdump.sh
Source109: dracut-early-kdump-module-setup.sh
Source110: dracut-kdump-wait-for-target.sh
+Source111: dracut-kdump-boot.sh
Requires(post): systemd-units
Requires(preun): systemd-units
@@ -222,8 +223,10 @@ cp %{SOURCE105}
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpb
cp %{SOURCE106}
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix
%{SOURCE106}}
cp %{SOURCE107}
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix
%{SOURCE107}}
cp %{SOURCE110}
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix
%{SOURCE110}}
+cp %{SOURCE111}
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix
%{SOURCE111}}
chmod 755
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix
%{SOURCE100}}
chmod 755
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix
%{SOURCE101}}
+chmod 755
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix
%{SOURCE111}}
mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump
cp %{SOURCE108}
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_prefix
%{SOURCE108}}
cp %{SOURCE109}
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_early_kdump_prefix
%{SOURCE109}}