Infrastructure

Azure Linux: diagnose clock skew before correcting time

A production runbook for measuring clock skew on an Azure Linux VM, qualifying its chrony source and choosing gradual correction or controlled removal from service.

20 Nov 2026 azurelinuxvirtual-machineschronytime-syncauthenticationobservabilityrunbookrollbackproduction

After a restart, one Azure Linux VM begins rejecting some authentication requests while its peers remain healthy. Its logs also appear to precede those of its dependencies. Rotating credentials or changing permissions before checking time can obscure the cause and make the incident timeline harder to reconstruct.

The running case is a VM serving an internal application with chrony configured for time synchronization. The goal is to establish whether its clock is actually wrong, whether its source is trustworthy and whether correction is safe for the workload. The commands below are observational unless stated otherwise. Adapt them to the distribution and your approved time policy.

Contain the instance and timestamp the evidence

Drain the affected instance if it produces errors or writes whose ordering is uncertain; leave healthy peers serving traffic. Record the VM identifier, image version, last boot, exact errors and recent changes. Record the collection time in UTC on a trusted independent reference: the suspect VM’s own timestamps cannot establish the incident timeline.

A timezone difference is not clock skew. Two machines can display different local times while agreeing on UTC. Compare instants, not their formatting.

bash 01-observe-clock.sh
date -u --iso-8601=seconds
timedatectl status
uptime -s
systemctl status chronyd --no-pager
systemctl status chrony --no-pager
chronyc tracking
chronyc sources -v
chronyc sourcestats -v

The service may be named chronyd or chrony, depending on the distribution. Failure to find one name alone does not establish an outage. If chrony is not in use, identify the actual time service before applying this runbook.

Separate measurement, selection and accuracy

In chronyc tracking, capture the reference, System time, Root delay, Root dispersion and Leap status. System time is the remaining correction between the system clock and chrony’s estimate, not an independent measurement of UTC error. A near-zero value does not prove that a bad source is providing accurate time.

In sources -v, ^* marks a selected network source and #* a selected reference clock. A listed source is not necessarily selected or trustworthy. Check reachability and recent responses, then compare against an approved independent reference. No selected source, unsynchronized status or dispersion outside the service’s tolerance keeps the instance out of rotation.

Record the measurement, collection time, reference and uncertainty accepted by the service. Do not infer the exact size of a clock step from application logs alone: those timestamps may themselves have used the faulty clock.

Qualify the synchronization path

Inspect the effective configuration, including any included files, without copying internal addresses or secrets into the incident ticket. Depending on the image, chrony may use network NTP or a PTP clock exposed by the Azure host. Do not assume a public server or a fixed /dev/ptp number; inspect the device links and image configuration.

bash 02-qualify-source.sh
chronyc activity
ls -l /dev/ptp* 2>/dev/null
systemctl list-units --type=service --all | grep -E 'chrony|ntp|timesync'
journalctl -b -u chronyd -u chrony --no-pager | tail -n 100

For a network source, check resolution, routing and UDP filtering to the approved servers, then check responses observed by chrony. A successful TCP connection does not validate NTP. For a host source, inspect the device and distribution-specific configuration. Also look for another service attempting to discipline the clock at the same time. Do not disable an Azure mechanism or time service until its role and restoration procedure are understood.

Choose a correction the workload can tolerate

Gradual correction avoids an immediate jump, but may take too long to restore authentication. A clock step can disrupt timers, transactions, certificates, scheduled work and log ordering, particularly when time moves backward. Host synchronization mechanisms can also correct time after certain events, so do not assume the clock will remain frozen during investigation.

Before acting, compare the offset and uncertainty with service tolerances, identify the direction of correction and agree the consequences with the service owner. Preserve the current configuration and its restoration procedure. If a step is necessary, drain or cleanly stop sensitive work, verify a trusted source and follow the distribution’s approved procedure. Do not run chronyc makestep across the fleet: it steps the system clock.

Restoring a previous configuration restores sources and settings; it cannot undo effects of a step that already occurred. Do not deliberately reintroduce an incorrect time. When instance state is uncertain, the fallback may be to keep it drained or replace it in a controlled way after checking state and dependencies.

Validate one instance and make the decision

  1. On one drained VM, restore the approved source using the local procedure and observe several synchronization cycles.
  2. Compare UTC again with the independent reference; verify the selected source, dispersion and stability over time. A successful command alone is not proof.
  3. Test a low-risk real authentication, a TLS connection and a representative application operation. Correlate their identifiers in logs on both sides.
  4. Inspect scheduled jobs and writes during the skew interval before replaying anything. Correcting time does not prove a missed job should be rerun.
  5. Return the instance gradually when agreed thresholds hold and errors remain at their expected baseline. Expand in small batches with an explicit stop condition for renewed drift.

Keep the instance drained if the reference is uncertain, skew returns or the workload cannot tolerate correction. Restore the prior configuration only when it is known to be safe; otherwise return to a healthy instance and investigate the time source. Retain offsets and uncertainty bounds to reconstruct the timeline.

References