As default initrd is used for booting fadump capture kernel, it must be rebuilt with dump capture capability when dump mode is fadump. Check if default initrd is already fadump capable and rebuild, if necessary.
Signed-off-by: Hari Bathini hbathini@linux.vnet.ibm.com ---
* Using `lsinitrd -f` over `lsinitrd -m`, to find if kdumpbase module is included, as it is observed to take only about half the time.
kdumpctl | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/kdumpctl b/kdumpctl index b7a3105..f69a5f0 100755 --- a/kdumpctl +++ b/kdumpctl @@ -6,6 +6,7 @@ KDUMP_COMMANDLINE="" KEXEC_ARGS="" KDUMP_CONFIG_FILE="/etc/kdump.conf" MKDUMPRD="/sbin/mkdumprd -f" +DRACUT_MODULES_FILE="/usr/lib/dracut/modules.txt" SAVE_PATH=/var/crash SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa" INITRD_CHECKSUM_LOCATION="/boot/.fadump_initrd_checksum" @@ -693,6 +694,7 @@ check_system_modified() check_rebuild() { local extra_modules + local capture_capable_initrd="1" local _force_rebuild force_rebuild="0" local _force_no_rebuild force_no_rebuild="0" local ret system_modified="0" @@ -747,6 +749,12 @@ check_rebuild() #since last build of the image file if [ -f $TARGET_INITRD ]; then image_time=`stat -c "%Y" $TARGET_INITRD 2>/dev/null` + + #in case of fadump mode, check whether the default/target + #initrd is already built with dump capture capability + if [ "$DEFAULT_DUMP_MODE" == "fadump" ]; then + capture_capable_initrd=`lsinitrd -f $DRACUT_MODULES_FILE $TARGET_INITRD | grep ^kdumpbase$ | wc -l` + fi fi
check_system_modified @@ -761,6 +769,8 @@ check_rebuild()
if [ $image_time -eq 0 ]; then echo -n "No kdump initial ramdisk found."; echo + elif [ "$capture_capable_initrd" == "0" ]; then + echo -n "Rebuild $TARGET_INITRD with dump capture support"; echo elif [ "$force_rebuild" != "0" ]; then echo -n "Force rebuild $TARGET_INITRD"; echo elif [ "$system_modified" != "0" ]; then
On 08/29/2017 at 09:45 PM, Hari Bathini wrote:
As default initrd is used for booting fadump capture kernel, it must be rebuilt with dump capture capability when dump mode is fadump. Check if default initrd is already fadump capable and rebuild, if necessary.
Signed-off-by: Hari Bathini hbathini@linux.vnet.ibm.com
- Using `lsinitrd -f` over `lsinitrd -m`, to find if kdumpbase module is included, as it is observed to take only about half the time.
Hi Hari, could you please try the following approach?
--- kdumpctl | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/kdumpctl b/kdumpctl index 12f360a..1a24d29 100755 --- a/kdumpctl +++ b/kdumpctl @@ -313,7 +313,7 @@ check_executable() backup_default_initrd() { if [ ! -f "$DEFAULT_INITRD" ]; then - return + return 1 fi
if [ ! -e $DEFAULT_INITRD_BAK ]; then @@ -324,8 +324,12 @@ backup_default_initrd() if [ $? -ne 0 ]; then echo "WARNING: failed to backup $DEFAULT_INITRD." rm -f $DEFAULT_INITRD_BAK + return 1 fi + return 0 fi + + return 1 }
restore_default_initrd() @@ -345,9 +349,12 @@ restore_default_initrd() echo -n "Restoring original initrd as fadump mode " echo "is disabled." sync + return 0 fi fi fi + + return 1 }
check_config() @@ -717,9 +724,9 @@ check_rebuild() system_modified="1" fi
- handle_mode_switch - - if [ $image_time -eq 0 ]; then + if handle_mode_switch; then + echo -n "Dump mode changed from last boot."; echo + elif [ $image_time -eq 0 ]; then echo -n "No kdump initial ramdisk found."; echo elif [ "$force_rebuild" != "0" ]; then echo -n "Force rebuild $TARGET_INITRD"; echo @@ -886,12 +893,12 @@ handle_mode_switch() if [ "$DEFAULT_DUMP_MODE" == "fadump" ]; then # backup initrd for reference before replacing it # with fadump aware initrd - backup_default_initrd + return backup_default_initrd else # check if a backup of default initrd exists. If yes, # it signifies a switch from fadump mode. So, restore # the backed up default initrd. - restore_default_initrd + return restore_default_initrd fi }
On Wednesday 30 August 2017 07:14 AM, Xunlei Pang wrote:
On 08/29/2017 at 09:45 PM, Hari Bathini wrote:
As default initrd is used for booting fadump capture kernel, it must be rebuilt with dump capture capability when dump mode is fadump. Check if default initrd is already fadump capable and rebuild, if necessary.
Signed-off-by: Hari Bathini hbathini@linux.vnet.ibm.com
- Using `lsinitrd -f` over `lsinitrd -m`, to find if kdumpbase module is included, as it is observed to take only about half the time.
Hi Hari, could you please try the following approach?
kdumpctl | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/kdumpctl b/kdumpctl index 12f360a..1a24d29 100755 --- a/kdumpctl +++ b/kdumpctl @@ -313,7 +313,7 @@ check_executable() backup_default_initrd() { if [ ! -f "$DEFAULT_INITRD" ]; then
return
return 1 fi if [ ! -e $DEFAULT_INITRD_BAK ]; then
@@ -324,8 +324,12 @@ backup_default_initrd() if [ $? -ne 0 ]; then echo "WARNING: failed to backup $DEFAULT_INITRD." rm -f $DEFAULT_INITRD_BAK
return 1 fi
return 0 fi
return 1 }
restore_default_initrd()
@@ -345,9 +349,12 @@ restore_default_initrd() echo -n "Restoring original initrd as fadump mode " echo "is disabled." sync
return 0 fi fi fi
return 1 }
check_config()
@@ -717,9 +724,9 @@ check_rebuild() system_modified="1" fi
- handle_mode_switch
- if [ $image_time -eq 0 ]; then
- if handle_mode_switch; then
echo -n "Dump mode changed from last boot."; echo
- elif [ $image_time -eq 0 ]; then echo -n "No kdump initial ramdisk found."; echo elif [ "$force_rebuild" != "0" ]; then echo -n "Force rebuild $TARGET_INITRD"; echo
@@ -886,12 +893,12 @@ handle_mode_switch() if [ "$DEFAULT_DUMP_MODE" == "fadump" ]; then # backup initrd for reference before replacing it # with fadump aware initrd
backup_default_initrd
return backup_default_initrd else # check if a backup of default initrd exists. If yes, # it signifies a switch from fadump mode. So, restore # the backed up default initrd.
restore_default_initrd
}return restore_default_initrd fi
I am apprehensive about this approach, as it may not add kdumpbase to default initrd again, if it has been changed outside kdumpctl script (after initrd is backed up).
Thanks Hari
On 08/30/2017 at 04:45 PM, Hari Bathini wrote:
On Wednesday 30 August 2017 07:14 AM, Xunlei Pang wrote:
On 08/29/2017 at 09:45 PM, Hari Bathini wrote:
As default initrd is used for booting fadump capture kernel, it must be rebuilt with dump capture capability when dump mode is fadump. Check if default initrd is already fadump capable and rebuild, if necessary.
Signed-off-by: Hari Bathini hbathini@linux.vnet.ibm.com
- Using `lsinitrd -f` over `lsinitrd -m`, to find if kdumpbase module is included, as it is observed to take only about half the time.
Hi Hari, could you please try the following approach?
kdumpctl | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/kdumpctl b/kdumpctl index 12f360a..1a24d29 100755 --- a/kdumpctl +++ b/kdumpctl @@ -313,7 +313,7 @@ check_executable() backup_default_initrd() { if [ ! -f "$DEFAULT_INITRD" ]; then
return
return 1 fi if [ ! -e $DEFAULT_INITRD_BAK ]; then
@@ -324,8 +324,12 @@ backup_default_initrd() if [ $? -ne 0 ]; then echo "WARNING: failed to backup $DEFAULT_INITRD." rm -f $DEFAULT_INITRD_BAK
return 1 fi
return 0 fi
return 1 }
restore_default_initrd()
@@ -345,9 +349,12 @@ restore_default_initrd() echo -n "Restoring original initrd as fadump mode " echo "is disabled." sync
return 0 fi fi fi
return 1 }
check_config()
@@ -717,9 +724,9 @@ check_rebuild() system_modified="1" fi
- handle_mode_switch
- if [ $image_time -eq 0 ]; then
- if handle_mode_switch; then
echo -n "Dump mode changed from last boot."; echo
- elif [ $image_time -eq 0 ]; then echo -n "No kdump initial ramdisk found."; echo elif [ "$force_rebuild" != "0" ]; then echo -n "Force rebuild $TARGET_INITRD"; echo
@@ -886,12 +893,12 @@ handle_mode_switch() if [ "$DEFAULT_DUMP_MODE" == "fadump" ]; then # backup initrd for reference before replacing it # with fadump aware initrd
backup_default_initrd
return backup_default_initrd else # check if a backup of default initrd exists. If yes, # it signifies a switch from fadump mode. So, restore # the backed up default initrd.
restore_default_initrd
}return restore_default_initrd fi
I am apprehensive about this approach, as it may not add kdumpbase to default initrd again, if it has been changed outside kdumpctl script (after initrd is backed up).
OK, then let's return back to your approach :-)
Regards, Xunlei
On 08/29/2017 at 09:45 PM, Hari Bathini wrote:
As default initrd is used for booting fadump capture kernel, it must be rebuilt with dump capture capability when dump mode is fadump. Check if default initrd is already fadump capable and rebuild, if necessary.
Signed-off-by: Hari Bathini hbathini@linux.vnet.ibm.com
- Using `lsinitrd -f` over `lsinitrd -m`, to find if kdumpbase module is included, as it is observed to take only about half the time.
kdumpctl | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/kdumpctl b/kdumpctl index b7a3105..f69a5f0 100755 --- a/kdumpctl +++ b/kdumpctl @@ -6,6 +6,7 @@ KDUMP_COMMANDLINE="" KEXEC_ARGS="" KDUMP_CONFIG_FILE="/etc/kdump.conf" MKDUMPRD="/sbin/mkdumprd -f" +DRACUT_MODULES_FILE="/usr/lib/dracut/modules.txt" SAVE_PATH=/var/crash SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa" INITRD_CHECKSUM_LOCATION="/boot/.fadump_initrd_checksum" @@ -693,6 +694,7 @@ check_system_modified() check_rebuild() { local extra_modules
- local capture_capable_initrd="1" local _force_rebuild force_rebuild="0" local _force_no_rebuild force_no_rebuild="0" local ret system_modified="0"
@@ -747,6 +749,12 @@ check_rebuild() #since last build of the image file if [ -f $TARGET_INITRD ]; then image_time=`stat -c "%Y" $TARGET_INITRD 2>/dev/null`
#in case of fadump mode, check whether the default/target
#initrd is already built with dump capture capability
if [ "$DEFAULT_DUMP_MODE" == "fadump" ]; then
capture_capable_initrd=`lsinitrd -f $DRACUT_MODULES_FILE $TARGET_INITRD | grep ^kdumpbase$ | wc -l`
It's better to use $(..) instead of the deprecated `..`, otherwise: Reviewed-by: Xunlei Pang xlpang@redhat.com
fi
fi
check_system_modified
@@ -761,6 +769,8 @@ check_rebuild()
if [ $image_time -eq 0 ]; then echo -n "No kdump initial ramdisk found."; echo
- elif [ "$capture_capable_initrd" == "0" ]; then
elif [ "$force_rebuild" != "0" ]; then echo -n "Force rebuild $TARGET_INITRD"; echo elif [ "$system_modified" != "0" ]; thenecho -n "Rebuild $TARGET_INITRD with dump capture support"; echo
kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org
On Thursday 31 August 2017 08:10 AM, Xunlei Pang wrote:
On 08/29/2017 at 09:45 PM, Hari Bathini wrote:
As default initrd is used for booting fadump capture kernel, it must be rebuilt with dump capture capability when dump mode is fadump. Check if default initrd is already fadump capable and rebuild, if necessary.
Signed-off-by: Hari Bathini hbathini@linux.vnet.ibm.com
Using `lsinitrd -f` over `lsinitrd -m`, to find if kdumpbase module is included, as it is observed to take only about half the time.
kdumpctl | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/kdumpctl b/kdumpctl index b7a3105..f69a5f0 100755 --- a/kdumpctl +++ b/kdumpctl @@ -6,6 +6,7 @@ KDUMP_COMMANDLINE="" KEXEC_ARGS="" KDUMP_CONFIG_FILE="/etc/kdump.conf" MKDUMPRD="/sbin/mkdumprd -f" +DRACUT_MODULES_FILE="/usr/lib/dracut/modules.txt" SAVE_PATH=/var/crash SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa" INITRD_CHECKSUM_LOCATION="/boot/.fadump_initrd_checksum" @@ -693,6 +694,7 @@ check_system_modified() check_rebuild() { local extra_modules
- local capture_capable_initrd="1" local _force_rebuild force_rebuild="0" local _force_no_rebuild force_no_rebuild="0" local ret system_modified="0"
@@ -747,6 +749,12 @@ check_rebuild() #since last build of the image file if [ -f $TARGET_INITRD ]; then image_time=`stat -c "%Y" $TARGET_INITRD 2>/dev/null`
#in case of fadump mode, check whether the default/target
#initrd is already built with dump capture capability
if [ "$DEFAULT_DUMP_MODE" == "fadump" ]; then
capture_capable_initrd=`lsinitrd -f $DRACUT_MODULES_FILE $TARGET_INITRD | grep ^kdumpbase$ | wc -l`
It's better to use $(..) instead of the deprecated `..`, otherwise: Reviewed-by: Xunlei Pang xlpang@redhat.com
Thanks for the review. Posted v2 with the suggested change.
- Hari