When your ntpd service appears to be running but isn't properly synchronizing time, you'll typically see symptoms like:
$ ntpdate -q ntp.ubuntu.com
server 91.189.94.4, stratum 2, offset 7.191308, delay 0.13310
10 Jan 20:38:09 ntpdate[31055]: step time server 91.189.94.4 offset 7.191308 sec
This output shows a significant time offset (7.19 seconds) despite ntpd being active. The key indicators are the persistent offset and the "step time" message (instead of "adjust time").
First, check your current ntpd peers and synchronization status:
$ ntpq -np
remote refid st t when poll reach delay offset jitter
==============================================================================
91.189.94.4 193.79.237.14 2 u 30 64 7 108.518 -0.136 0.361
The important columns here are:
- reach: Shows the reachability register (0-377) - 7 indicates intermittent connectivity
- offset: The current time difference
- jitter: Network variability measurement
Virtual machines often face NTP synchronization challenges due to:
- CPU scheduling delays affecting time calculations
- Hypervisor clock synchronization interference
- Resource contention causing timer interrupts to be delayed
For Xen-based VPS (like in this case), the solution involves:
# Add to /etc/sysctl.conf
xen.independent_wallclock = 1
# Then apply
sysctl -p
Switching to OpenNTPD can provide more verbose debugging:
$ sudo apt remove ntp
$ sudo apt install openntpd
$ sudo /usr/sbin/ntpd -d
Sample debug output showing sync attempts:
reply from 64.73.32.134: offset 6.715003 delay 0.041152, next query 30s
reply from 208.53.158.34: offset 6.700224 delay 0.036263, next query 31s
adjusting local clock by 6.734120s
For reliable time synchronization on virtual servers:
# /etc/ntp.conf
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
server 3.pool.ntp.org iburst
# Enable kernel discipline
tinker panic 0
# Restrict to avoid being used as DDoS amplifier
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
For systems where ntpd struggles:
- chronyd: Better for intermittent connectivity
sudo apt install chrony sudo systemctl restart chronyd
- systemd-timesyncd: Lightweight alternative
sudo timedatectl set-ntp true
Always verify your time sync status with:
# For ntpd
ntpq -pn
# For chrony
chronyc tracking
# For systemd
timedatectl status
When running ntpdate -q ntp.ubuntu.com
, many administrators encounter output showing significant clock drift:
server 91.189.94.4, stratum 2, offset 7.191308, delay 0.13310
10 Jan 20:38:09 ntpdate[31055]: step time server 91.189.94.4 offset 7.191308 sec
The default ntpd configuration often includes restrictive access controls:
# restrict -4 default kod notrap nomodify nopeer noquery
# restrict -6 default kod notrap nomodify nopeer noquery
restrict default ignore
Running ntpq -np
reveals the current synchronization status:
remote refid st t when poll reach delay offset jitter
==============================================================================
91.189.94.4 193.79.237.14 2 u 30 64 7 108.518 -0.136 0.361
For VPS environments, Xen-specific kernel parameters may affect timekeeping:
# Add to /etc/sysctl.conf
xen.independent_wallclock = 1
Testing with OpenNTPD reveals similar issues:
reply from 64.73.32.134: offset 6.715003 delay 0.041152, next query 30s
reply from 208.53.158.34: offset 6.700224 delay 0.036263, next query 31s
adjusting local clock by 6.734120s
Key diagnostic commands:
# Verify current sync status
ntpstat
# Check peer information
ntpq -p
# Force immediate sync (for testing)
ntpd -gq
# Monitor NTP operations
ntptrace
For persistent issues, consider:
# Alternative config approach
server ntp.ubuntu.com iburst
driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log
In extreme cases, manual time correction may be necessary:
# Step (not slew) the clock for large offsets
ntpd -g -x