How to Fix Time Sync Issues (Clock Drift) on a VPS

An out-of-sync system clock causes subtle but real problems — SSL certificate validation failures, authentication errors, incorrect log timestamps, and more. This guide covers diagnosing and fixing time sync issues.

Why Accurate Time Matters

  • SSL/TLS certificate validation depends on accurate time (a clock too far off can cause certificates to appear expired or not-yet-valid)
  • Authentication protocols (like Kerberos) often have strict time-sync tolerance requirements
  • Log timestamps become unreliable for troubleshooting/correlation if the clock is wrong
  • Scheduled tasks (cron) run at the wrong actual time if the clock is off

Checking Current Time and Sync Status

timedatectl

Shows current time, timezone, and whether NTP synchronization is active and working.

Verifying NTP Sync Is Actually Enabled

timedatectl set-ntp true

Checking Detailed Sync Status

timedatectl show -p NTPSynchronized

Should return yes — if not, something is preventing successful synchronization.

Checking systemd-timesyncd Status (Default on Many Distributions)

sudo systemctl status systemd-timesyncd

Using chrony (Alternative, Often More Robust for Servers)

sudo apt install chrony -y
sudo systemctl enable --now chronyd

chrony is generally considered more capable than systemd-timesyncd for server environments, particularly for handling network interruptions gracefully and achieving tighter synchronization.

Checking chrony Sync Status

chronyc tracking

Shows current offset from reference time and synchronization status in detail.

Checking Which NTP Servers Are Being Used

chronyc sources

Manually Forcing a Time Sync

sudo chronyc makestep

Forces an immediate correction rather than waiting for gradual adjustment — useful if the clock is significantly off and you want it corrected immediately rather than slewed gradually.

Checking for Firewall Issues Blocking NTP

sudo ufw allow out 123/udp

NTP uses UDP port 123 — verify outbound access isn't blocked, which would prevent synchronization entirely.

Common Causes of Time Drift on a VPS

  • NTP service not running or not properly configured
  • Firewall blocking outbound NTP traffic
  • Virtualization-layer clock drift (less common on modern hypervisors, but historically a known VM-specific issue)

Verifying Timezone Configuration Is Also Correct

timedatectl list-timezones | grep America
sudo timedatectl set-timezone America/New_York

Distinct from time sync accuracy — verify your configured timezone is also actually correct for your needs, separate from whether the underlying UTC time itself is accurately synchronized.

Common Errors

SSL certificate errors that don't make sense given a valid certificate — always check system time first when encountering seemingly inexplicable certificate validation failures; a surprisingly common root cause.

Continue Reading

Browse more articles in Troubleshooting & FAQ.

  • ntp time sync fix, chrony configuration, clock drift vps, timedatectl troubleshooting
  • 0 utilizatori au considerat informația utilă
Răspunsul a fost util?

Articole similare

Website Down? A Step-by-Step Troubleshooting Checklist

When a website goes down, working through checks in the right order saves critical time. This...

VPS Unreachable/Can't Connect via SSH: Troubleshooting Guide

Losing SSH access to your VPS is stressful, but most causes are fixable without needing to...

How to Fix "No Space Left on Device" Errors

A full disk can silently break databases, log writing, package installations, and web...

How to Diagnose and Fix High CPU Usage on a VPS

Sustained high CPU usage can slow down your entire server and every application running on it....

How to Diagnose and Fix Out of Memory (OOM) Errors

When a Linux server runs out of available RAM, the kernel's OOM (Out of Memory) killer forcibly...