#6 kdumpctl: Write to `/var/lib/kdump` if $KDUMP_BOOTDIR not writable
Closed 2 years ago by kasong. Opened 3 years ago by kfan.
rpms/ kfan/kexec-tools pr/ro-boot  into  main

file modified
+12 -2
@@ -152,8 +152,15 @@ 



  	if [[ ! -w "$KDUMP_BOOTDIR" ]];then

- 		derror "$KDUMP_BOOTDIR does not have write permission. Can not rebuild $TARGET_INITRD"

- 		return 1

+ 		VAR_TARGET_INITRD_DIR="/var/lib/kdump"

+ 		mkdir -p "$VAR_TARGET_INITRD_DIR"



+ 		dwarn "$KDUMP_BOOTDIR does not have write permission. Rebuilding initrd at $TARGET_INITRD"

+ 		if [[ ! -w "$VAR_TARGET_INITRD_DIR" ]];then

+ 			derror "$VAR_TARGET_INITRD_DIR does not have write permission. Cannot rebuild $TARGET_INITRD"

+ 			return 1

+ 		fi



  	if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
@@ -686,6 +693,9 @@ 




+ 	# Relabel the target initrd for SELinux.

+ 	chcon -t boot_t $TARGET_INITRD


  	ddebug "$KEXEC $KEXEC_ARGS $standard_kexec_args --command-line=$KDUMP_COMMANDLINE --initrd=$TARGET_INITRD $KDUMP_KERNEL"


  	# The '12' represents an intermediate temporary file descriptor

The /boot directory on some operating systems might be read-only
(e.g. Fedora CoreOS). If we cannot write to $KDUMP_BOOTDIR when
generating the kdump initrd, attempt to place the generated initrd
at /var/lib/kdump instead.

Signed-off by: Kelvin Fan kfan@redhat.com

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

Closing, the patch is tracked in the mail list and merged already.

Pull-Request has been closed by kasong

2 years ago