Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[reboot-cause] Fixed determine-reboot-cause.service failure. #8210

Merged
merged 1 commit into from
Aug 10, 2021
Merged

[reboot-cause] Fixed determine-reboot-cause.service failure. #8210

merged 1 commit into from
Aug 10, 2021

Conversation

rajkumar38
Copy link
Contributor

Signed-off-by: Rajkumar Pennadam Ramamoorthy rpennadamram@marvell.com

Why I did it

Install sonic image from ONIE. Once system is up, execute "config reload" command.

Root cause is that "determine-reboot-cause.service" was in failed state.
root@sonic:/host/reboot-cause# systemctl list-units --failed
UNIT LOAD ACTIVE SUB DESCRIPTION
● determine-reboot-cause.service loaded failed failed Reboot cause determination service

"determine-reboot-cause" script fails with below error.

Jun 17 10:52:13 sonic chassis: Platform api returns reboot cause Non-Hardware, None
Jun 17 10:52:13 sonic chassis: Platform api returns reboot cause Non-Hardware, None
Jun 17 10:52:13 sonic chassis: Platform api indicates reboot cause Non-Hardware
Jun 17 10:52:13 sonic chassis: Reboot cause file /host/reboot-cause/reboot-cause.txt not found
Jun 17 10:52:13 sonic chassis: Platform api indicates reboot cause Non-Hardware
Jun 17 10:52:13 sonic chassis: Reboot cause file /host/reboot-cause/reboot-cause.txt not found
Jun 17 10:52:13 sonic determine-reboot-cause[564]: Traceback (most recent call last):
Jun 17 10:52:13 sonic determine-reboot-cause[564]: File "/usr/local/bin/determine-reboot-cause", line 228, in
Jun 17 10:52:13 sonic determine-reboot-cause[564]: main()
Jun 17 10:52:13 sonic determine-reboot-cause[564]: File "/usr/local/bin/determine-reboot-cause", line 201, in main
Jun 17 10:52:13 sonic determine-reboot-cause[564]: reboot_cause_dict = get_reboot_cause_dict(previous_reboot_cause, additional_reboot_info, reboot_cause_gen_time)
Jun 17 10:52:13 sonic determine-reboot-cause[564]: File "/usr/local/bin/determine-reboot-cause", line 146, in get_reboot_cause_dict
Jun 17 10:52:13 sonic determine-reboot-cause[564]: if re.search(r'User issued', previous_reboot_cause):
Jun 17 10:52:13 sonic determine-reboot-cause[564]: File "/usr/lib/python3.7/re.py", line 183, in search
Jun 17 10:52:13 sonic determine-reboot-cause[564]: return _compile(pattern, flags).search(string)
Jun 17 10:52:13 sonic determine-reboot-cause[564]: TypeError: expected string or bytes-like object
Jun 17 10:52:13 sonic determine-reboot-cause[564]: Traceback (most recent call last):
Jun 17 10:52:13 sonic determine-reboot-cause[564]: File "/usr/local/bin/determine-reboot-cause", line 228, in
Jun 17 10:52:13 sonic determine-reboot-cause[564]: main()
Jun 17 10:52:13 sonic determine-reboot-cause[564]: File "/usr/local/bin/determine-reboot-cause", line 201, in main
Jun 17 10:52:13 sonic determine-reboot-cause[564]: reboot_cause_dict = get_reboot_cause_dict(previous_reboot_cause, additional_reboot_info, reboot_cause_gen_time)
Jun 17 10:52:13 sonic determine-reboot-cause[564]: File "/usr/local/bin/determine-reboot-cause", line 146, in get_reboot_cause_dict
Jun 17 10:52:13 sonic determine-reboot-cause[564]: if re.search(r'User issued', previous_reboot_cause):
Jun 17 10:52:13 sonic determine-reboot-cause[564]: File "/usr/lib/python3.7/re.py", line 183, in search
Jun 17 10:52:13 sonic determine-reboot-cause[564]: return _compile(pattern, flags).search(string)
Jun 17 10:52:13 sonic determine-reboot-cause[564]: TypeError: expected string or bytes-like object
Jun 17 10:52:13 sonic systemd[1]: determine-reboot-cause.service: Main process exited, code=exited, status=1/FAILURE
Jun 17 10:52:13 sonic systemd[1]: determine-reboot-cause.service: Failed with result 'exit-code'.
Jun 17 10:52:13 sonic systemd[1]: determine-reboot-cause.service: Main process exited, code=exited, status=1/FAILURE
Jun 17 10:52:13 sonic systemd[1]: determine-reboot-cause.service: Failed with result 'exit-code'.

