8000 Fix warm-reboot script so it can be run via reboot DBus service by jkmar · Pull Request #3872 · sonic-net/sonic-utilities · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix warm-reboot script so it can be run via reboot DBus service #3872

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jkmar
Copy link
@jkmar jkmar commented May 2, 2025

What I did

Fix gNOI warm reboot issue: sonic-net/sonic-buildimage#22537

How I did it

Change logname to logname || whoami in the warm-reboot script, so it can be run via reboot DBus service (it doesn't have a login shell).

How to verify it

Tested gNOI warm reboot on a hardware switch.

root@sonic:~# docker exec -it gnmi bash
root@sonic:/# gnoi_client -notls -insecure -module System -rpc Reboot -jsonin '{"method":4,"message":"some message"}'
System Reboot
root@sonic:/# exit
root@sonic:~# journalctl -u sonic-hostservice.service -f
...
May 05 08:24:07 sonic python3[5978]: reboot: issue_reboot rpc called
May 05 08:24:07 sonic python3[5978]: reboot: Issuing WARM reboot
...
May 05 08:25:42 sonic platform_pre_shutdown[11193]: reboot: Enable watchdog
May 05 08:25:45 sonic watchdogutil[11212]: Watchdog:/dev/watchdog0 armed successfully
May 05 08:26:05 sonic root[12583]: Enabling Watchdog before warm-reboot
May 05 08:26:07 sonic watchdogutil[12584]: Watchdog:/dev/watchdog0 armed successfully
May 05 08:26:08 sonic root[12588]: Running x86_64-8122_64ehf_o-r0 specific plugin...
client_loop: send disconnect: Broken pipe

Previous command output (if the output of a command-line utility has changed)

root@sonic:~# journalctl -u sonic-hostservice.service
...
May 05 05:32:39 sonic python3[5967]: reboot: issue_reboot rpc called
May 05 05:32:39 sonic python3[5967]: reboot: Issuing WARM reboot
...
May 05 05:32:39 sonic python3[5967]: reboot: Reboot failed execution with stdout: [], stderr: ['logname: no login name']

New command output (if the output of a command-line utility has changed)

May 05 08:24:07 sonic python3[5978]: reboot: issue_reboot rpc called
May 05 08:24:07 sonic python3[5978]: reboot: Issuing WARM reboot
...
May 05 08:25:42 sonic platform_pre_shutdown[11193]: reboot: Enable watchdog
May 05 08:25:45 sonic watchdogutil[11212]: Watchdog:/dev/watchdog0 armed successfully
May 05 08:26:05 sonic root[12583]: Enabling Watchdog before warm-reboot
May 05 08:26:07 sonic watchdogutil[12584]: Watchdog:/dev/watchdog0 armed successfully
May 05 08:26:08 sonic root[12588]: Running x86_64-8122_64ehf_o-r0 specific plugin...
client_loop: send disconnect: Broken pipe

@mssonicbld
Copy link
Collaborator

/azp run

Copy link
Azure Pipelines successfully started running 1 pipeline(s).

@jkmar jkmar changed the title Fix warm-reboot script so it can be run via reboot DBus service. Fix warm-reboot script so it can be run via reboot DBus service May 5, 2025
@jkmar jkmar marked this pull request as ready for review May 5, 2025 16:43
@jkmar
Copy link
Author
jkmar commented May 14, 2025

@vvolam
Copy link
Contributor
vvolam commented May 15, 2025

@vaibhavhd could you help review this PR

@vaibhavhd vaibhavhd requested a review from Copilot May 16, 2025 23:05
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a warm-reboot issue by updating the user lookup in the fast-reboot script to work properly with the reboot DBus service.

  • Update user assignment to use "logname || whoami" with an explanatory comment for non-login shell environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0