Add initial support for keeping track of and displaying reboot cause#1812
Add initial support for keeping track of and displaying reboot cause#1812lguohan merged 4 commits intosonic-net:masterfrom jleveque:reboot_cause
Conversation
files/image_config/platform/rc.local
Outdated
There was a problem hiding this comment.
SONIC_VERSION [](start = 5, length = 13)
The cat/grep way will include quotation mark.
Try
sonic-cfggen -y /etc/sonic/sonic_version.yml -v build_version
``` #Closed
There was a problem hiding this comment.
I didn't write this, I just moved it. The use of eval evaluates the expression inside the quotation marks. I can change and test it, though, if you'd like.
files/image_config/platform/rc.local
Outdated
There was a problem hiding this comment.
SONiC firmware upgrade [](start = 14, length = 22)
How about "First boot". "Firmware" is confusing. #Closed
There was a problem hiding this comment.
I think "first boot" is far more confusing to an end-user, especially if the device has been in production for a while and was recently upgraded. If you don't like "firmware," I would suggest SONiC operating system upgrade, SONiC OS upgrade or SONiC image upgrade as alternatives.
There was a problem hiding this comment.
I see. Then 'upgrade' is also confusing. Technically the first SONiC installation is not a upgrade.
Maybe the general "Unknown reboot cause" is good enough, since the currently implementation know nothing about first reboot and sonic upgrade.
In reply to: 197971849 [](ancestors = 197971849)
There was a problem hiding this comment.
I see your point, but I think it's more useful to know that the last time the device rebooted was due to a firmware upgrade, as opposed to stating "Unknown reboot cause". Maybe SONiC image installation?
* d03ba4f [202012] [portstat, intfstat] added rates and utilization (sonic-net#1812) * 499ad3f [config reload] Fix config reload failure due to sonic.target job cancellation (sonic-net#1814) * 96d658c [202012][sonic installer] Add swap setup support (sonic-net#1815) * a9c6970 platform pre-check for reboot in 202012 branch (sonic-net#1788) * 0e0478b Unify the number format in the ourput of portstat and pfcstat in all cases (sonic-net#1795) * 2d1e00e [ecnconfig] Fix exception seen during display and add unit tests (sonic-net#1784) (sonic-net#1789) Signed-off-by: Volodymyr Samotiy <volodymyrs@nvidia.com>
Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com> d03ba4fa [202012] [portstat, intfstat] added rates and utilization (sonic-net#1812) 499ad3f4 [config reload] Fix config reload failure due to sonic.target job cancellation (sonic-net#1814) 96d658c2 [202012][sonic installer] Add swap setup support (sonic-net#1815) a9c69702 platform pre-check for reboot in 202012 branch (sonic-net#1788) 0e0478ba Unify the number format in the ourput of portstat and pfcstat in all cases (sonic-net#1795) 2d1e00ed [ecnconfig] Fix exception seen during display and add unit tests (sonic-net#1784) (sonic-net#1789)
* d03ba4f [202012] [portstat, intfstat] added rates and utilization (#1812) * 499ad3f [config reload] Fix config reload failure due to sonic.target job cancellation (#1814) * 96d658c [202012][sonic installer] Add swap setup support (#1815) * a9c6970 platform pre-check for reboot in 202012 branch (#1788) * 0e0478b Unify the number format in the ourput of portstat and pfcstat in all cases (#1795) * 2d1e00e [ecnconfig] Fix exception seen during display and add unit tests (#1784) (#1789) Signed-off-by: Volodymyr Samotiy <volodymyrs@nvidia.com>
…test HEAD automatically (sonic-net#1812) #### Why I did it src/sonic-platform-daemons ``` * b3c6cab - (HEAD -> 202412, origin/202412) [202412] Re-arm timer for CMIS Datapath pre-init check (sonic-net#707) (#55) (23 hours ago) [mihirpat1] ``` #### How I did it #### How to verify it #### Description for the changelog
- What I did
Add initial support for keeping track of and displaying reboot cause
- How I did it
Upon boot, rc.local determines the cause of the previous reboot and generates
/var/cache/sonic/previous-reboot-cause.txtto contain the cause. This is determined as follows:SONiC image installation/var/cache/sonic/reboot-cause.txt(which should contain the cause of the previous reboot -- see below) to/var/cache/sonic/previous-reboot-cause.txt/var/cache/sonic/reboot-cause.txtdoes not exist, it writesUnknown reboot causerc.local then generates a new
/var/cache/sonic/reboot-cause.txtfile containing the default cause ofUnexpected reboot. This file should be updated before going down for reboot if the cause is known. This is currently only done in the reboot wrapper script in sonic-utilities, which updates the file when a user issues therebootcommand.The new command
show reboot-causecan be used to display the previous reboot cause. Sample output:Also reorganized rc.local such that the file contains (in order) constant declarations, function definitions, main body
Also renamed constants using all caps
- How to verify it
show reboot-causeand confirm the output is expected.- For the future