If the directory where the kdump.img is saved has no enough space for the
kdump.img, after restarting kdump service, it will get an incomplete file
named initramfs-xxxkdump.img, the restarting of kdump service failed, but
did not remove the incomplete file. So when reboot the system, kdump will
load the incomplete file, and then when kernel crash, the kdump will fail
because the file initramfs-xxxkdump.img is incomplete.
So, if the dracut failed building the initramfs-xxxkdump.img, kdump should
remove the file initramfs-xxxkdump.img so that kdump will not load a wrong
initramfs-xxxkdump.img when reboot the system.
Signed-off-by: Chao Fan <cfan(a)redhat.com>
---
kdumpctl | 1 +
1 file changed, 1 insertion(+)
diff --git a/kdumpctl b/kdumpctl
index eaf7f67..b82e3f0 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -175,6 +175,7 @@ rebuild_kdump_initrd()
$MKDUMPRD $TARGET_INITRD $kdump_kver
if [ $? != 0 ]; then
echo "mkdumprd: failed to make kdump initrd" >&2
+ rm -f $TARGET_INITRD
return 1
fi
--
2.1.0