@@ -895,21 +895,66 @@ save_proc() {
895895save_sys () {
896896 trap ' handle_error $? $LINENO' ERR
897897 local sysfiles=" $@ "
898+ local cp_cmd=" sudo cp"
899+
898900 $MKDIR $V -p $TARDIR /sys
899901 for f in $sysfiles
900902 do
901903 if $NOOP ; then
902904 if [ -e $f ]; then
903- echo " $CP $V -r $f $TARDIR /sys"
905+ echo " $cp_cmd $V -r -p $f $TARDIR /sys"
904906 fi
905907 else
906- ( [ -e $f ] && $CP $V -r $f $TARDIR /sys ) || echo " $f not found" > $TARDIR /$f
908+ ( [ -e $f ] && $cp_cmd $V -r -p $f $TARDIR /sys ) || echo " $f not found" > $TARDIR /$f
907909 fi
908910 done
909911
910912 chmod ugo+rw -R $DUMPDIR /$BASE /sys
911913}
912914
915+ # ##############################################################################
916+ # Given list of pstore directories or files, saves subdirectories and files to tar.
917+ # Globals:
918+ # V
919+ # TARDIR
920+ # MKDIR
921+ # CP
922+ # DUMPDIR
923+ # TAR
924+ # RM
925+ # BASE
926+ # TARFILE
927+ # NOOP
928+ # Arguments:
929+ # *pstorefiles: variable-length list of pstore file paths to save
930+ # Returns:
931+ # None
932+ # ##############################################################################
933+ save_pstore () {
934+ trap ' handle_error $? $LINENO' ERR
935+ local pstorefiles=" $@ "
936+ PSTORE_DIR_LIST_INFO_FILE=" techsupport_pstore_dir_listing_info"
937+ $MKDIR $V -p $TARDIR /pstore
938+
939+ echo " ==================================" > $TARDIR /pstore/$PSTORE_DIR_LIST_INFO_FILE
940+ echo " /var/lib/systemd/pstore files info" >> $TARDIR /pstore/$PSTORE_DIR_LIST_INFO_FILE
941+ echo " ==================================" >> $TARDIR /pstore/$PSTORE_DIR_LIST_INFO_FILE
942+ for f in $pstorefiles
943+ do
944+ if $NOOP ; then
945+ if [ -e $f ]; then
946+ echo " $CP $V -r -p $f /* $TARDIR /pstore"
947+ fi
948+ else
949+ ls --time-style=' +%d-%m-%Y %H:%M:%S' -last $f >> $TARDIR /pstore/$PSTORE_DIR_LIST_INFO_FILE
950+ ls --time-style=' +%d-%m-%Y %H:%M:%S' -last $f /* >> $TARDIR /pstore/$PSTORE_DIR_LIST_INFO_FILE
951+ ( [ -e $f ] && $CP $V -r -p $f /* $TARDIR /pstore ) || echo " $f not found" > $TARDIR /$f
952+ fi
953+ done
954+
955+ chmod ugo+rw -R $DUMPDIR /$BASE /pstore
956+ }
957+
913958# ##############################################################################
914959# Dump io stats for processes
915960# Globals:
@@ -2133,12 +2178,19 @@ main() {
21332178 echo " [ Capture Proc State ] : $(( $end_t - $start_t )) msec" >> $TECHSUPPORT_TIME_INFO
21342179 wait
21352180
2136- # capture /sys info - include acpi info
2137- save_sys /sys/firmware/acpi/tables &
2181+ # capture /sys info - include acpi info and pre-process pstore info
2182+ save_sys /sys/firmware/acpi/tables /sys/fs/pstore &
21382183 end_t2=$( date +%s%3N)
21392184 echo " [ Capture Sys info ] : $(( $end_t2 - $end_t )) msec" >> $TECHSUPPORT_TIME_INFO
21402185 wait
21412186
2187+ # capture /var/lib/systemd/pstore info
2188+ start_t=$( date +%s%3N)
2189+ save_pstore /var/lib/systemd/pstore &
2190+ end_t=$( date +%s%3N)
2191+ echo " [ Capture pstore info ] : $(( $end_t - $start_t )) msec" >> $TECHSUPPORT_TIME_INFO
2192+ wait
2193+
21422194 # Save all the processes within each docker
21432195 save_cmd " show services" services.summary &
21442196
0 commit comments