Maintaining exact clock synchronization on an Ubuntu server or desktop is critical for cryptographic operations, SSL/TLS certificate validations, cron scheduling, and database clustering. When inspecting startup errors using systemctl --failed, administrators often encounter a red failure banner stating Failed to start Network Time Synchronization. The associated systemd unit is systemd-timesyncd.service. When time synchronisation fails, system clocks drift, creating severe cascading authentication failures across Git, Kerberos, and web browsers. Resolving this issue requires repairing NTP server configurations and network transport routes.
Why Network Time Synchronization Fails in Ubuntu
Ubuntu utilizes systemd-timesyncd as its default lightweight SNTP (Simple Network Time Protocol) client. The service fails to start or exits with error codes due to:
- Firewall Blocking UDP Port 123: Outbound NTP queries operate over UDP port 123. If strict local firewalls or corporate gateway routers block this port, queries time out.
- Conflicting Time Services: Running
systemd-timesyncdsimultaneously with other full NTP daemons likechronyorntp. - Unreachable NTP Server Pools: Default upstream servers configured in
/etc/systemd/timesyncd.conffailing to resolve due to DNS outages. - Corrupted Clock State File: The touch file at
/var/lib/systemd/timesync/clockcontaining invalid future timestamps or corrupted filesystem locks.
Step 1: Inspect Systemd Timesyncd Journal Status
Identify the exact cause of the failure using journalctl:
sudo systemctl status systemd-timesyncd.service
journalctl -xeu systemd-timesyncd.service
Look for messages indicating Connection refused, Network is unreachable, or Failed to call clock_settime. If another daemon is already bound to UDP port 123, timesyncd will abort with a port binding conflict.
Step 2: Check for Conflicting NTP Daemons (Chrony or NTP)
Only one time synchronisation daemon should manage the system clock at a time:
- Check if Chrony is running:
systemctl status chrony - Check if legacy NTP is running:
systemctl status ntp - If Chrony is installed and active, it intentionally replaces
systemd-timesyncd. You can cleanly mask the redundant service to eliminate the boot failure flag:sudo systemctl disable systemd-timesyncd.service sudo systemctl mask systemd-timesyncd.service - If you prefer to use
systemd-timesyncd, remove conflicting packages:sudo apt-get remove --purge chrony ntp
Step 3: Configure Reliable Public NTP Servers
If default Ubuntu NTP pools are unreachable from your network location, assign reliable global servers:
- Edit the timesyncd configuration file:
sudo nano /etc/systemd/timesyncd.conf - Locate the
[Time]section and update the server directives:[Time] NTP=time.cloudflare.com time.google.com FallbackNTP=0.ubuntu.pool.ntp.org 1.ubuntu.pool.ntp.org - Save and exit (Ctrl + O, then Ctrl + X).
- Restart the synchronization service:
sudo systemctl restart systemd-timesyncd.service
Step 4: Verify Outbound UDP Port 123 Connectivity and Reset Clock State
If the state file contains a corrupt timestamp from a sudden power drop, delete it:
- Remove the stale clock state file:
sudo rm -f /var/lib/systemd/timesync/clock - Verify firewall rules:
If UFW has strict outbound filtering, allow UDP 123:sudo ufw statussudo ufw allow out 123/udp - Check synchronization status with timedatectl:
timedatectl status timedatectl timesync-status
The output should confirm: NTP service: active and System clock synchronized: yes.
Troubleshooting Summary
| Observed Symptom | Root Cause | Resolution Command |
|---|---|---|
| Port binding collision | Chrony or NTP daemon running simultaneously | Mask timesyncd if using Chrony, or purge chrony |
| Network timeout on sync | UDP port 123 blocked by firewall | sudo ufw allow out 123/udp |
| Server pool unresolvable | DNS failure or dead NTP upstream | Add time.cloudflare.com to /etc/systemd/timesyncd.conf |
| Time drift persists | Corrupt timestamp in /var/lib/systemd/timesync/clock | Remove clock state file and restart timesyncd |
Resolving daemon conflicts and specifying reliable public NTP pools ensures consistent, millisecond-accurate time synchronization across Ubuntu.