Skip to content

Remove ifupdown hooks installed by Chrony#27549

Open
saiarcot895 wants to merge 1 commit into
sonic-net:masterfrom
saiarcot895:fix-chrony-offline
Open

Remove ifupdown hooks installed by Chrony#27549
saiarcot895 wants to merge 1 commit into
sonic-net:masterfrom
saiarcot895:fix-chrony-offline

Conversation

@saiarcot895
Copy link
Copy Markdown
Contributor

@saiarcot895 saiarcot895 commented May 27, 2026

Why I did it

Chrony installs ifupdown hooks to automatically mark NTP servers as either online or offline, depending on network connectivity. This can cause problems in SONiC, since there are interfaces dynamically created and don't get triggered via any network hooks.

Work item tracking
  • Microsoft ADO (number only):

How I did it

Remove the ifupdown hooks so that Chrony always treats the NTP servers as online. Note that there are other hooks installed (ppp, NetworkManager) that haven't been removed only because SONiC doesn't use these.

How to verify it

Loaded the image on KVM, verified that the hooks weren't present in /etc/network/if-up.d and /etc/network/if-post-down.d, then shut down BGP and eth0, and verified that chronyc -n activity said that 2 sources were online. Without this change, it said the sources went offline.

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)

Chrony installs ifupdown hooks to automatically mark NTP servers as
either online or offline, depending on network connectivity. This can
cause problems in SONiC, since there are interfaces dynamically created
and don't get triggered via any network hooks.

Remove the ifupdown hooks so that Chrony always treats the NTP servers
as online. Note that there are other hooks installed (ppp,
NetworkManager) that haven't been removed only because SONiC doesn't use
these.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
Copilot AI review requested due to automatic review settings May 27, 2026 01:29
@saiarcot895 saiarcot895 requested a review from lguohan as a code owner May 27, 2026 01:29
@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).

Copy link
Copy Markdown
Contributor

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 updates the Debian rootfs extension script to remove Chrony’s ifupdown hook scripts during image build, preventing Chrony from marking NTP sources online/offline based on ifupdown events (which can be problematic with SONiC’s dynamically created interfaces).

Changes:

  • Add a build-time step to delete Chrony’s ifupdown hook scripts from the target filesystem.
  • Keep Chrony enabled with SONiC’s systemd override as before.

sudo cp $IMAGE_CONFIGS/chrony/override.conf $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM/chrony.service.d/
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable chrony.service
# Remove Chrony's hooks into ifupdown system, so that NTP sources are always treated as online
sudo rm $FILESYSTEM_ROOT/etc/network/if-post-down.d/chrony $FILESYSTEM_ROOT/etc/network/if-up.d/chrony
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants