INFO | Time and Date

INFO | Time and Date

Updated Author Andreas Hepp ⏱ 4 min read
Inhaltsverzeichnis

An incorrect system time becomes noticeable in many places: logs can no longer be correlated, TLS certificates appear invalid, and Kerberos rejects logins if the deviation is too large.

Linux includes several tools for this purpose, which differ in function and availability. It is important that exactly one time service runs on a system.

Tools at a Glance

Command/ToolAvailable onTaskKey Commands
timedatectlsystemd-based distributionsDisplay and modify time, timezone, and NTP statustimedatectl, timedatectl set-timezone Europe/Berlin, timedatectl set-ntp true
systemctlsystemd-based distributionsStart, stop, and enable time servicesystemctl status systemd-timesyncd, systemctl enable systemd-timesyncd
systemd-timesyncdsystemd-based distributions, Debian defaultSimple NTP client that synchronizes the clockConfiguration in /etc/systemd/timesyncd.conf
chronyDebian, Ubuntu, RHEL, CentOSFull-featured NTP client and server, also for systems with intermittent connectivitychronyc tracking, chronyc sources
ntpd (package ntp)older Debian and Ubuntu releasesClassic time servicentpq -p, configuration in /etc/ntp.conf
hwclockall Linux distributionsRead and set hardware clock (RTC)hwclock --show, hwclock --systohc
dateall Linux distributionsDisplay or manually set system timedate, date --set "2026-11-22 10:00:00"

The default service depends on the distribution. Debian uses systemd-timesyncd as the default, with chrony and OpenNTPD available as alternatives. On Debian 12, ntpsec replaced the ntp package, and starting with Debian 13, the ntp package is no longer available. Ubuntu uses chrony as the default starting from version 25.10. timesyncd is a pure client. If you want to provide time in the network yourself or need a full-featured NTP client, install chrony.

Ubuntu and Debian with timedatectl and timesyncd

First, check the current time, time zone, and whether synchronization is running:

timedatectl

Set the time zone and enable NTP synchronization:

sudo timedatectl set-timezone Europe/Berlin
sudo timedatectl set-ntp true
timedatectl status

`set-ntp true` enables the installed time service. If none is installed, the command fails, and you first install systemd-timesyncd or chrony.

You control the service using systemctl:

systemctl status systemd-timesyncd
sudo systemctl start systemd-timesyncd
sudo systemctl enable systemd-timesyncd

You enter your own NTP servers in /etc/systemd/timesyncd.conf under the [Time] section, then restart the service:

[Time]
NTP=pool.ntp.org
sudo systemctl restart systemd-timesyncd
timedatectl timesync-status

chrony on Ubuntu and Debian

You install chrony via apt. On Debian and Ubuntu, the service is called chrony, not chronyd. During installation, chrony replaces the existing time service. Afterward, use timedatectl to verify that only one service is active, as two time services running simultaneously will interfere with each other.

sudo apt install chrony
sudo nano /etc/chrony/chrony.conf
sudo systemctl restart chrony

Enter your NTP servers or pools in the configuration. You can check if the synchronization is working here:

chronyc tracking
chronyc sources

chrony on RHEL and CentOS

On RHEL and CentOS, the service is called chronyd, and the configuration file is located at /etc/chrony.conf. chrony is usually pre-installed. If it is not, you install it:

sudo dnf install chrony
sudo nano /etc/chrony.conf

Add an NTP server, for example server pool.ntp.org iburst, and start the service:

sudo systemctl enable --now chronyd

ntpd on older Ubuntu systems

On current releases, you won't find ntpd anymore, and the package isn't available on Debian 13. On older systems, the classic service runs as follows:

sudo apt install ntp
sudo nano /etc/ntp.conf
sudo systemctl start ntp
ntpq -p

In /etc/ntp.conf, you enter your source with server pool.ntp.org. ntpq -p lists the connected servers.

Synchronize hardware clock

The hardware clock (RTC) runs independently of the system clock and provides the initial time during boot. Align it after correcting the system time:

sudo hwclock --systohc
hwclock --show

To sync the hardware clock to the system clock, use sudo hwclock --hctosys. To write a specific time directly to the hardware clock, run sudo hwclock --set --date="2026-11-22 10:00:00". If you manually set the system time with date --set, an active NTP service will correct it shortly afterward.

More PhinIT articles:

Sources

SourceTopicURL
Debian Micronews (Bookworm Release)ntp replaced by ntpsec, timesyncd as defaulthttps://micronews.debian.org/2023/1686452718.html
Debian-doc mailing list, Bug 1028149When to use timesyncd, ntpsec, or chronyhttps://lists.debian.org/debian-doc/2023/03/msg00030.html
Ubuntu Server Documentationchrony as default from Ubuntu 25.10, service name chrony.servicehttps://documentation.ubuntu.com/server/how-to/networking/chrony-client
Debian Trixie: Anleitung zum Sichern eines Linux-Serversntp package removed in Debian 13, configure timesyncdhttps://www.mintlify.com/imthenachoman/How-To-Secure-A-Linux-Server/basics/ntp
Ubuntu Launchpad Bug 1870144Konflikt durch gleichzeitig laufende Zeitdienstehttps://answers.launchpad.net/bugs/1870144