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.
Signed-off-by: Hari Bathini <hbathini(a)linux.ibm.com>
---
* New patch to fix default initrd backup/restore logic.
kdumpctl | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 7caaae5..03c91f3 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -163,7 +163,7 @@ backup_default_initrd()
if [[ ! -e $DEFAULT_INITRD_BAK ]]; then
dinfo "Backing up $DEFAULT_INITRD before rebuild."
# save checksum to verify before restoring
- sha1sum "$DEFAULT_INITRD" > "$INITRD_CHECKSUM_LOCATION"
+ sha1sum "$DEFAULT_INITRD" >
"$INITRD_CHECKSUM_LOCATION.$KDUMP_KERNELVER"
if ! cp "$DEFAULT_INITRD" "$DEFAULT_INITRD_BAK"; then
dwarn "WARNING: failed to backup $DEFAULT_INITRD."
rm -f "$DEFAULT_INITRD_BAK"
@@ -181,14 +181,14 @@ restore_default_initrd()
# If a backup initrd exists, we must be switching back from
# fadump to kdump. Restore the original default initrd.
- if [[ -f $DEFAULT_INITRD_BAK ]] && [[ -f $INITRD_CHECKSUM_LOCATION ]]; then
+ if [[ -f $DEFAULT_INITRD_BAK ]] && [[ -f
$INITRD_CHECKSUM_LOCATION.$KDUMP_KERNELVER ]]; then
# verify checksum before restoring
backup_checksum=$(sha1sum "$DEFAULT_INITRD_BAK" | awk '{ print $1
}')
- default_checksum=$(awk '{ print $1 }' "$INITRD_CHECKSUM_LOCATION")
+ default_checksum=$(awk '{ print $1 }'
"$INITRD_CHECKSUM_LOCATION.$KDUMP_KERNELVER")
if [[ $default_checksum != "$backup_checksum" ]]; then
dwarn "WARNING: checksum mismatch! Can't restore original initrd.."
else
- rm -f $INITRD_CHECKSUM_LOCATION
+ rm -f $INITRD_CHECKSUM_LOCATION.$KDUMP_KERNELVER
if mv "$DEFAULT_INITRD_BAK" "$DEFAULT_INITRD"; then
derror "Restoring original initrd as fadump mode is disabled."
sync -f "$DEFAULT_INITRD"
--
2.38.1