In case of fadump, default initrd is rebuilt with dump capturing
capability, as the same initrd is used for booting production kernel
as well as capture kernel.
The original initrd file is backed up with a checksum, to restore
it as the default initrd when fadump is disabled. As the checksum
file is not kernel version specific, switching between different
kernel versions and kdump/fadump dump mode breaks the default initrd
backup/restore logic. Fix this by having a kernel version specific
checksum file.
Also, if backing up initrd fails, retaining the checksum file isn't
useful. Remove it.
Signed-off-by: Hari Bathini <hbathini(a)linux.ibm.com>
---
Changes in v3:
* Updated the patch based on Philipp's inputs.
Changes in v2:
* New patch to fix default initrd backup/restore logic.
kdumpctl | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index abfb352..af93202 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -9,9 +9,9 @@ KDUMP_LOG_PATH="/var/log"
MKDUMPRD="/sbin/mkdumprd -f"
MKFADUMPRD="/sbin/mkfadumprd"
DRACUT_MODULES_FILE="/usr/lib/dracut/modules.txt"
-INITRD_CHECKSUM_LOCATION="/boot/.fadump_initrd_checksum"
DEFAULT_INITRD=""
DEFAULT_INITRD_BAK=""
+INITRD_CHECKSUM_LOCATION=""
KDUMP_INITRD=""
TARGET_INITRD=""
FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered"
@@ -166,7 +166,8 @@ backup_default_initrd()
sha1sum "$DEFAULT_INITRD" > "$INITRD_CHECKSUM_LOCATION"
if ! cp "$DEFAULT_INITRD" "$DEFAULT_INITRD_BAK"; then
dwarn "WARNING: failed to backup $DEFAULT_INITRD."
- rm -f "$DEFAULT_INITRD_BAK"
+ rm -f -- "$INITRD_CHECKSUM_LOCATION"
+ rm -f -- "$DEFAULT_INITRD_BAK"
fi
fi
}
@@ -317,6 +318,7 @@ setup_initrd()
fi
DEFAULT_INITRD_BAK="$KDUMP_BOOTDIR/.$(basename
"$DEFAULT_INITRD").default"
+ INITRD_CHECKSUM_LOCATION="$DEFAULT_INITRD_BAK.checksum"
if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
TARGET_INITRD="$DEFAULT_INITRD"
--
2.38.1