Skip to content

[interfaces-config] retry restart networking#25577

Merged
liat-grozovik merged 1 commit intosonic-net:masterfrom
benle7:retry_restart_networking
Feb 24, 2026
Merged

[interfaces-config] retry restart networking#25577
liat-grozovik merged 1 commit intosonic-net:masterfrom
benle7:retry_restart_networking

Conversation

@benle7
Copy link
Copy Markdown
Contributor

@benle7 benle7 commented Feb 19, 2026

Why I did it

The command "systemctl restart networking" uses "ifupdown" which has global file lock to prevent concurrent configurations. In some rare cases, we can get a timing conflict between simultaneous processes,
and eth0 remains down.
"error: Another instance of this program is already running"

Work item tracking
  • Microsoft ADO (number only):

How I did it

Add a retry mechanism for the "systemctl restart networking" command.

How to verify it

sudo ip link set eth0 down
sudo flock -x /run/network/.lock sleep 7 &
sudo systemctl restart interfaces-config.service

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

  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

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

Signed-off-by: Ben Levi <belevi@nvidia.com>
@benle7 benle7 requested a review from lguohan as a code owner February 19, 2026 08:42
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

for ((i=1; i<=MAX_RETRIES; i++)); do
LOG_MARK=$(date '+%Y-%m-%d %H:%M:%S')
if systemctl restart networking; then
if journalctl -u networking --since "$LOG_MARK" | grep -q "error.*already running"; then
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So, even if "systemctl restart networking" return success, it could still hit the issue, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

@prsunny prsunny left a comment

Choose a reason for hiding this comment

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

lgtm, @saiarcot895 to review as well

@prsunny prsunny requested a review from saiarcot895 February 23, 2026 18:01
@liat-grozovik liat-grozovik merged commit 22820e2 into sonic-net:master Feb 24, 2026
26 checks passed
FengPan-Frank pushed a commit to FengPan-Frank/sonic-buildimage that referenced this pull request Mar 6, 2026
- Why I did it
The command "systemctl restart networking" uses "ifupdown" which has global file lock to prevent concurrent configurations. In some rare cases, we can get a timing conflict between simultaneous processes,
and eth0 remains down.
"error: Another instance of this program is already running"

- How I did it
Add a retry mechanism for the "systemctl restart networking" command.

- How to verify it
sudo ip link set eth0 down
sudo flock -x /run/network/.lock sleep 7 &
sudo systemctl restart interfaces-config.service

Signed-off-by: Ben Levi <belevi@nvidia.com>
Signed-off-by: Feng Pan <fenpan@microsoft.com>
dprital pushed a commit that referenced this pull request Mar 19, 2026
- Why I did it
The command "systemctl restart networking" uses "ifupdown" which has global file lock to prevent concurrent configurations. In some rare cases, we can get a timing conflict between simultaneous processes,
and eth0 remains down.
"error: Another instance of this program is already running"

- How I did it
Add a retry mechanism for the "systemctl restart networking" command.

- How to verify it
sudo ip link set eth0 down
sudo flock -x /run/network/.lock sleep 7 &
sudo systemctl restart interfaces-config.service

Signed-off-by: Ben Levi <belevi@nvidia.com>
Signed-off-by: dprital <drorp@nvidia.com>
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.

6 participants