In the latest releases of Fedora CoreOS, the /boot directory is mounted read-only. Instead of always placing the generated kdump initrd next to the default initrd (which is usually under /boot), make the generated initrd's location configurable in `/etc/sysconfig/kdump`.
Signed-off by: Kelvin Fan kfan@redhat.com --- kdump.sysconfig | 3 +++ kdumpctl | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/kdump.sysconfig b/kdump.sysconfig index 30f0c63..952d5c7 100644 --- a/kdump.sysconfig +++ b/kdump.sysconfig @@ -30,6 +30,9 @@ KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 reset_devices novmcoredd" # KEXEC_ARGS="--elf32-core-headers" KEXEC_ARGS=""
+# Where to store the generated kdump initrd +TARGET_INITRD_DIR="" + #Where to find the boot image #KDUMP_BOOTDIR="/boot"
diff --git a/kdumpctl b/kdumpctl index 24f5cf7..a4e8763 100755 --- a/kdumpctl +++ b/kdumpctl @@ -151,8 +151,9 @@ rebuild_kdump_initrd()
rebuild_initrd() { - if [[ ! -w "$KDUMP_BOOTDIR" ]];then - derror "$KDUMP_BOOTDIR does not have write permission. Can not rebuild $TARGET_INITRD" + TARGET_INITRD_DIR=$(dirname $TARGET_INITRD) + if [[ ! -w "$TARGET_INITRD_DIR" ]];then + derror "$TARGET_INITRD_DIR does not have write permission. Can not rebuild $TARGET_INITRD" return 1 fi
@@ -335,7 +336,12 @@ setup_initrd() # with fadump aware initrd backup_default_initrd else - TARGET_INITRD="$KDUMP_INITRD" + if [ -z $TARGET_INITRD_DIR ]; then + TARGET_INITRD="$KDUMP_INITRD" + else + KDUMP_INITRD_BASE=$(basename "$KDUMP_INITRD") + ARGET_INITRD="$TARGET_INITRD_DIR"/"$KDUMP_INITRD_BASE" + fi
# check if a backup of default initrd exists. If yes, # it signifies a switch from fadump mode. So, restore