CachyOS Time Synchronization - ryzendew/Linux-Tips-and-Tricks GitHub Wiki

⏰ CachyOS Time Synchronization Guide

Complete beginner-friendly guide to time synchronization on CachyOS, including NTP, systemd-timesyncd, and timezone configuration.


Table of Contents

  1. Understanding Time Synchronization
  2. Timezone Configuration
  3. NTP Setup
  4. systemd-timesyncd
  5. Troubleshooting

Understanding Time Synchronization

What is Time Synchronization?

Time synchronization keeps system time accurate.

What it does:

  • Accurate time: Keeps time correct
  • Network sync: Syncs with time servers
  • Timezone: Handles timezones
  • Consistency: Consistent time across network

Why it matters:

  • Security: Certificates require accurate time
  • Logs: Accurate timestamps
  • Scheduling: Cron jobs, etc.
  • Network: Network protocols need accurate time

Timezone Configuration

Set Timezone

List timezones:

timedatectl list-timezones

What this does:

  • Lists available timezones
  • Shows all timezone options
  • Helps find your timezone

Set timezone:

sudo timedatectl set-timezone America/New_York

What this does:

  • Sets system timezone
  • Applies immediately
  • Updates system time

Check timezone:

timedatectl

What this does:

  • Shows time and timezone
  • Verifies configuration
  • Shows sync status

⏱ NTP Setup

What is NTP?

NTP (Network Time Protocol) syncs time over network.

What it does:

  • Time servers: Syncs with time servers
  • Accuracy: Very accurate time
  • Automatic: Syncs automatically
  • Network: Uses network for sync

Installing NTP

Install NTP:

sudo pacman -S ntp

What this does:

  • Installs NTP client/server
  • Provides time synchronization
  • Makes NTP available

Start NTP:

sudo systemctl enable --now ntpd.service

What this does:

  • Enables NTP at boot
  • Starts NTP daemon
  • Begins time sync

Configuring NTP

Edit NTP config:

sudo nano /etc/ntp.conf

Add time servers:

server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org

What this does:

  • Adds NTP time servers
  • Provides time sources
  • Ensures accurate time

Restart NTP:

sudo systemctl restart ntpd.service

What this does:

  • Applies configuration
  • Updates time servers
  • Resyncs time

⏰ systemd-timesyncd

What is systemd-timesyncd?

systemd-timesyncd is systemd's time synchronization.

What it does:

  • Simple: Easy to use
  • Integrated: Part of systemd
  • Automatic: Syncs automatically
  • Lightweight: Minimal resource usage

Using systemd-timesyncd

Check status:

timedatectl status

What this does:

  • Shows time sync status
  • Shows if synchronized
  • Verifies time sync

Enable NTP:

sudo timedatectl set-ntp true

What this does:

  • Enables NTP synchronization
  • Starts automatic sync
  • Keeps time accurate

Disable NTP:

sudo timedatectl set-ntp false

What this does:

  • Disables NTP sync
  • Stops automatic sync
  • Manual time only

Configuring systemd-timesyncd

Edit config:

sudo nano /etc/systemd/timesyncd.conf

Add time servers:

[Time]
NTP=0.pool.ntp.org 1.pool.ntp.org

What this does:

  • Sets NTP servers
  • Configures time sources
  • Customizes sync

Restart:

sudo systemctl restart systemd-timesyncd.service

What this does:

  • Applies configuration
  • Updates time servers
  • Resyncs time

Troubleshooting

Time Not Syncing

Check sync status:

timedatectl status

What this does:

  • Shows sync status
  • Verifies if synced
  • Helps troubleshoot

Force sync:

sudo timedatectl set-ntp true

What this does:

  • Enables NTP sync
  • Forces synchronization
  • May fix sync issues

Check NTP servers:

timedatectl timesync-status

What this does:

  • Shows NTP status
  • Lists time servers
  • Helps troubleshoot

Wrong Timezone

Check timezone:

timedatectl

What this does:

  • Shows current timezone
  • Verifies configuration
  • Helps identify issues

Set correct timezone:

sudo timedatectl set-timezone Your/Timezone

What this does:

  • Sets correct timezone
  • Updates system time
  • Fixes timezone issues

Time Drift

Check time accuracy:

timedatectl timesync-status

What this does:

  • Shows time sync accuracy
  • Shows time offset
  • Helps identify drift

Force resync:

sudo systemctl restart systemd-timesyncd.service

What this does:

  • Restarts time sync
  • Forces resync
  • May fix drift

Additional Resources


Summary

This guide covered:

  1. Understanding time synchronization - What it is and why it matters
  2. Timezone configuration - Setting system timezone
  3. NTP setup - Network Time Protocol
  4. systemd-timesyncd - Systemd time synchronization
  5. Troubleshooting - Common time sync issues

Key Takeaways:

  • Use timedatectl for time management
  • Set timezone for your location
  • Enable NTP for automatic sync
  • systemd-timesyncd is simple and integrated
  • Check sync status regularly
  • Time sync is important for security
  • Network required for time sync

This guide is based on the CachyOS Wiki and Arch Linux Wiki and expanded with detailed explanations for beginners. For the most up-to-date time synchronization information, always refer to the official documentation.