Fixing Time Synchronization
I recently noticed my Arch Linux system time was consistently 1 hour behind, despite having the correct timezone configured. Here’s how I fixed it using systemd’s built-in NTP client.
The Problem
My system showed the wrong time even though the timezone was correctly set to Europe/Berlin:
Checking the time sync status revealed the issue:
The NTP service was inactive, meaning the system wasn’t synchronizing with any time servers.
The Solution
Step 1: Configure NTP Servers
Edit the systemd-timesyncd configuration file:
I configured German NTP pool servers for better accuracy and lower latency:
Step 2: Enable and Start the NTP Service
Step 3: Verify the Fix
Check that everything is working:
Perfect! The system clock is now synchronized and the NTP service is active.
Step 4: Check Sync Details
To see which NTP server you’re connected to and the sync status:
The offset of -3.401ms shows the system is now properly synchronized with minimal drift.
Useful Commands
Here are some helpful commands for monitoring NTP status:
Choosing NTP Servers
You can use different NTP server pools based on your location:
- Germany:
0.de.pool.ntp.orgthrough3.de.pool.ntp.org - Europe:
0.europe.pool.ntp.orgthrough3.europe.pool.ntp.org - Global:
0.pool.ntp.orgthrough3.pool.ntp.org - Arch Linux:
0.arch.pool.ntp.orgthrough3.arch.pool.ntp.org
Using geographically closer servers generally provides better accuracy and faster sync times.
Conclusion
Time synchronization is crucial for many system functions, from file timestamps to SSL certificate validation. With systemd-timesyncd, keeping your Arch Linux system’s clock accurate is straightforward and requires minimal configuration.
The key steps are:
- Configure NTP servers in
/etc/systemd/timesyncd.conf - Restart the systemd-timesyncd service
- Enable NTP synchronization with
timedatectl set-ntp true - Verify with
timedatectl status
Now my system clock stays accurate automatically!