An Azure service that is used to provision Windows and Linux virtual machines.
Configure Chrony to use /dev/ptp_hyperv as the primary source; Azure documents the host PTP clock as an Azure-native time source and describes Azure host time as usually the best source for Linux VMs when external NTP is unavailable.^1^
Support and prerequisites
For each VM, verify:
- Kernel support Azure host PTP requires Linux kernel 4.11 or later. Ubuntu 24.04 normally exceeds this requirement, but confirm the running kernel:
uname -r - Hyper-V integration service
The output should containsudo lsmod | grep hv_utilshv_utilsand normallyhv_vmbus. VMICTimeSync, provided through Linux Integration Services, exposes the Azure host clock as a PTP device.^1^ - Host PTP device
At least onels -l /sys/class/ptp for p in /sys/class/ptp/ptp*; do printf '%s: ' "$p" cat "$p/clock_name" done ls -l /dev/ptp_hypervclock_namemust returnhyperv. Use/dev/ptp_hyperv, not a fixed/dev/ptp0, because Accelerated Networking drivers can create additional PTP devices and numbering can change after reboot. - VM generation and size The Azure Linux time-sync documentation applies broadly to Linux VMs and does not specify a Generation 1/Generation 2 or VM-size restriction. Operationally, support is determined by whether the running kernel and
hv_utilsexpose a PTP device whose clock name ishyperv. The available documentation is insufficient to certify every individual SKU without those guest-side results.
Ubuntu 24.04 is also an endorsed Azure platform-image release when deployed from Canonical’s supported Azure Marketplace offering.^2^
Production Chrony configuration
Install Chrony if it is not already present, then add the following to Ubuntu’s Chrony configuration, normally /etc/chrony/chrony.conf:
refclock PHC /dev/ptp_hyperv poll 3 dpoll -2 offset 0 stratum 2
makestep 1.0 -1
The refclock directive is Microsoft’s documented Azure host-clock configuration. Because the host does not automatically convey stratum information to the guest, it explicitly treats host time as stratum 2; the VM consequently reports itself as stratum 3.^1^
Apply the configuration:
sudo systemctl enable --now chrony
sudo systemctl restart chrony
sudo systemctl disable --now systemd-timesyncd
chronyc tracking
chronyc sources -v
timedatectl status
Expected results:
-
chronyis active. -
chronyc sources -vshows the PHC reference clock as selected. -
chronyc trackingreports a synchronized reference. -
timedatectl statuseventually reportsSystem clock synchronized: yes.
Disable systemd-timesyncd when Chrony owns synchronization to avoid two time services competing or generating misleading external-NTP messages. Azure notes that Chrony normally becomes the default once started, but explicitly documents disabling systemd-timesyncd when it continues trying to synchronize.
If /dev/ptp_hyperv is missing
Only if a PTP device reports hyperv but the stable symlink is absent, create the documented udev rule:
sudo tee /etc/udev/rules.d/99-ptp_hyperv.rules >/dev/null <<'EOF'
ACTION!="add", GOTO="ptp_hyperv"
SUBSYSTEM=="ptp", ATTR{clock_name}=="hyperv", SYMLINK += "ptp_hyperv"
LABEL="ptp_hyperv"
EOF
sudo udevadm control --reload
sudo udevadm trigger --subsystem-match=ptp --action=add
Then verify ls -l /dev/ptp_hyperv. Newer systemd releases generally already include this behavior, so do not add the rule unless the symlink is actually missing.^1^
If no PTP entry reports hyperv, collect uname -r, lsmod, /sys/class/ptp/*/clock_name, dmesg, and the VM image/SKU details before changing Chrony.
Azure host-side validation
Guest commands can prove that the host clock is exposed and that Chrony is tracking it, but they cannot validate the underlying compute host’s synchronization state. For Microsoft to examine both VMs’ host-side PTP presentation, create an Azure support request under Help + support → Create a support request, select the affected VMs, provide the timestamps of observed drift, and allow advanced diagnostic collection if permitted.^3^
Include before-and-after output from:
uname -r
lsmod | grep hv_utils
find /sys/class/ptp -name clock_name -exec sh -c 'echo -n "$1: "; cat "$1"' _ {} \;
chronyc tracking
chronyc sources -v
timedatectl status
This is the appropriate escalation route for confirming whether each underlying Azure host clock is healthy and accurately synchronized.
References