When a remote dump target is specified, kdump dracut module prefixes
'kdump-' to network interface name (ifname) as kernel assigned names
are not persistent. In fadump mode, kdump dracut module is added to
the default initrd, which adds the 'kdump-' prefix to the ifname of
the prodcution kernel itself. If fadump mode is disabled after this,
kdump dracut module picks the ifname that is already prefixed with
'kdump-' in the production kernel and adds another 'kdump-' to it,
making the ifname something like kdump-kdump-eth0 for kdump kernel.
Eventually, kdump kernel fails with below traces:
dracut-initqueue[246]: RTNETLINK answers: Network is unreachable
dracut-initqueue[246]: arping: Device kdump-kdump-eth0 not available.
The ip command shows the below:
kdump:/# ip addr show kdump-kdump-eth0
2: kdump-kdump-eth: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 \
qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 22:82:87:7b:98:02 brd ff:ff:ff:ff:ff:ff
inet6 2002:903:15f:550:2082:87ff:fe7b:9802/64 scope global \
mngtmpaddr dynamic
valid_lft 2591890sec preferred_lft 604690sec
inet6 fe80::2082:87ff:fe7b:9802/64 scope link
valid_lft forever preferred_lft forever
kdump:/#
The trailing 0 from kdump-kdump-eth0 is missing in the ifname, probably
truncated while setting.
This patch fixes this by avoiding addition of the prefix 'kdump-' when
such prefix is already present in the ifname.
Signed-off-by: Hari Bathini <hbathini(a)linux.vnet.ibm.com>
---
* No changes from v1.
dracut-module-setup.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 68e0ff8..490501a 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -161,7 +161,8 @@ kdump_get_perm_addr() {
kdump_setup_ifname() {
local _ifname
- if [[ $1 =~ eth* ]]; then
+ # If ifname has 'kdump-' prefix, don't add it again
+ if [[ $1 =~ eth* ]] && [[ ! $1 =~ ^kdump-* ]]; then
_ifname="kdump-$1"
else
_ifname="$1"
Show replies by thread
When fadump mode is enabled, the default initrd is rebuilt with kdump
dracut module. As the default initrd is altered, the original default
initrd is backed up. But we are not restoring it when fadump mode is
disabled. This patch tries to restore the backed up default initrd on
disabling fadump mode.
Signed-off-by: Hari Bathini <hbathini(a)linux.vnet.ibm.com>
---
Changes from v1:
* Using `uname -r` for kernel version instead of $kdump-kver
for backup/restore.
kdumpctl | 42 ++++++++++++++++++++++++++++++++----------
1 file changed, 32 insertions(+), 10 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 8d0ab81..ea95032 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -154,9 +154,6 @@ rebuild_fadump_initrd()
{
local target_initrd_tmp
- # backup fadump initrd for reference before replacing it
- backup_initrd
-
# this file tells the initrd is fadump enabled
touch /tmp/fadump.initramfs
target_initrd_tmp="$TARGET_INITRD.tmp"
@@ -190,8 +187,17 @@ rebuild_kdump_initrd()
rebuild_initrd()
{
if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
+ # backup initrd for reference before replacing it
+ # with fadump aware initrd
+ backup_restore_default_initrd "backup"
+
rebuild_fadump_initrd
else
+ # check if a backup of default initrd exists. If yes,
+ # it signifies a switch from fadump mode. So, restore
+ # the backed up default initrd.
+ backup_restore_default_initrd "restore"
+
rebuild_kdump_initrd
fi
@@ -220,15 +226,31 @@ check_executable()
done
}
-backup_initrd()
+backup_restore_default_initrd()
{
- local target_initrd_bak
+ local default_initrd
+ local default_initrd_bak
+ local action=$1
+
+ default_initrd="${KDUMP_BOOTDIR}/initramfs-`uname -r`.img"
+ default_initrd_bak="${KDUMP_BOOTDIR}/.initramfs-`uname -r`.img.default"
- # Check if backup initrd is already present.
- target_initrd_bak="$TARGET_INITRD.bak"
- if [ ! -e $target_initrd_bak ];then
- echo "Backing up $TARGET_INITRD"
- cp $TARGET_INITRD $target_initrd_bak
+ if [[ $action != "restore" ]]; then
+ if [ ! -e $default_initrd_bak ]; then
+ echo "Backing up $default_initrd"
+ cp $default_initrd $default_initrd_bak
+ fi
+ else
+ # If a backup initrd exists, we must be switching back from
+ # fadump to kdump. Restore the original default initrd.
+ if [ -f $default_initrd_bak ];then
+ mv $default_initrd_bak $default_initrd
+ if [[ $? -eq 0 ]]; then
+ echo -n "Default initrd is restored as fadump mode "
+ echo "is disabled"
+ sync
+ fi
+ fi
fi
}