How I did it

Fixed the issue by setting default reason to "REBOOT_CAUSE_UNKNOWN" instead of "None".

How to verify it

Check " determine-reboot-cause.service' loaded successfully post image installation from ONIE.
Verify "reboot-cause.txt" file is created and config reload succeeds.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106

Description for the changelog

A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Rajkumar Pennadam Ramamoorthy <rpennadamram@marvell.com>
@rajkumar38 rajkumar38 requested a review from lguohan as a code owner July 18, 2021 10:32
@rajkumar38
Copy link
Contributor Author

retest please

@lguohan
Copy link
Collaborator

lguohan commented Jul 23, 2021

@sujinmkang , can you take a look?

@lguohan lguohan requested a review from sujinmkang July 24, 2021 20:43
@lguohan
Copy link
Collaborator

lguohan commented Jul 24, 2021

this looks like a general change (non platform related), need to understand if this is really necessary or not.

@sujinmkang sujinmkang self-requested a review July 26, 2021 15:53
@lguohan
Copy link
Collaborator

lguohan commented Jul 28, 2021

@sujinmkang , is this a bug? do we need to back port? is there unit test for this?

@lguohan
Copy link
Collaborator

lguohan commented Jul 28, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@sujinmkang sujinmkang self-requested a review August 10, 2021 00:31
@sujinmkang
Copy link
Collaborator

@lguohan I will check whether the logic is broken or not again. We have unit test for this code but this was missed as one corner case.

@sujinmkang
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@sujinmkang sujinmkang merged commit d6433d1 into sonic-net:master Aug 10, 2021
qiluo-msft pushed a commit that referenced this pull request Aug 12, 2021
Signed-off-by: Rajkumar Pennadam Ramamoorthy rpennadamram@marvell.com

Why I did it
Install sonic image from ONIE. Once system is up, execute "config reload" command.

Root cause is that "determine-reboot-cause.service" was in failed state.
root@sonic:/host/reboot-cause# systemctl list-units --failed
UNIT LOAD ACTIVE SUB DESCRIPTION
● determine-reboot-cause.service loaded failed failed Reboot cause determination service

How I did it
Fixed the issue by setting default reason to "REBOOT_CAUSE_UNKNOWN" instead of "None".

How to verify it
Check " determine-reboot-cause.service' loaded successfully post image installation from ONIE.
Verify "reboot-cause.txt" file is created and config reload succeeds.
judyjoseph pushed a commit that referenced this pull request Aug 25, 2021
Signed-off-by: Rajkumar Pennadam Ramamoorthy rpennadamram@marvell.com

Why I did it
Install sonic image from ONIE. Once system is up, execute "config reload" command.

Root cause is that "determine-reboot-cause.service" was in failed state.
root@sonic:/host/reboot-cause# systemctl list-units --failed
UNIT LOAD ACTIVE SUB DESCRIPTION
● determine-reboot-cause.service loaded failed failed Reboot cause determination service

How I did it
Fixed the issue by setting default reason to "REBOOT_CAUSE_UNKNOWN" instead of "None".

How to verify it
Check " determine-reboot-cause.service' loaded successfully post image installation from ONIE.
Verify "reboot-cause.txt" file is created and config reload succeeds.
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants