diff --git a/CHANGELOG.md b/CHANGELOG.md index ed97b36b..462a1d86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,45 +4,14 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). -<<<<<<< HEAD #### [6.0.1](https://github.com/rdkcentral/sysint/compare/6.0.0...6.0.1) -======= -#### [4.2.1v17](https://github.com/rdkcentral/sysint/compare/6.0.1...4.2.1v17) - -- RDKEMW-21582: Network connection recovery script should handle IPv4-only/IPv6-only networks [`#581`](https://github.com/rdkcentral/sysint/pull/581) -- RDKEMW-19100:gst-cleanup conditions when cdl_flashed_file_name is not present [`#551`](https://github.com/rdkcentral/sysint/pull/551) -- RDKEMW-18972 : RebootReason log adds colon in the Parodus.log file [`#550`](https://github.com/rdkcentral/sysint/pull/550) -- RDKEMW-16152: "Let's get connected" screen displayed during Migration testing [`#549`](https://github.com/rdkcentral/sysint/pull/549) -- RDKEMW-18793a: avoid thermal call in deepsleep [`#548`](https://github.com/rdkcentral/sysint/pull/548) -- RDKEMW-17533 : [support/8.4.4.0] OCDM_WVMediaKey and OCDM_SaThread changes in sysint [`#518`](https://github.com/rdkcentral/sysint/pull/518) -- RDKEMW-17274: 8.4 T2 event for MemAvailable Need To Send Only Numerical Value [`#515`](https://github.com/rdkcentral/sysint/pull/515) -- RDKEMW-15318: [4.2.1] stop ctrlm-main service before bluez for graceful reboot [`#486`](https://github.com/rdkcentral/sysint/pull/486) -- [RDKEMW-14555] : Updating wifi reassociation threshould tolerance RFC [`#462`](https://github.com/rdkcentral/sysint/pull/462) -- Hotfix 4.2.1v8 [`#475`](https://github.com/rdkcentral/sysint/pull/475) -- RDKEMW-13932: Move Bluetooth Mac update from Device Details to Bluetooth Service [`#458`](https://github.com/rdkcentral/sysint/pull/458) -- RDKEMW-13691: Increase Timeout for NTP PartnerURL Read [`#456`](https://github.com/rdkcentral/sysint/pull/456) -- RDKEMW-13425: Remove monarch process name for core upload [`#452`](https://github.com/rdkcentral/sysint/pull/452) -- RDKEMW-13061: Include utility indepenent of T2 for telemetry upload [`#443`](https://github.com/rdkcentral/sysint/pull/443) -- sysint 4.2.1 hotfix release [`35cd500`](https://github.com/rdkcentral/sysint/commit/35cd5003a10a61c13830955014d04822d952f104) -- Sysint 4.2.1 hotfix release [`c542d88`](https://github.com/rdkcentral/sysint/commit/c542d88c469198d0d7c5b55503635a88697beaa3) -- Sysint 4.2.1v13 hotfix release [`27c5acd`](https://github.com/rdkcentral/sysint/commit/27c5acd0f90ce3cacb99383139d441289f56526f) - -#### [6.0.1](https://github.com/rdkcentral/sysint/compare/6.0.0...6.0.1) - -> 20 July 2026 - ->>>>>>> 4.2.1v17 - RDKE-1065: Automated workflow - create pull request to main instead of develop [`#572`](https://github.com/rdkcentral/sysint/pull/572) - RDKEMW-20916 : [RDKE] [Develop] RDKV-to-RDKE Migration: Unexpected Network Connectivity Prior to Migration Completion [`#571`](https://github.com/rdkcentral/sysint/pull/571) - RDKEMW-10439: Reboot device with WareHouse plugin resetDevice [`#381`](https://github.com/rdkcentral/sysint/pull/381) - RDKEMW-21159: avoid thermal call in deepsleep (#548) [`#566`](https://github.com/rdkcentral/sysint/pull/566) - RDKE-1065: Automated Component release workflow [`#562`](https://github.com/rdkcentral/sysint/pull/562) - RDKE-1065: Using ubuntu-latest runner for release workflow [`#557`](https://github.com/rdkcentral/sysint/pull/557) -<<<<<<< HEAD -======= -- 6.0.1 release changelog updates [`658364b`](https://github.com/rdkcentral/sysint/commit/658364b56e7ee794ff8f53b1fa88106a6e8ae007) ->>>>>>> 4.2.1v17 - Merge tag '6.0.0' into develop [`e96c345`](https://github.com/rdkcentral/sysint/commit/e96c34560bc16714dec958463ebf64772902f45d) ### [6.0.0](https://github.com/rdkcentral/sysint/compare/5.1.0...6.0.0) diff --git a/etc/common.properties b/etc/common.properties index 060fbafc..02481239 100755 --- a/etc/common.properties +++ b/etc/common.properties @@ -25,13 +25,8 @@ REBOOT_INTERVAL=36 DEFAULT_IP=192.168.100.10 PROXY_FILE="/opt/persistent/usr/1112/703e/proxy-is-up" LOG_PATH=/var/log -CRASH_SVR=10.252.186.187 -DEFAULT_PROXY_IP=10.253.96.38 DEFAULT_PROXY_PORT=8080 -CDL_SERVER=10.253.97.212:8080 -IMAGE_SERVER=10.253.97.212 POTOMAC_SVR=69.252.107.55 -TFTP_SVR=10.253.97.214 DUMP_EXTN=core.prog* PERF_TEST=1 BUILD_VERSION=33.33.33p33d15_EXP diff --git a/etc/config.properties b/etc/config.properties index 5608c0c1..24e1dea9 100644 --- a/etc/config.properties +++ b/etc/config.properties @@ -19,21 +19,11 @@ # coredump upload settings -CRASH_SVR=10.252.186.187 PORTAL_URL= POTOMAC_USER=ccpstbscp POTOMAC_IDENTITY_FILE=/.ssh/id_dropbear CRASH_PORTAL_PATH="/opt/crashportal_uploads/coredumps/" CRASH_SERVER_COREDUMP_PORT=2199 -CRASH_SERVER_COREDUMP_USER=coredumps_upload -CRASH_SERVER_COREDUMP_PASS=coredumps_upload CRASH_SERVER_MINIDUMP_PORT=2199 -CRASH_SERVER_MINIDUMP_USER=minidumps_upload -CRASH_SERVER_MINIDUMP_PASS=minidumps_upload POTOMAC_SVR=69.252.107.55 -TFTP_SVR=10.253.97.249 -# DCM & Log upload settings -LOG_SERVER=10.253.97.249 -DCM_LOG_SERVER=10.253.97.249 -DCM_LOG_SERVER_URL=10.253.97.249 diff --git a/lib/rdk/Start_MaintenanceTasks.sh b/lib/rdk/Start_MaintenanceTasks.sh index 88490b42..ba6671f6 100644 --- a/lib/rdk/Start_MaintenanceTasks.sh +++ b/lib/rdk/Start_MaintenanceTasks.sh @@ -98,6 +98,7 @@ runMaintenanceRFCTask() rfcLog "No RFC Bin/ Script" result=-1 fi + touch /tmp/.RFCsynccomplete # Handle both success (0) and acceptable warning (1) exit codes, flag other results as errors if [ "$result" -ne 0 ] && [ "$result" -ne 1 ]; then eventSender "MaintenanceMGR" "$MAINT_RFC_ERROR" diff --git a/lib/rdk/backup_logs.sh b/lib/rdk/backup_logs.sh deleted file mode 100755 index c087e159..00000000 --- a/lib/rdk/backup_logs.sh +++ /dev/null @@ -1,165 +0,0 @@ -#!/bin/sh -############################################################################## -# If not stated otherwise in this file or this component's LICENSE file the -# following copyright and licenses apply: -# -# Copyright 2020 RDK Management -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Purpose: This script is used to backup the Logs -# Scope: RDK devices -# Usage: This script is triggered by systemd service -############################################################################## - -. /etc/include.properties -. /etc/device.properties - -if [ -f /etc/env_setup.sh ]; then - . /etc/env_setup.sh -fi - -PREV_LOG_PATH="$LOG_PATH/PreviousLogs" -PREV_LOG_BACKUP_PATH="$LOG_PATH/PreviousLogs_backup" - -backupLog() { - timestamp=$(/bin/timestamp) - echo "$timestamp $0: $*" -} - -# create log workspace if not there -if [ ! -d "$LOG_PATH" ];then - mkdir -p "$LOG_PATH" -fi - -# create intermediate log workspace if not there -if [ ! -d $PREV_LOG_PATH ];then - mkdir -p $PREV_LOG_PATH -fi - -# create log backup workspace if not there -if [ ! -d $PREV_LOG_BACKUP_PATH ];then - mkdir -p $PREV_LOG_BACKUP_PATH -else - rm -rf $PREV_LOG_BACKUP_PATH/* -fi - -if [ $APP_PERSISTENT_PATH ];then - PERSISTENT_PATH=$APP_PERSISTENT_PATH -else - PERSISTENT_PATH=/opt/persistent -fi - -touch $PERSISTENT_PATH/logFileBackup - -# disk size check for recovery if /opt size > 90% -if [ -f /lib/rdk/disk_threshold_check.sh ];then - sh /lib/rdk/disk_threshold_check.sh 0 -fi - -backupAndRecoverLogs() -{ - source=$1 - destn=$2 - operation=$3 - s_extn=$4 - d_extn=$5 - - backupLog "backupAndRecoverLogs:start source=$source, destn=$destn, operation=$operation" - - for file in $(find $source -mindepth 1 -maxdepth 1 -type f -name "$s_extn*"); - do - $operation "$file" "$destn$d_extn${file/$source$s_extn/}" - done - backupLog "backupAndRecoverLogs:end" -} - -last_bootfile=$(find "$PREV_LOG_PATH" -name last_reboot) -if [ -f "$last_bootfile" ];then - rm -rf "$last_bootfile" -fi - -sysLog="messages.txt" -sysLogBAK1="bak1_messages.txt" -sysLogBAK2="bak2_messages.txt" -sysLogBAK3="bak3_messages.txt" - -if [ "$HDD_ENABLED" = "false" ]; then - backupLog "HDD disabled device" - BAK1="bak1_" - BAK2="bak2_" - BAK3="bak3_" - if [ ! -f "$PREV_LOG_PATH/$sysLog" ]; then - find $LOG_PATH -maxdepth 1 -mindepth 1 \( -type l -o -type f \) \( -iname "*.txt*" -o -iname "*.log*" -o -iname "*.bin*" -o -name "bootlog" \) -exec mv '{}' $PREV_LOG_PATH \; - if [ $? -ne 0 ]; then - backupLog "Error:Failed to Move the logs from $LOG_PATH to $PREV_LOG_PATH" - fi - elif [ ! -f "$PREV_LOG_PATH/$sysLogBAK1" ]; then - # box reboot within 8 minutes after reboot - backupAndRecoverLogs "$LOG_PATH/" "$PREV_LOG_PATH/" mv "" $BAK1 - elif [ ! -f "$PREV_LOG_PATH/$sysLogBAK2" ]; then - # box reboot within 8 minutes after reboot - backupAndRecoverLogs "$LOG_PATH/" "$PREV_LOG_PATH/" mv "" $BAK2 - elif [ ! -f "$PREV_LOG_PATH/$sysLogBAK3" ]; then - # box reboot within 8 minutes after reboot - backupAndRecoverLogs "$LOG_PATH/" "$PREV_LOG_PATH/" mv "" $BAK3 - else - # box reboot within 8 minutes after reboot - backupAndRecoverLogs "$PREV_LOG_PATH/" "$PREV_LOG_PATH/" mv "$BAK1" "" - backupAndRecoverLogs "$PREV_LOG_PATH/" "$PREV_LOG_PATH/" mv "$BAK2" "$BAK1" - backupAndRecoverLogs "$PREV_LOG_PATH/" "$PREV_LOG_PATH/" mv "$BAK3" "$BAK2" - backupAndRecoverLogs "$LOG_PATH/" "$PREV_LOG_PATH/" mv "" "$BAK3" - fi - - /bin/touch "$PREV_LOG_PATH/last_reboot" - - # logs cleanup after backup - backupLog "Clean up $LOG_PATH" - rm -rf $LOG_PATH/*.* - find $LOG_PATH -name "*-*-*-*-*M-" -exec rm -rf {} \; -else - backupLog "HDD enabled device" - if [ ! -f "$PREV_LOG_PATH/$sysLog" ]; then - backupLog "Move logs from $LOG_PATH to $PREV_LOG_PATH" - find $LOG_PATH -maxdepth 1 -mindepth 1 \( -type l -o -type f \) \( -iname "*.txt*" -o -iname "*.log*" -o -name "bootlog" \) -exec mv '{}' $PREV_LOG_PATH \; - /bin/touch $PREV_LOG_PATH/last_reboot - else - find "$PREV_LOG_PATH" -name last_reboot | xargs rm >/dev/null - timestamp=$(date "+%m-%d-%y-%I-%M-%S%p") - LogFilePathPerm="$PREV_LOG_PATH/logbackup-$timestamp" - mkdir -p "$LogFilePathPerm" - backupLog "Move logs from $LOG_PATH to $LogFilePathPerm" - find "$LOG_PATH" -maxdepth 1 -mindepth 1 \( -type l -o -type f \) \( -iname "*.txt*" -o -iname "*.log*" -o -name "bootlog" \) -exec mv '{}' "$LogFilePathPerm" \; - /bin/touch "$LogFilePathPerm/last_reboot" - fi -fi - -if [ -f /tmp/disk_cleanup.log ];then - mv /tmp/disk_cleanup.log "$LOG_PATH" -fi - -if [ -f /tmp/mount_log.txt ];then - mv /tmp/mount_log.txt "$LOG_PATH" -fi - -if [ -f /tmp/mount-ta_log.txt ];then -    mv /tmp/mount-ta_log.txt "$LOG_PATH" -fi - -cp /version.txt "$LOG_PATH" -cp /etc/skyversion.txt "${LOG_PATH}/skyversion.txt" -cp /etc/rippleversion.txt "${LOG_PATH}/rippleversion.txt" - -backupLog "Send systemd notification ..." -/bin/systemd-notify --ready --status="Logs Backup Done..!" - diff --git a/lib/rdk/core_shell.sh b/lib/rdk/core_shell.sh index f9527abd..370e865f 100755 --- a/lib/rdk/core_shell.sh +++ b/lib/rdk/core_shell.sh @@ -335,11 +335,7 @@ if [ "$1" = "xcal-discovery-" ] || [ "$1" = "xdiscovery" ] || [ "$1" = "IARMDae [ "$1" = "NWMgrPlugin" ] || [ "$1" = "nm_event_thrd" ] || [ "$1" = "Monitor::IResou" ] || [ "$1" = "DRMSYSTEM" ] || [ "$1" = "HTTPREQUEST_MAN" ] || [ "$1" = "civetweb-worker" ] || [ "$1" = "nfrtool" ] || -<<<<<<< HEAD [ "$1" = "OCDM_WVMediaKey" ] || [ "$1" = "OCDM_SaThread" ] || [ "$1" = "multiqueue28:sr" ]; then -======= - [ "$1" = "OCDM_WVMediaKey" ] || [ "$1" = "OCDM_SaThread" ]; then ->>>>>>> 4.2.1v17 dumpFile exit 0 fi diff --git a/lib/rdk/getDeviceDetails.sh b/lib/rdk/getDeviceDetails.sh index e1e0621b..b7899312 100755 --- a/lib/rdk/getDeviceDetails.sh +++ b/lib/rdk/getDeviceDetails.sh @@ -285,11 +285,7 @@ getBluetoothMac() if [ -f /lib/rdk/readBTAddress-vendor.sh ]; then bluetooth_mac=`sh /lib/rdk/readBTAddress-vendor.sh` else -<<<<<<< HEAD bluetooth_mac=`sh /lib/rdk/readBTAddress-generic.sh` -======= - bluetooth_mac=`sh /lib/rdk/readBTAddress-generic.sh` ->>>>>>> 4.2.1v17 fi echo "$bluetooth_mac" diff --git a/lib/rdk/networkConnectionRecovery.sh b/lib/rdk/networkConnectionRecovery.sh index 6937bf45..efdeae54 100755 --- a/lib/rdk/networkConnectionRecovery.sh +++ b/lib/rdk/networkConnectionRecovery.sh @@ -222,31 +222,21 @@ checkWifiDrvErrors() checkPacketLoss() { version=$1 -<<<<<<< HEAD -======= packetLoss="" ->>>>>>> 4.2.1v17 currentTime=$(($(date +%s))) if [ -f "/tmp/checkpacketloss" ] ; then if [ "$version" = "V4" ] ; then gwIp=$(cat /tmp/checkpacketloss) pingCmd="ping" -<<<<<<< HEAD -======= else gwIp="" ->>>>>>> 4.2.1v17 fi else if [ "$version" = "V4" ] ; then gwIp=$(/sbin/ip -4 route | awk '/default/ { print $3 }' | head -n1 | awk '{print $1;}') -<<<<<<< HEAD - pingCmd="ping" -======= gwIp_interface=$(/sbin/ip -4 route | awk '/default/ { print $5 }' | head -n1 | awk '{print $1;}') pingCmd="ping -I $gwIp_interface" ->>>>>>> 4.2.1v17 elif [ "$version" = "V6" ] ; then gwIp=$(/sbin/ip -6 route | awk '/default/ { print $3 }' | head -n1 | awk '{print $1;}') gwIp_interface=$(/sbin/ip -6 route | awk '/default/ { print $5 }' | head -n1 | awk '{print $1;}') @@ -256,31 +246,6 @@ checkPacketLoss() if [ "$gwIp" != "" ] && [ "$gwIp" != "dev" ] ; then gwResponse=$($pingCmd -c "$pingCount" -i "$pingInterval" "$gwIp") -<<<<<<< HEAD - ret=$(echo "$gwResponse" | grep "packet"|awk '{print $7}'|cut -d'%' -f1) - - if [ "$version" = "V4" ] ; then - packetsLostipv4=$ret - elif [ "$version" = "V6" ] ; then - packetsLostipv6=$ret - fi - - gwResponseTime=$(echo "$gwResponse" | sed '$!d;s|.*/\([0-9.]*\)/.*|\1|') - if [ "$(($GatewayLogTimeStamp+$GatewayLoggingInterval))" -le "$currentTime" ] ; then - echo "$(/bin/timestamp) $version gateway = $gwIp " >> "$logsFile" - if [ "$ret" = "100" ] ; then - echo "$(/bin/timestamp) TELEMETRY_GATEWAY_RESPONSE_TIME:NR,$gwIp" >> "$logsFile" - echo "$(/bin/timestamp) Current Packet loss is SYST_WARN_GW100PERC_PACKETLOSS" - t2CountNotify "SYST_WARN_GW100PERC_PACKETLOSS" - else - echo "$(/bin/timestamp) TELEMETRY_GATEWAY_RESPONSE_TIME:$gwResponseTime,$gwIp" >> "$logsFile" - fi - echo "$(/bin/timestamp) TELEMETRY_GATEWAY_PACKET_LOSS:$ret,$gwIp" >> "$logsFile" - fi - else - if [ "$(($GatewayLogTimeStamp+$GatewayLoggingInterval))" -le "$currentTime" ] ; then - echo "$(/bin/timestamp) TELEMETRY_GATEWAY_NO_ROUTE_$version" >> "$logsFile" -======= packetLoss=$(echo "$gwResponse" | grep "packet"|awk '{print $7}'|cut -d'%' -f1) if [ "$version" = "V4" ] ; then @@ -309,31 +274,12 @@ checkPacketLoss() else if [ "$(($GatewayLogTimeStamp+$GatewayLoggingInterval))" -le "$currentTime" ] ; then log "TELEMETRY_GATEWAY_NO_ROUTE_$version" ->>>>>>> 4.2.1v17 t2CountNotify "WIFIV_INFO_NO${version}ROUTE" fi fi [ "$(($GatewayLogTimeStamp+$GatewayLoggingInterval))" -le "$currentTime" ] && GatewayLogTimeStamp=$(($(date +%s))) -<<<<<<< HEAD - #Send telemetry notification for 20%,30%....90% packet loss - if [ "$packetsLostipv4" -gt "$lossThreshold" ] || [ "$packetsLostipv6" -gt "$lossThreshold" ] ; then - echo "$(/bin/timestamp) Packet loss more than $lossThreshold% observed." >> "$logsFile" - if [ "$packetsLostipv4" -ne 100 ] && [ "$packetsLostipv6" -ne 100 ]; then - for i in {1..9}; do - if ([ "$packetsLostipv4" -ge $((i*10)) ] && [ "$packetsLostipv4" -lt $((i*10+10)) ]) || ([ "$packetsLostipv6" -ge $((i*10)) ] && [ "$packetsLostipv6" -lt $((i*10+10)) ]); then - echo "$(/bin/timestamp) Current Packet loss is WIFIV_WARN_PL_"$((i*10))"PERC" >> "$logsFile" - t2CountNotify "WIFIV_WARN_PL_"$((i*10))"PERC" - break - fi - done - fi - else - if [ "$packetsLostipv4" -ne 0 ] && [ "$packetsLostipv6" -ne 0 ]; then - #Send telemetry notification for 10% packet loss - echo "$(/bin/timestamp) Current Packet loss is WIFIV_WARN_PL_10PERC" >> "$logsFile" -======= #Send telemetry notification for 20%,30%....90% packet loss if [ -n "$packetLoss" ] ; then if [ "$packetLoss" -gt "$lossThreshold" ] ; then @@ -350,39 +296,10 @@ checkPacketLoss() elif [ "$packetLoss" -ne 0 ] ; then #Send telemetry notification for 10% packet loss log "$version packet loss is WIFIV_WARN_PL_10PERC" ->>>>>>> 4.2.1v17 t2CountNotify "WIFIV_WARN_PL_10PERC" fi fi -<<<<<<< HEAD - if [ "$packetsLostipv4" -ge "$WifiReassociateTolerance" ] && [ "$packetsLostipv6" -ge "$WifiReassociateTolerance" ]; then - echo "$(/bin/timestamp) ${WifiReassociateTolerance}% Packet loss is observed for both ipv4 and ipv6." >> "$logsFile" - #Note down $FirstPacketLossTime when threshold packetloss is detected for the first time - [ "$FirstPacketLossTime" -eq 0 ] && FirstPacketLossTime=$(($(date +%s))) - #Note down $PacketLossLogTimeStamp when PacketLossLogTimeStamp is 0 - [ "$PacketLossLogTimeStamp" -eq 0 ] && PacketLossLogTimeStamp=$(($(date +%s))) - #Note down $EthernetLogTimeStamp when EthernetLogTimeStamp is 0 and ethernet connected - [ "$IsEthernetConnected" -eq 1 ] && [ "$EthernetLogTimeStamp" -eq 0 ] && EthernetLogTimeStamp=$(($(date +%s))) - return 1 - fi - - #Reset tmp parameters to default values only after both V4 and V6 are measured (on V6 call). - #Resetting on V4 check alone would be premature because packetsLostipv6 is still 0 (script init) - #at that point, causing FirstPacketLossTime to be incorrectly cleared before V6 is measured. - #Reset if either V4 or V6 is below the reassociate tolerance, indicating recovery on at least one path. - if [ "$version" = "V6" ] && { [ "$packetsLostipv4" -lt "$WifiReassociateTolerance" ] || [ "$packetsLostipv6" -lt "$WifiReassociateTolerance" ]; }; then - echo "$(/bin/timestamp) [DEBUG_NCR] checkPacketLoss: BELOW TOLERANCE returning 0 - resetting FirstPacketLossTime/PacketLossLogTimeStamp/IsWifiReassociated. wifiDriverErrors=$wifiDriverErrors" >> "$logsFile" - FirstPacketLossTime=0 - PacketLossLogTimeStamp=0 - EthernetLogTimeStamp=0 - IsWifiReassociated=0 - [ "$wifiDriverErrors" -eq 0 ] && IsWifiReset=0 #Make IsWifiReset=0 only when there is no wifidriverissue - else - echo "$(/bin/timestamp) [DEBUG_NCR] checkPacketLoss: BELOW TOLERANCE returning 0 - skipping reset (version=$version, waiting for V6 measurement). wifiDriverErrors=$wifiDriverErrors" >> "$logsFile" - fi - -======= #Evaluate the packet-loss trigger only on the V6 call, once both stacks have #been probed (globals set during the preceding V4 call persist here). Classify #each routed stack as good (loss < tolerance = acceptable connectivity) or bad @@ -462,7 +379,6 @@ checkPacketLoss() fi fi ->>>>>>> 4.2.1v17 return 0 } diff --git a/lib/rdk/rebootNow.sh b/lib/rdk/rebootNow.sh deleted file mode 100755 index 15a40b45..00000000 --- a/lib/rdk/rebootNow.sh +++ /dev/null @@ -1,489 +0,0 @@ -#!/bin/sh -############################################################################## -# If not stated otherwise in this file or this component's LICENSE file the -# following copyright and licenses apply: -# -# Copyright 2020 RDK Management -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## - -. /etc/include.properties -. /etc/device.properties -. /etc/env_setup.sh - -# The reboot cmd is aliased to "reboot -f" in env_setup.sh. Remove force reboot as it causing HDD corruption. -if [ -f /etc/os-release ];then - alias reboot='/sbin/reboot' -fi - -if [ -f /lib/rdk/t2Shared_api.sh ]; then - source /lib/rdk/t2Shared_api.sh -fi - -REBOOT_REASON_LOGFILE="/opt/logs/rebootreason.log" -rebootLog() { - echo "`/bin/timestamp` :$0: $*" >> $REBOOT_REASON_LOGFILE -} - -#Usage: rebootNow.sh [-c "" | -s ""][-r ""][-o ""] -usage() -{ - rebootLog "USAGE: rebootNow.sh -c/-s -r -o " - rebootLog " -s : Source Module or Script Name" - rebootLog " -c : Crash Process Name" - rebootLog " -r : Reason to specify for any particular reason: default=Unknown" - rebootLog " -o : Reason to request for the reboot: default=Unknown" -} - -if [ $# -lt 2 ]; then - rebootLog "Exiting as no argument specified to identify source of reboot!!!" - usage - exit 1 -elif [[ "$3" == "-s" || "$3" == "-c" ]]; then - rebootLog "Exiting as invalid arguments found!!!" - usage - exit 1 -fi - -# Save reboot details in /opt/secure/reboot folder. -REBOOT_INFO_DIR="/opt/secure/reboot" -REBOOT_INFO_FILE="/opt/secure/reboot/reboot.info" -PREVIOUSREBOOT_INFO_FILE="/opt/secure/reboot/previousreboot.info" -PARODUS_REBOOT_INFO_FILE="/opt/secure/reboot/parodusreboot.info" -REBOOTINFO_LOGFILE="/opt/logs/rebootInfo.log" -REBOOTNOW_FLAG="/opt/secure/reboot/rebootNow" -REBOOTSTOP_FLAG="/opt/secure/reboot/rebootStop" -REBOOT_COUNTER="/opt/secure/reboot/rebootCounter" -REBOOTSTOP_DURATION=$(tr181 Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.RebootStop.Duration 2>&1 > /dev/null) -REBOOTSTOP_DETECTION=$(tr181 Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.RebootStop.Detection 2>&1 > /dev/null) -REBOOT_WINDOW=10 -REBOOT_WINDOW_SECS=$((REBOOT_WINDOW * 60)) -REBOOT_CYCLE_THRESHOLD=5 -CYCLIC_REBOOT_SOURCE="rebootNow.sh" -CYCLIC_REBOOT_REASON="Rebooting device after expiry of Cyclic reboot pause window" -CDLFILE=$(cat /opt/cdl_flashed_file_name) -PREV_CDLFILE=$(cat /tmp/currently_running_image_name) -# Define Reasons for APP_TRIGGERED, OPS_TRIGGERED and MAINTENANCE_TRIGGERED cases -APP_TRIGGERED_REASONS=(Servicemanager systemservice_legacy WarehouseReset WarehouseService HrvInitWHReset HrvColdInitReset HtmlDiagnostics InstallTDK StartTDK TR69Agent SystemServices Bsu_GUI SNMP CVT_CDL Nxserver DRM_Netflix_Initialize hrvinit PaceMFRLibrary) -OPS_TRIGGERED_REASONS=(ScheduledReboot RebootSTB.sh FactoryReset UpgradeReboot_firmwareDwnld.sh UpgradeReboot_restore XFS wait_for_pci0_ready websocketproxyinit NSC_IR_EventReboot host_interface_dma_bus_wait usbhotplug Receiver_MDVRSet Receiver_VidiPath_Enabled Receiver_Toggle_Optimus S04init_ticket Network-Service monitor.sh ecmIpMonitor.sh monitorMfrMgr.sh vlAPI_Caller_Upgrade ImageUpgrade_rmf_osal ImageUpgrade_mfr_api ImageUpgrade_updateNewImage.sh ImageUpgrade_userInitiatedFWDnld.sh ClearSICache tr69hostIfReset hostIf_utils hostifDeviceInfo HAL_SYS_Reboot UpgradeReboot_deviceInitiatedFWDnld.sh UpgradeReboot_rdkvfwupgrader UpgradeReboot_ipdnl.sh PowerMgr_Powerreset PowerMgr_coldFactoryReset DeepSleepMgr PowerMgr_CustomerReset PowerMgr_PersonalityReset Power_Thermmgr PowerMgr_Plat HAL_CDL_notify_mgr_event vldsg_estb_poll_ecm_operational_state BcmIndicateEcmReset SASWatchDog BP3_Provisioning eMMC_FW_UPGRADE BOOTLOADER_UPGRADE cdl_service BCMCommandHandler BRCM_Image_Validate docsis_mode_check.sh tch_nvram.sh Receiver CANARY_Update boot_FSR) -MAINTENANCE_TRIGGERED_REASONS=(AutoReboot.sh PwrMgr) -pid_file="/tmp/.rebootNow.pid" -customReason="Unknown" -otherReason="Unknown" - -touch $REBOOTINFO_LOGFILE - -rebootLog "Start of rebootNow script" - -pidCleanup() -{ - if [ -f "$pid_file" ];then - rm -rf "$pid_file" - fi -} - -trap pidCleanup EXIT - -# exit if an instance is already running -rebootLog "Checking multiple instance of rebootNow.sh script" -if [ -f $pid_file ];then - pid=`cat $pid_file` - if [ -d /proc/$pid -a -f /proc/$pid/cmdline ]; then - processName=`cat /proc/$pid/cmdline` - currentprocessName=`cat /proc/$$/cmdline` - rebootLog "proc entry process name: $processName and running process name $currentprocessName" - if echo "$processName" | grep -q `basename $0`; then - rebootLog "An instance of "$0" with pid $pid is already running.." - rebootLog "Exiting script!!!" - exit 1 - fi - fi -fi -echo $$ > $pid_file - -while getopts ":s:c:r:o:" opt; do - case $opt in - s) - source=$OPTARG - rebootLogReason="Triggered from $source process" - case $source in - runPodRecovery) - t2CountNotify "SYST_ERR_RunPod_reboot" - ;; - CardNotResponding) - t2CountNotify "SYST_ERR_CCNotRepsonding_reboot" - ;; - *) - t2CountNotify "SYST_ERR_$source" - ;; - esac - ;; - c) - source=$OPTARG - rebootLogReason="Triggered from $source process failure or crash..!" - case $source in - dsMgrMain) - t2CountNotify "SYST_ERR_DSMGR_reboot" - ;; - IARMDaemonMain) - t2CountNotify "SYST_ERR_IARMDEMON_reboot" - ;; - rmfStreamer) - t2CountNotify "SYST_ERR_Rmfstreamer_reboot" - ;; - runPod) - t2CountNotify "SYST_ERR_RunPod_reboot" - ;; - *) - t2CountNotify "SYST_ERR_$source_reboot" - ;; - esac - ;; - r) - customReason=$OPTARG - ;; - o) - otherReason=$OPTARG - ;; - \?) - rebootLog "Invalid option: -$OPTARG" - ;; - esac -done - -rebootLog "Reboot requested on the device from Source:$source Reason:$otherReason" - -# Assign rebootreason from source category. -if [[ "${APP_TRIGGERED_REASONS[@]}" == *"$source"* ]];then - rebootReason="APP_TRIGGERED" - if [ $customReason == "MAINTENANCE_REBOOT" ];then - rebootReason="MAINTENANCE_REBOOT" - fi -elif [[ "${OPS_TRIGGERED_REASONS[@]}" == *"$source"* ]];then - rebootReason="OPS_TRIGGERED" -elif [[ "${MAINTENANCE_TRIGGERED_REASONS[@]}" == *"$source"* ]];then - rebootReason="MAINTENANCE_REBOOT" -else - rebootReason="FIRMWARE_FAILURE" -fi - -NewCronHr=0 -NewCronMin=0 -SECS_THRESHOLD=29 -MINS_THRESHOLD=59 -HOUR_THRESHOLD=23 - -getNewCronTime() { - # date is defined as alias of date -u. Due to this on llama uk delay download is not working. - # So removed alias and use only date for cron job schedule. - now=$(\date +"%T") - rebootLog "current time: $now" - NewCronHr=$(echo $now | cut -d':' -f1) - NewCronMin=$(echo $now | cut -d':' -f2) - Sec=$(echo $now | cut -d':' -f3) - - if [ $Sec -gt $SECS_THRESHOLD ]; then - NewCronMin=`expr $NewCronMin + 1` - fi - - NewCronMin=`expr $NewCronMin + $1` - - while [ $NewCronMin -gt $MINS_THRESHOLD ] - do - NewCronMin=`expr $NewCronMin - 60` - NewCronHr=`expr $NewCronHr + 1` - if [ $NewCronHr -gt $HOUR_THRESHOLD ]; then - NewCronHr=0 - fi - done - - echo "*/$NewCronMin $NewCronHr * * *" -} - -#Add the reboot reason check here -reboot_counter_reset=0 -if [ -f $REBOOTNOW_FLAG ] && [ "$REBOOTSTOP_DETECTION" != "false" ];then - rebootLog "Previous Reboot happened on the device was triggred by RDK software" - rebootLog "Reboot Loop Detection enabled to check cyclic reboot scenarios:$REBOOTSTOP_DETECTION" - rm -rf $REBOOTNOW_FLAG - if [ -f $PREVIOUSREBOOT_INFO_FILE ];then - prev_reboot_source=$(grep '"source"' "$PREVIOUSREBOOT_INFO_FILE" | sed -E 's/.*"source":"([^"]+)".*/\1/') - prev_reboot_reason=$(grep '"reason"' "$PREVIOUSREBOOT_INFO_FILE" | sed -E 's/.*"reason":"([^"]+)".*/\1/') - prev_reboot_customreason=$(grep '"customReason"' "$PREVIOUSREBOOT_INFO_FILE" | sed -E 's/.*"customReason":"([^"]+)".*/\1/') - prev_reboot_otherreason=$(grep '"otherReason"' "$PREVIOUSREBOOT_INFO_FILE" | sed -E 's/.*"otherReason":"([^"]+)".*/\1/') - prev_reboot_time=$(grep '"timestamp"' "$PREVIOUSREBOOT_INFO_FILE" | sed -E 's/.*"timestamp":"([^"]+)".*/\1/') - rebootLog "Previous Reboot Information of the Device:" - rebootLog "Time:$prev_reboot_time" - rebootLog "Source:$prev_reboot_source" - rebootLog "Reason:$prev_reboot_reason" - rebootLog "customReason:$prev_reboot_customreason" - rebootLog "otherReason:$prev_reboot_otherreason" - - current_reboot_source="$source" - current_reboot_reason="$rebootReason" - current_reboot_customreason="$customReason" - current_reboot_otherreason="$otherReason" - current_device_uptime=`cat /proc/uptime | awk '{print $1}' | sed "s/\..*//"` - rebootLog "Device Uptime from last reboot: $current_device_uptime secs" - - rebootLog "Current Requested Reboot Information:" - rebootLog "Source:$current_reboot_source" - rebootLog "Reason:$current_reboot_reason" - rebootLog "customReason:$current_reboot_customreason" - rebootLog "otherReason:$current_reboot_otherreason" - if [[ $current_device_uptime -le "$REBOOT_WINDOW_SECS" ]]; then - rebootLog "Reboot requested before the $REBOOT_WINDOW mins, checking reboot reason" - if [ "$current_reboot_source" == "$prev_reboot_source" ] && [ "$current_reboot_reason" == "$prev_reboot_reason" ] && - [ "$current_reboot_customreason" == "$prev_reboot_customreason" ] && [ "$current_reboot_otherreason" == "$prev_reboot_otherreason" ]; then - rebootLog "Reboot Reason for current and previous reboot is same" - if [ -f $REBOOTSTOP_FLAG ]; then - rebootLog "Reboot Operation Halted in the device to avoid continous reboots with same reason!!!" - touch $REBOOTNOW_FLAG - rebootLog "Exiting without rebooting the device" - exit 0 - else - reboot_count=`cat $REBOOT_COUNTER` - rebootLog "Checking device is stuck in cyclic reboot loop with same reboot reason, Current Iteration:$reboot_count" - if [ $reboot_count -ge $REBOOT_CYCLE_THRESHOLD ];then - rebootLog "Detected Reboot Loop in device, Halting reboot for next $REBOOTSTOP_DURATION mins to perform operations!!!" - touch $REBOOTSTOP_FLAG - tr181 -s -v true Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.RebootStop.Enable - rebootstopvalue=`tr181 -g Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.RebootStop.Enable 2>&1 > /dev/null` - rebootLog "Publishing Reboot Stop Enable Event:$rebootstopvalue" - t2CountNotify "SYST_ERR_Cyclic_reboot" - # Remove any old Reboot Cron Jobs - sh /lib/rdk/cronjobs_update.sh "remove" "rebootNow.sh" - REBOOT_CRON_INTERVAL_TIME=$(getNewCronTime $REBOOTSTOP_DURATION) - rebootLog "Scheduling Cron for rebootNow.sh as a part of Cyclic reboot operations: $REBOOT_CRON_INTERVAL_TIME" - sh /lib/rdk/cronjobs_update.sh "add" "rebootNow.sh" "$REBOOT_CRON_INTERVAL_TIME /bin/sh /lib/rdk/rebootNow.sh -s \"$CYCLIC_REBOOT_SOURCE\" -o \"$CYCLIC_REBOOT_REASON\"" - rebootLog "Device will reboot in $REBOOTSTOP_DURATION mins after expiry of Cyclic reboot pause window!!!" - touch $REBOOTNOW_FLAG - exit 0 - else - reboot_count=$((reboot_count + 1)) - echo $reboot_count > $REBOOT_COUNTER - fi - fi - else - rebootLog "Reboot requested before the $REBOOT_WINDOW mins reboot loop window with different reason" - reboot_counter_reset=1 - fi - else - rebootLog "Reboot requested after the $REBOOT_WINDOW mins reboot loop window" - reboot_counter_reset=1 - fi - else - rebootLog "$PREVIOUSREBOOT_INFO_FILE file not found, proceed without reboot reason check!!!" - reboot_counter_reset=1 - fi -else - if [ ! -f $REBOOTNOW_FLAG ]; then - rebootLog "Last reboot was not triggered by rebootNow.sh script" - else - rebootLog "Reboot Loop Detection disabled to check cyclic reboot scenarios:$REBOOTSTOP_DETECTION" - fi - reboot_counter_reset=1 -fi - -#Reset cyclic reboot counter -if [ $reboot_counter_reset == 1 ];then - rebootLog "Publishing Reboot Stop Disable Event" - tr181 -s -v false Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.RebootStop.Enable - rebootLog "Reboot Loop Detection counter reset as device not in reboot loop" - echo 0 > $REBOOT_COUNTER - rm -rf $REBOOTSTOP_FLAG -fi - -syncLog() -{ - if [ -d "$TEMP_LOG_PATH" ]; then - rebootLog "${FUNCNAME[0]}: Find and move the logs from $TEMP_LOG_PATH to $LOG_PATH" - cWD=`pwd` - syncPath=`find $TEMP_LOG_PATH -type l -exec ls -l {} \; | cut -d ">" -f2 | tr -d ' '` - if [ "$syncPath" != "$LOG_PATH" ];then - cd "$TEMP_LOG_PATH" - for file in `ls *.txt *.log` - do - cat $file >> $LOG_PATH/$file - cat /dev/null > $file - done - cd $cWD - else - rebootLog "${FUNCNAME[0]}: Sync Not needed, Same log folder" - fi - else - rebootLog "${FUNCNAME[0]}: $TEMP_LOG_PATH not found!!!" - fi -} - -# Save the reboot info with all the fields -setPreviousRebootInfo() -{ - rebootLog "${FUNCNAME[0]}: Saving reboot info in $REBOOT_INFO_FILE file" - timestamp=$1 - source=$2 - reason=$3 - custom=$4 - other=$5 - echo "{" > $REBOOT_INFO_FILE - echo "\"timestamp\":\"$timestamp\"," >> $REBOOT_INFO_FILE - echo "\"source\":\"$source\"," >> $REBOOT_INFO_FILE - echo "\"reason\":\"$reason\"," >> $REBOOT_INFO_FILE - echo "\"customReason\":\"$custom\"," >> $REBOOT_INFO_FILE - echo "\"otherReason\":\"$other\"" >> $REBOOT_INFO_FILE - echo "}" >> $REBOOT_INFO_FILE - - echo "PreviousRebootInfo:$timestamp,$custom,$source,$reason" >> $PARODUS_REBOOT_INFO_FILE - rebootLog "${FUNCNAME[0]}: Updated Reboot Reason information in $REBOOT_INFO_FILE and $PARODUS_REBOOT_INFO_FILE" -} - -# Log reboot information to rebootInfo.log file -rebootTime=`date -u` - -if [ "$otherReason" == "Unknown" ]; then - echo "RebootReason: $rebootLogReason" >> $REBOOTINFO_LOGFILE -else - echo "RebootReason: $rebootLogReason $otherReason" >> $REBOOTINFO_LOGFILE -fi -echo "RebootInitiatedBy: $source" >> $REBOOTINFO_LOGFILE -echo "RebootTime: $rebootTime" >> $REBOOTINFO_LOGFILE -echo "CustomReason: $customReason" >> $REBOOTINFO_LOGFILE -echo "OtherReason: $otherReason" >> $REBOOTINFO_LOGFILE - -# Create /opt/secure/reboot/ folder before reboot/shutdown. -if [ ! -d $REBOOT_INFO_DIR ]; then - rebootLog "Creating $REBOOT_INFO_DIR folder" - mkdir $REBOOT_INFO_DIR -fi - -# Added check for Hal_SYS_reboot source -multipleSource=`grep -E HAL_SYS_Reboot $REBOOTINFO_LOGFILE` -if [ -z "$multipleSource" ];then - rebootSource=$source -else - rebootSource=`grep RebootReason $REBOOTINFO_LOGFILE | grep -v HAL_SYS_Reboot | grep -v grep | awk -F " " '{print $5}'` - otherReason=`grep RebootReason $REBOOTINFO_LOGFILE | grep -v HAL_SYS_Reboot | grep -v grep | awk -F 'HAL_CDL_notify_mgr_event' '{print $NF}' | sed 's/(.*//'` -fi - -# Save reboot details in reboot.info file under /opt/secure/reboot folder -rebootLog "Invoke setPreviousRebootInfo to save reboot information under $REBOOT_INFO_DIR folder" -setPreviousRebootInfo "$rebootTime" "$rebootSource" "$rebootReason" "$customReason" "$otherReason" - -isMmgbleNotifyEnabled=$(tr181 Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.ManageableNotification.Enable 2>&1 > /dev/null) -rebootLog "Value of Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.ManageableNotification.Enable: $isMmgbleNotifyEnabled" -if [ "${isMmgbleNotifyEnabled}" == "true" ];then - tr181 -s -v 10 Device.DeviceInfo.X_RDKCENTRAL-COM_xOpsDeviceMgmt.RPC.RebootPendingNotification -fi - -#### -# All housekeeping before actual device reboot starts from here -#### - -# Signal telemetry2_0 to send out any pending messages before reboot -rebootLog "Signal telemetry2_0 to send out any pending messages before reboot" -killall -s SIGIO telemetry2_0 - -# Kill the Parodus Process; So that it can close the WebSocket Connection with Server. -rebootLog "Properly shutdown parodus by sending SIGUSR1 kill signal" -killall -s SIGUSR1 parodus - -if [ -f /etc/rdm/rdm-manifest.xml ];then - if [[ ${CDLFILE} != *"${PREV_CDLFILE}"* ]]; then - if [ -d /media/apps ];then - rebootLog "Removing the RDM Apps content from Secondary Storage before Reboot (After IMage Upgrade)" - cd /media/apps - if [ $? -eq 0 ];then - for i in `ls -d */` - do - rm -rf $i - sleep 1 - done - fi - sleep 5 - fi - fi -fi - -if [ ! -f $PERSISTENT_PATH/.lightsleepKillSwitchEnable ];then - syncLog - if [ -f $TEMP_LOG_PATH/.systime ];then - cp $TEMP_LOG_PATH/.systime $PERSISTENT_PATH/ - fi -fi - -if [ "$DEVICE_NAME" = "XI6" ] || [ "$DEVICE_NAME" = "XiOne" ] || [ "$DEVICE_NAME" = "XiOne-SCB" ];then - if [ "$DEVICE_NAME" = "XI6" ];then - # Get eMMC Health report - if [ -f /lib/rdk/emmc_health_diag.sh ];then - sh /lib/rdk/emmc_health_diag.sh "reboot" - rebootLog "Updated eMMC Health report" - fi - fi - # See if we need to Upgrade the eMMC FW - if [ -f /lib/rdk/eMMC_Upgrade.sh ];then - rebootLog "Upgrade eMMC FW if required" - sh /lib/rdk/eMMC_Upgrade.sh - fi -fi - -if [ -f /lib/rdk/aps4_reset.sh ];then - rebootLog "Executing /lib/rdk/aps4_reset.sh" - sh /lib/rdk/aps4_reset.sh -fi - -if [ -f /lib/rdk/update_www-backup.sh ];then - rebootLog "Executing /lib/rdk/update_www-backup.sh" - sh /lib/rdk/update_www-backup.sh -fi - -#If bluetooth is enabled, gracefully shutdown the bluetooth related services -if [ "$BLUETOOTH_ENABLED" = "true" ];then - services=("ctrlm-main" "btmgr" "bluetooth" "bt-hciuart" "btmac-preset" "bt" "syslog-ng") - rebootLog "Shutting down the bluetooth and syslog-ng services gracefully" - for service in "${services[@]}"; do - rebootLog "Shutting down the $service service" - if /bin/systemctl --quiet is-active "$service"; then - /bin/systemctl stop "$service" - if [[ $? -eq 0 ]]; then - rebootLog "$service service stopped successfully" - else - rebootLog "Failed to stop $service service" - fi - else - rebootLog "$service service is not active" - fi - done -fi - -rebootLog "Start the sync" -sync -rebootLog "End of the sync" - -rebootLog "Creating $REBOOTNOW_FLAG as the reboot was triggred by RDK software" -touch $REBOOTNOW_FLAG -rm -rf $pid_file - -rebootLog "Rebooting the Device Now" -reboot & -REBOOT_PID=$! - -sleep 90 -rebootLog "System still running after reboot command, Reboot Failed for $REBOOT_PID..." -systemctl reboot -if [ $? -eq 1 ]; then - rebootLog "Reboot failed due to systemctl hang or connection timeout" -fi -kill $REBOOT_PID 2>/dev/null -rebootLog "Triggering force Reboot after standard soft reboot failure" -reboot -f diff --git a/lib/rdk/start_ssh.sh b/lib/rdk/start_ssh.sh index 4b4513a8..5ecb13cc 100755 --- a/lib/rdk/start_ssh.sh +++ b/lib/rdk/start_ssh.sh @@ -74,13 +74,18 @@ checkForInterface() fi } -DEVICETYPE=$(tr181 -d Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Identity.DeviceType 2>&1 > /dev/null) -if [ "$DEVICETYPE" = "TEST" ]; then - USE_DEVKEYS="-f authorized_keys_dev" - echo " dropbear using dev authorization keys" +if [ "BUILD_TYPE" != "dev" ]; then + DEVICETYPE=$(tr181 -d Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Identity.DeviceType 2>&1 > /dev/null) + if [ "$DEVICETYPE" = "TEST" ]; then + USE_DEVKEYS="-f authorized_keys_dev" + echo " dropbear using dev authorization keys" + else + USE_DEVKEYS="" + echo " dropbear using prod authorization keys" + fi else USE_DEVKEYS="" - echo " dropbear using prod authorization keys" + echo " Build type is dev , use dev authorization keys by default" fi /bin/systemctl set-environment USE_DEVKEYS="$USE_DEVKEYS" diff --git a/lib/rdk/system_info_collector.sh b/lib/rdk/system_info_collector.sh index 9532bc91..fea0ada0 100755 --- a/lib/rdk/system_info_collector.sh +++ b/lib/rdk/system_info_collector.sh @@ -69,10 +69,7 @@ MEM_AVAILABLE=$(cat /proc/meminfo | grep MemAvailable) echo $MEM_AVAILABLE >> $LOG_PATH/messages.txt MEM_AVAILABLE_VAL=$(echo "$MEM_AVAILABLE" | tr -s '[:space:]' ' ' | cut -d' ' -f2) t2ValNotify "SYST_INFO_MemAvailable_split" "$MEM_AVAILABLE_VAL" -<<<<<<< HEAD -======= ->>>>>>> 4.2.1v17 # Swap Memory Info echo "Available Swap Memory Info:" >> $LOG_PATH/messages.txt diff --git a/lib/rdk/timesyncd-conf-update.sh b/lib/rdk/timesyncd-conf-update.sh index 8c726157..59a389fe 100755 --- a/lib/rdk/timesyncd-conf-update.sh +++ b/lib/rdk/timesyncd-conf-update.sh @@ -82,11 +82,7 @@ get_ntp_hosts_from_bootstrap() { } -<<<<<<< HEAD ntpLog "Retrieve NTP Server URL from /lib/rdk/getPartnerProperty.sh..." -======= -ntpLog "Retrive NTP Server URL from /lib/rdk/getPartnerProperty.sh..." ->>>>>>> 4.2.1v17 while [ "$attempts" -le "$max_attempts" ]; do ntpLog "Attempt $attempts/$max_attempts to retrieve NTP server URL(s)..." diff --git a/lib/rdk/update_previous_reboot_info.sh b/lib/rdk/update_previous_reboot_info.sh deleted file mode 100755 index e92cdfae..00000000 --- a/lib/rdk/update_previous_reboot_info.sh +++ /dev/null @@ -1,487 +0,0 @@ -#!/bin/sh -############################################################################## -# If not stated otherwise in this file or this component's LICENSE file the -# following copyright and licenses apply: -# -# Copyright 2020 RDK Management -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## - -# Source Variable -. /etc/device.properties -if [ -f /lib/rdk/t2Shared_api.sh ]; then - source /lib/rdk/t2Shared_api.sh -fi - -# Define logfiles and flags -REBOOT_INFO_LOG_FILE="/opt/logs/rebootInfo.log" -KERNEL_LOG_FILE="/opt/logs/messages.txt" -UIMGR_LOG_FILE="/opt/logs/PreviousLogs/uimgr_log.txt" -OCAPRI_LOG_FILE="/opt/logs/PreviousLogs/ocapri_log.txt" -ECM_CRASH_LOG_FILE="/opt/logs/PreviousLogs/messages-ecm.txt" -PSTORE_CONSOLE_LOG_FILE="/sys/fs/pstore/console-ramoops-0" -KERNEL_PANIC_SEARCH_STRING="PREVIOUS_KERNEL_OOPS_DUMP" -KERNEL_PANIC_SEARCH_STRING_01="Kernel panic - not syncing" -KERNEL_PANIC_SEARCH_STRING_02="Oops - undefined instruction" -KERNEL_PANIC_SEARCH_STRING_03="Oops - bad syscall" -KERNEL_PANIC_SEARCH_STRING_04="branch through zero" -KERNEL_PANIC_SEARCH_STRING_05="unknown data abort code" -KERNEL_PANIC_SEARCH_STRING_06="Illegal memory access" -ECM_CRASH_SEARCH_STRING="\*\*\*\* CRASH \*\*\*\*" -MAX_REBOOT_STRING="Box has rebooted 10 times" -POWERON_STRING="POWER_ON" -REBOOT_INFO_DIR="/opt/secure/reboot" -REBOOT_INFO_FILE="/opt/secure/reboot/reboot.info" -PARODUS_REBOOT_INFO_FILE="/opt/secure/reboot/parodusreboot.info" -KEYPRESS_INFO_FILE="/opt/secure/reboot/keypress.info" -PREVIOUS_REBOOT_INFO_FILE="/opt/secure/reboot/previousreboot.info" -PREVIOUS_PARODUSREBOOT_INFO_FILE="/opt/secure/reboot/previousparodusreboot.info" -PREVIOUS_HARD_REBOOT_INFO_FILE="/opt/secure/reboot/hardpower.info" -PREVIOUS_KEYPRESS_INFO_FILE="/opt/secure/reboot/previouskeypress.info" -STT_FLAG="/tmp/stt_received" -REBOOT_INFO_FLAG="/tmp/rebootInfo_Updated" -UPDATE_REBOOT_INFO_INVOKED_FLAG="/tmp/Update_rebootInfo_invoked" -LOCK_DIR="/tmp/rebootInfo.lock" -PARODUS_LOG="/opt/logs/parodus.log" - -#Use log framework to pring timestamp and source script name -rebootLog() -{ - echo "$0: $*" -} - -rebootLog "Start of Reboot Reason Script" - -# Define Reasons for APP_TRIGGERED, OPS_TRIGGERED and MAINTENANCE_TRIGGERED cases -APP_TRIGGERED_REASONS=(Servicemanager systemservice_legacy WarehouseReset WarehouseService HrvInitWHReset HrvColdInitReset HtmlDiagnostics InstallTDK StartTDK TR69Agent SystemServices Bsu_GUI SNMP CVT_CDL Nxserver DRM_Netflix_Initialize hrvinit ) -OPS_TRIGGERED_REASONS=(ScheduledReboot RebootSTB.sh FactoryReset UpgradeReboot_restore XFS wait_for_pci0_ready websocketproxyinit NSC_IR_EventReboot host_interface_dma_bus_wait usbhotplug Receiver_MDVRSet Receiver_VidiPath_Enabled Receiver_Toggle_Optimus S04init_ticket Network-Service monitorMfrMgr.sh vlAPI_Caller_Upgrade ImageUpgrade_rmf_osal ImageUpgrade_mfr_api ImageUpgrade_userInitiatedFWDnld.sh ClearSICache tr69hostIfReset hostIf_utils hostifDeviceInfo HAL_SYS_Reboot UpgradeReboot_deviceInitiatedFWDnld.sh UpgradeReboot_rdkvfwupgrader UpgradeReboot_ipdnl.sh PowerMgr_Powerreset PowerMgr_coldFactoryReset DeepSleepMgr PowerMgr_CustomerReset PowerMgr_PersonalityReset Power_Thermmgr PowerMgr_Plat HAL_CDL_notify_mgr_event vldsg_estb_poll_ecm_operational_state SASWatchDog BP3_Provisioning eMMC_FW_UPGRADE BOOTLOADER_UPGRADE cdl_service docsis_mode_check.sh Receiver CANARY_Update) -MAINTENANCE_TRIGGERED_REASONS=(AutoReboot.sh PwrMgr) - -# Save the reboot info with all the fields -setPreviousRebootInfo() -{ - # Set Previous reboot info file with received reboot reason. - timestamp=$1 - source=$2 - reason=$3 - custom=$4 - other=$5 - # Get Previous Hard Power reset information - if [ ! -z $PREVIOUS_REBOOT_INFO_FILE ]; then - rebootLog "Reboot reason present in $PREVIOUS_REBOOT_INFO_FILE file:" - cat $PREVIOUS_REBOOT_INFO_FILE - fi - rebootLog "Updating Reboot reason in $PREVIOUS_REBOOT_INFO_FILE file" - echo "{" > $PREVIOUS_REBOOT_INFO_FILE - echo "\"timestamp\":\"$timestamp\"," >> $PREVIOUS_REBOOT_INFO_FILE - echo "\"source\":\"$source\"," >> $PREVIOUS_REBOOT_INFO_FILE - echo "\"reason\":\"$reason\"," >> $PREVIOUS_REBOOT_INFO_FILE - echo "\"customReason\":\"$custom\"," >> $PREVIOUS_REBOOT_INFO_FILE - echo "\"otherReason\":\"$other\"" >> $PREVIOUS_REBOOT_INFO_FILE - echo "}" >> $PREVIOUS_REBOOT_INFO_FILE - - rebootLog "Updating previous reboot reason in $PARODUS_LOG" - existing_reboot_info=$(grep "PreviousRebootInfo" "$PARODUS_LOG" 2>/dev/null | tail -1) - - if [ -z "$existing_reboot_info" ]; then - echo "$(/bin/timestamp) $0: Updating previous reboot info to Parodus" >> "$PARODUS_LOG" - echo "$(/bin/timestamp) $0: PreviousRebootInfo:$timestamp,$reason,$custom,$source" >> "$PARODUS_LOG" - rebootLog "Reboot Information Updated to parodus log:$timestamp,$reason,$custom,$source" - else - rebootLog "${FUNCNAME[0]}: Reboot info already present in $PARODUS_LOG as $existing_reboot_info, skipping update" - fi - - # Set Hard Power reset time with timestamp - if [ "$reason" == "HARD_POWER" ] || [ "$reason" == "POWER_ON_RESET" ] || [ "$reason" == "UNKNOWN_RESET" ] || [ ! -f "$PREVIOUS_HARD_REBOOT_INFO_FILE" ];then - echo "{" > $PREVIOUS_HARD_REBOOT_INFO_FILE - echo "\"lastHardPowerReset\":\"$timestamp\"" >> $PREVIOUS_HARD_REBOOT_INFO_FILE - echo "}" >> $PREVIOUS_HARD_REBOOT_INFO_FILE - rebootLog "Updated Hard Power Reboot Time stamp" - fi - - rebootLog "Updated Previous Reboot Reason information" -} - -# Check for Firmware Failure -fwFailureCheck() -{ - fw_failure=0 - rebootLog "Checking firmware failure cases (ECM Crash, Max Reboot etc)..." - - if [ "$DEVICE_TYPE" != "mediaclient" ]; then - if [ -f "$OCAPRI_LOG_FILE" ] && [[ $(grep "$MAX_REBOOT_STRING" $OCAPRI_LOG_FILE) ]]; then - fw_failure=1 - rebootInitiatedBy="OcapRI" - otherReason="Reboot due to STB reached maximum (10) reboots" - t2CountNotify "SYST_ERR_10Times_reboot" - fi - - if [ -f "$ECM_CRASH_LOG_FILE" ] && [[ $(grep "$ECM_CRASH_SEARCH_STRING" $ECM_CRASH_LOG_FILE) ]]; then - fw_failure=1 - rebootInitiatedBy="EcmLogger" - otherReason="Reboot due to ecm logger crash" - fi - else - if [ -f "$UIMGR_LOG_FILE" ] && [[ $(grep "$MAX_REBOOT_STRING" $UIMGR_LOG_FILE) ]]; then - fw_failure=1 - rebootInitiatedBy="UiMgr" - otherReason="Reboot due to STB reached maximum (10) reboots" - t2CountNotify "SYST_ERR_10Times_reboot" - fi - fi - - return $fw_failure -} - -# Check for OOPS DUMP string in Kernel panic scenarios -oopsDumpCheck() -{ - oops_dump=0 - - if [ "$SOC" = "BRCM" ]; then - # Ensure OOPS DUMP string presence for Kernel Panic in messages.txt - if [ -f "$KERNEL_LOG_FILE" ] && [[ $(grep $KERNEL_PANIC_SEARCH_STRING $KERNEL_LOG_FILE) ]];then - if [[ $(grep -e "Kernel Oops" -e "Kernel Panic" $KERNEL_LOG_FILE) ]];then - oops_dump=1 - fi - fi - elif [ "$RDK_PROFILE" = "TV" ]; then - #Check KERNEL PANIC, OOPS DUMP string presence for Kernel Panic in /sys/fs/pstore/console-ramoops-0 - if [ -f "$PSTORE_CONSOLE_LOG_FILE" ]; then - if [[ $(grep "$KERNEL_PANIC_SEARCH_STRING_01" $PSTORE_CONSOLE_LOG_FILE) ]];then - oops_dump=1 - elif [[ $(grep "$KERNEL_PANIC_SEARCH_STRING_02" $PSTORE_CONSOLE_LOG_FILE) ]];then - oops_dump=1 - elif [[ $(grep "$KERNEL_PANIC_SEARCH_STRING_03" $PSTORE_CONSOLE_LOG_FILE) ]];then - oops_dump=1 - elif [[ $(grep "$KERNEL_PANIC_SEARCH_STRING_04" $PSTORE_CONSOLE_LOG_FILE) ]];then - oops_dump=1 - elif [[ $(grep "$KERNEL_PANIC_SEARCH_STRING_05" $PSTORE_CONSOLE_LOG_FILE) ]];then - oops_dump=1 - elif [[ $(grep "$KERNEL_PANIC_SEARCH_STRING_06" $PSTORE_CONSOLE_LOG_FILE) ]];then - oops_dump=1 - else - oops_dump=0 - fi - - if [ "$oops_dump" -eq "1" ];then - for pstorefile in /sys/fs/pstore/* - do - filename=$(basename "${pstorefile}") - cat $pstorefile > /opt/logs/${filename}.log - done - rebootLog "Please check pstore logs(/sys/fs/pstore/*) for more detail about kerenl panic !" - fi - fi - fi - - return $oops_dump -} - - -#Read the HW Register value of PreviousRebootReason and set details. -setRebootReason() -{ - rebootReason=$1 - case $rebootReason in - SOFTWARE|SOFTWARE_MASTER_RESET) - rebootInitiatedBy="SoftwareReboot" - rebootReason="SOFTWARE_MASTER_RESET" - t2CountNotify "Test_SWReset" - otherReason="Reboot due to user triggered reboot command" - ;; - WATCHDOG|WATCHDOG_TIMER_RESET) - rebootInitiatedBy="WatchDog" - rebootReason="WATCHDOG_TIMER_RESET" - otherReason="Reboot due to watch dog timer reset" - ;; - KERNEL_PANIC_RESET) - rebootInitiatedBy="Kernel" - rebootReason="KERNEL_PANIC" - otherReason="Reboot due to Kernel Panic captured by Oops Dump" - ;; - HARDWARE|POWER_ON_RESET) - rebootInitiatedBy="PowerOn" - rebootReason="POWER_ON_RESET" - otherReason="Reboot due to unplug of power cable from the STB" - ;; - MAIN_CHIP_INPUT_RESET) - rebootInitiatedBy="Main Chip" - rebootReason="MAIN_CHIP_INPUT_RESET" - otherReason="Reboot due to chip's main reset input has been asserted" - ;; - MAIN_CHIP_RESET_INPUT) - rebootInitiatedBy="Main Chip" - rebootReason="MAIN_CHIP_RESET_INPUT" - otherReason="Reboot due to chip's main reset input has been asserted" - ;; - TAP_IN_SYSTEM_RESET) - rebootInitiatedBy="Tap-In System" - rebootReason="TAP_IN_SYSTEM_RESET" - otherReason="Reboot due to the chip's TAP in-system reset has been asserted" - ;; - FRONT_PANEL_4SEC_RESET) - rebootInitiatedBy="FrontPanel Button" - rebootReason="FRONT_PANEL_RESET" - otherReason="Reboot due to the front panel 4 second reset has been asserted" - ;; - S3_WAKEUP_RESET) - rebootInitiatedBy="Standby Wakeup" - rebootReason="S3_WAKEUP_RESET" - otherReason="Reboot due to the chip woke up from deep standby" - ;; - SMARTCARD_INSERT_RESET) - rebootInitiatedBy="SmartCard Insert" - rebootReason="SMARTCARD_INSERT_RESET" - otherReason="Reboot due to the smartcard insert reset has occurred" - ;; - OVERHEAT|OVERTEMP_RESET) - rebootInitiatedBy="OverTemperature" - rebootReason="OVERTEMP_RESET" - otherReason="Reboot due to chip temperature is above threshold (125*C)" - ;; - OVERVOLTAGE_1_RESET|OVERVOLTAGE_RESET) - rebootInitiatedBy="OverVoltage" - rebootReason="OVERVOLTAGE_RESET" - otherReason="Reboot due to chip voltage is above threshold" - ;; - PCIE_1_HOT_BOOT_RESET|PCIE_0_HOT_BOOT_RESET) - rebootInitiatedBy="PCIE Boot" - rebootReason="PCIE_HOT_BOOT_RESET" - otherReason="Reboot due to PCIe hot boot reset has occurred" - ;; - UNDERVOLTAGE_1_RESET|UNDERVOLTAGE_0_RESET|UNDERVOLTAGE_RESET) - rebootInitiatedBy="LowVoltage" - rebootReason="UNDERVOLTAGE_RESET" - otherReason="Reboot due to chip voltage is below threshold" - ;; - SECURITY_MASTER_RESET) - rebootInitiatedBy="SecutiryReboot" - rebootReason="SECURITY_MASTER_RESET" - otherReason="Reboot due to security master reset has occurred" - ;; - CPU_EJTAG_RESET) - rebootInitiatedBy="CPU EJTAG" - rebootReason="CPU_EJTAG_RESET" - otherReason="Reboot due to CPU EJTAG reset has occurred" - ;; - SCPU_EJTAG_RESET) - rebootInitiatedBy="SCPU EJTAG" - rebootReason="SCPU_EJTAG_RESET" - otherReason="Reboot due to SCPU EJTAG reset has occurred" - ;; - GEN_WATCHDOG_1_RESET) - rebootInitiatedBy="GEN WatchDog" - rebootReason="GEN_WATCHDOG_RESET" - otherReason="Reboot due to gen_watchdog_1 timeout reset has occurred" - ;; - AUX_CHIP_EDGE_RESET_0|AUX_CHIP_EDGE_RESET_1) - rebootInitiatedBy="Aux Chip Edge" - rebootReason="AUX_CHIP_EDGE_RESET" - otherReason="Reboot due to the auxiliary edge-triggered chip reset has occurred" - ;; - AUX_CHIP_LEVEL_RESET_0|AUX_CHIP_LEVEL_RESET_1) - rebootInitiatedBy="Aux Chip Level" - rebootReason="AUX_CHIP_LEVEL_RESET" - otherReason="Reboot due to the auxiliary level-triggered chip reset has occurred" - ;; - MPM_RESET) - rebootInitiatedBy="MPM" - rebootReason="MPM_RESET" - otherReason="Reboot due to the MPM reset has occurred" - ;; - *) - rebootInitiatedBy="Hard Power" - rebootReason="$rebootReason" - otherReason="Reboot due to $rebootReason" - ;; - esac -} - -#Perform locking of script execution to avoid parallel execution -lock() -{ - while ! mkdir "$LOCK_DIR" &> /dev/null;do - rebootLog "Waiting for rebootInfo lock" - sleep 5 - done - rebootLog "Acquired rebootInfo lock" -} - -#Unlock before exiting the script -unlock() -{ - rm -rf "$LOCK_DIR" - rebootLog "Releasing rebootInfo lock" -} - -#Check for STT and Reboot Checker flag before updating reboot reason -CheckSTT() -{ - rebootLog "Checking ${STT_FLAG} and ${REBOOT_INFO_FLAG} flag to update the reboot reason" - if [ ! -f "${STT_FLAG}" ] || [ ! -f "${REBOOT_INFO_FLAG}" ];then - rebootLog "Exiting since ${STT_FLAG} or ${REBOOT_INFO_FLAG} flag is not available" - unlock - rebootLog "End of Reboot Reason Script" - exit 0 - fi -} - -#Fucntion to update reboot reason when hardware register is empty -exitforNullrebootreason() -{ - rebootInitiatedBy="Hard Power Reset" - customReason="Hardware Register - NULL" - otherReason="No information found" - rebootReason="HARD_POWER" - setPreviousRebootInfo "$rebootTime" "$rebootInitiatedBy" "$rebootReason" "$customReason" "$otherReason" - unlock - rebootLog "End of Reboot Reason Script" - exit 0 -} - - - -############################## -########## Main APP ########## -############################## - -lock - -#check for first time invocation flag and proceed for script execution - - CheckSTT - -#Creating reboot folder in /opt/secure/ path -if [ ! -d $REBOOT_INFO_DIR ]; then - rebootLog "Creating $REBOOT_INFO_DIR folder..." - mkdir $REBOOT_INFO_DIR -fi - -if [ "$RDK_PROFILE" = "TV" ]; then - # Check to see if we already have the entry in the log - prevReboot=`grep "PreviousRebootReason" $KERNEL_LOG_FILE` - if [ -z "$prevReboot" ]; then - oopsDumpCheck - kernel_crash=$? - if [ $kernel_crash -eq 1 ];then - echo "`/bin/timestamp` PreviousRebootReason: kernel_panic!" >> $KERNEL_LOG_FILE - else - if [ -f /lib/rdk/get-reboot-reason.sh ]; then - sh /lib/rdk/get-reboot-reason.sh >> $KERNEL_LOG_FILE - fi - fi - fi -fi - -# Use current time to report the kernel crash and hard power reset -rebootTimestamp=`date -u` - -# Read and Move /opt/secure/reboot/reboot.info as /opt/secure/reboot/previousreboot.info -if [ -f "$REBOOT_INFO_FILE" ];then - rebootLog "New $REBOOT_INFO_FILE file found, Creating previous reboot info file..." - cat $REBOOT_INFO_FILE - mv $REBOOT_INFO_FILE $PREVIOUS_REBOOT_INFO_FILE - if [ -f "$PARODUS_REBOOT_INFO_FILE" ];then - rebootLog "New $PARODUS_REBOOT_INFO_FILE file found, updating parodus logfile..." - rebootinfo=`cat $PARODUS_REBOOT_INFO_FILE` - echo "`/bin/timestamp` $0: $rebootinfo" >> $PARODUS_LOG - mv $PARODUS_REBOOT_INFO_FILE $PREVIOUS_PARODUSREBOOT_INFO_FILE - fi -else - rebootLog "$REBOOT_INFO_FILE file not found, Assigning default values..." - # Set following variables to NULL before using them - rebootInitiatedBy="" - rebootTime="" - customReason="" - otherReason="" - - # Reading the previous reboot details from /opt/logs/rebootInfo.log - if [ -f "$REBOOT_INFO_LOG_FILE" ];then - rebootLog "$REBOOT_INFO_LOG_FILE logfile found, Fetching source, time and other reasons" - # Parse Previous reboot Info and remove leading space - rebootInitiatedBy=`grep "PreviousRebootInitiatedBy:" $REBOOT_INFO_LOG_FILE | grep -v grep | awk -F "PreviousRebootInitiatedBy:" '{print $2}' | sed 's/^ *//'` - rebootTime=`grep "PreviousRebootTime:" $REBOOT_INFO_LOG_FILE | grep -v grep | awk -F 'PreviousRebootTime:' '{print $2}' | sed 's/^ *//'` - customReason=`grep "PreviousCustomReason:" $REBOOT_INFO_LOG_FILE | grep -v grep | awk -F "PreviousCustomReason:" '{print $2}' | sed 's/^ *//'` - otherReason=`grep "PreviousOtherReason:" $REBOOT_INFO_LOG_FILE | grep -v grep | awk -F 'PreviousOtherReason:' '{print $2}' | sed 's/^ *//'` - fi - - rebootLog "Validating reboot information received from $REBOOT_INFO_LOG_FILE..." - if [ "x$rebootInitiatedBy" == "x" ];then - rebootLog "$REBOOT_INFO_LOG_FILE file not found and Value of rebootInitiatedBy=$rebootInitiatedBy is empty" - rebootTime="$rebootTimestamp" - # Check for Kernel Panic Reboot - rebootLog "Checking for OOPS DUMP for Kernel Panic..." - oopsDumpCheck - kernel_crash=$? - if [ $kernel_crash -eq 1 ];then - rebootReason="KERNEL_PANIC" - rebootInitiatedBy="Kernel" - customReason="Hardware Register - KERNEL_PANIC" - otherReason="Reboot due to Kernel Panic captured by Oops Dump" - else - # Reading hard reset values from sysfs - rebootLog " Hard Power Reboot info is missing!!!" - exitforNullrebootreason - fi - else - rebootLog "$REBOOT_INFO_LOG_FILE logfile found and received source of rebootInitiatedBy=$rebootInitiatedBy" - # Assign reboot reason by comparing the rebootInitiatedBy with APP_TRIGGERED_REASONS/OPS_TRIGGERED_REASONS/MAINTENANCE_TRIGGERED_REASONS - if [[ "${APP_TRIGGERED_REASONS[@]}" == *"$rebootInitiatedBy"* ]];then - rebootReason="APP_TRIGGERED" - # Assign reboot reason as MAINTENANCE_REBOOT if customReason is passed as MAINTENANCE_REBOOT - if [ $customReason == "MAINTENANCE_REBOOT" ];then - rebootReason="MAINTENANCE_REBOOT" - fi - elif [[ "${OPS_TRIGGERED_REASONS[@]}" == *"$rebootInitiatedBy"* ]];then - rebootReason="OPS_TRIGGERED" - elif [[ "${MAINTENANCE_TRIGGERED_REASONS[@]}" == *"$rebootInitiatedBy"* ]];then - rebootReason="MAINTENANCE_REBOOT" - else - rebootReason="FIRMWARE_FAILURE" - fi - fi - - # FIRMWARE FAILURE is of high priority for all the STB platforms and not applicable for TV platforms - # We have to report it before updating any soft/hard reboot scenarios - # Check for FIRMWARE FAILURE cases (ECM Crash, Max reboot etc) for STB platforms - - #Update reboot information in /opt/secure/reboot/previousreboot.info file - setPreviousRebootInfo "$rebootTime" "$rebootInitiatedBy" "$rebootReason" "$customReason" "$otherReason" -fi - - # if we didn't any reboot reason yet. - if [ -z "$prevrebootreason" ]; then - rebootLog "Get reboot reason from get-reboot-reason.sh..." - if [ -f /lib/rdk/get-reboot-reason.sh ]; then - sh /lib/rdk/get-reboot-reason.sh >> $KERNEL_LOG_FILE - fi - fi -fi - -# Keypress information -if [ -f "$KEYPRESS_INFO_FILE" ]; then - cp -f $KEYPRESS_INFO_FILE $PREVIOUS_KEYPRESS_INFO_FILE - rebootLog "Updated previous keypress info" -else - rebootLog "Unable to find the $KEYPRESS_INFO_FILE file" -fi - -# Create flag to ensure updatePreviousRebootInfo.sh script is invoked -if [ ! -f "$UPDATE_REBOOT_INFO_INVOKED_FLAG" ];then - touch $UPDATE_REBOOT_INFO_INVOKED_FLAG -fi - -rebootLog "End of Reboot Reason Script" -unlock