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. The first patch in this patch-set prefixes all
network related cmdline conf files with 'kdump' for graceful handling.
The second patch adds a dracut cmdline hook in the initrd to remove
network cmdline conf files while booting production kernel. The last
patch reverts an old commit that is no longer relevant with the
change in second patch.
---
Hari Bathini (3):
add kdump prefix to network cmdline config files
fadump: avoid renaming network interface name during regular boot
avoid network interface rename when unnecessary
dracut-kdump-boot.sh | 12 ++++++++++++
dracut-module-setup.sh | 13 +++++--------
kexec-tools.spec | 3 +++
3 files changed, 20 insertions(+), 8 deletions(-)
create mode 100644 dracut-kdump-boot.sh
Show replies by date
Prefix 'kdump-' to cmdline config files used for bringing up network.
This gives flexibilty in handling network configuration gracefully in
different scenarios.
Signed-off-by: Hari Bathini <hbathini(a)linux.ibm.com>
---
* No changes
dracut-module-setup.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index a10244b..0898a9a 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -291,7 +291,7 @@ kdump_setup_netdev() {
_proto=dhcp
fi
- _ip_conf="${initdir}/etc/cmdline.d/40ip.conf"
+ _ip_conf="${initdir}/etc/cmdline.d/40kdump-ip.conf"
_ip_opts=" ip=${_static}$(kdump_setup_ifname $_netdev):${_proto}"
# dracut doesn't allow duplicated configuration for same NIC, even they're
exactly the same.
@@ -360,9 +360,9 @@ kdump_install_net() {
# call kdump_install_net again and we don't want eth1 to be the default
# gateway.
if [ ! -f ${initdir}/etc/cmdline.d/60kdumpnic.conf ] &&
- [ ! -f ${initdir}/etc/cmdline.d/70bootdev.conf ]; then
+ [ ! -f ${initdir}/etc/cmdline.d/70kdump-bootdev.conf ]; then
echo "kdumpnic=$(kdump_setup_ifname $_netdev)" >
${initdir}/etc/cmdline.d/60kdumpnic.conf
- echo "bootdev=$(kdump_setup_ifname $_netdev)" >
${initdir}/etc/cmdline.d/70bootdev.conf
+ echo "bootdev=$(kdump_setup_ifname $_netdev)" >
${initdir}/etc/cmdline.d/70kdump-bootdev.conf
fi
}
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:
* kdump cmdline hook priority adjusted
dracut-kdump-boot.sh | 12 ++++++++++++
dracut-module-setup.sh | 1 +
kexec-tools.spec | 3 +++
3 files changed, 16 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..ba205dc
--- /dev/null
+++ b/dracut-kdump-boot.sh
@@ -0,0 +1,12 @@
+#!/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/60kdumpnic.conf
+ rm -f /etc/cmdline.d/70kdump-bootdev.conf
+fi
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 0898a9a..53543d2 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -745,6 +745,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 a411182..8e3013f 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
@@ -205,6 +206,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
Revert commit 78e985e51cf1 ("kdump/fadump: fix network interface name
when switching from fadump to kdump") as it is no longer relevant in
the context of the recent change that ensures network interface name
on production kernel is not altered.
Signed-off-by: Hari Bathini <hbathini(a)linux.ibm.com>
---
Changes in V2:
* Reverted commit 78e985e51cf1
dracut-module-setup.sh | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 53543d2..b521710 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -161,11 +161,7 @@ kdump_get_perm_addr() {
kdump_setup_ifname() {
local _ifname
- # If ifname already has 'kdump-' prefix, we must be switching from
- # fadump to kdump. Skip prefixing 'kdump-' in this case as adding
- # another prefix may truncate the ifname. Since an ifname with
- # 'kdump-' is already persistent, this should be fine.
- if [[ $1 =~ eth* ]] && [[ ! $1 =~ ^kdump-* ]]; then
+ if [[ $1 =~ eth* ]]; then
_ifname="kdump-$1"
else
_ifname="$1"