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
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@linux.ibm.com ---
Changes in V2: * Unchanged
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 db7cd23..003845c 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -346,7 +346,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. @@ -415,9 +415,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@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 003845c..c2e92da 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 d5dcced..9ebb5c5 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
On Tue, Jan 29, 2019 at 1:36 PM Hari Bathini hbathini@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@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
dracut-module-setup.sh may also setup following files: /etc/cmdline.d/{41bridge.conf,42bond.conf,43vlan.conf,44team.conf} that will still contain reference to old kdump-* ifname, you may need add prefixes and delete them as well.
And another problem is if you deleted the network related cmdline.d files, dracut will not setup the network in early bootup stage, but dracut will still try to setup the network dump target and then fail. This may not fail the boot progress, but it generates an extra error message.
-- Best Regards, Kairui Song
Hi Kairui Song,
Thanks for the review..
On 30/01/19 2:59 PM, Kairui Song wrote:
On Tue, Jan 29, 2019 at 1:36 PM Hari Bathini hbathini@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@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
dracut-module-setup.sh may also setup following files: /etc/cmdline.d/{41bridge.conf,42bond.conf,43vlan.conf,44team.conf} that will still contain reference to old kdump-* ifname, you may need add prefixes and delete them as well.
Ah! right.. I think I overlooked a few kind of interfaces. Will fix and post..
And another problem is if you deleted the network related cmdline.d files, dracut will not setup the network in early bootup stage, but
Dump capture capability is added to the default initrd. So, the initrd would be used to boot the production kernel as well as capture kernel. Deleting these files when the initrd is used for booting production kernel (firmware exports /proc/device-tree/rtas/ibm,kernel-dump node in capture kernel). where network setup for dump target would not be necessary..
dracut will still try to setup the network dump target and then fail. This may not fail the boot progress, but it generates an extra error message.
-- Best Regards, Kairui Song _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@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
On 01/29/2019 01:33 PM, Hari Bathini 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@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
Do we have separate initramfs for kdump and fadump? If yes, can we avoid to install the above files in fadump's initramfs?
Thanks, Pingfan
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 003845c..c2e92da 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 d5dcced..9ebb5c5 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@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@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
Hi Pingfan,
Thanks for the review..
On 31/01/19 11:00 AM, piliu wrote:
On 01/29/2019 01:33 PM, Hari Bathini 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@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
Do we have separate initramfs for kdump and fadump? If yes, can we avoid to install the above files in fadump's initramfs?
Yes. But these files are needed in fadump initrd as well but only while capturing dump and not while booting production kernel..
- Hari
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@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 c2e92da..5574773 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -216,11 +216,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"