A drifting clock can make Ubuntu reject valid TLS certificates and put events in the wrong order in logs. Network Time Protocol (NTP) keeps the system clock on Ubuntu 26.04 LTS aligned with a network time source.

Fresh Ubuntu 26.04 LTS installations use Chrony as the time client. New installations of Ubuntu 24.04 LTS and 22.04 LTS use systemd-timesyncd by default.

Ubuntu's default Chrony sources use Network Time Security (NTS) to authenticate time from the network. The host needs DNS resolution and outbound access to those servers on TCP port 4460 for key exchange and UDP port 123 for time updates.

Steps to enable NTP time synchronization on Ubuntu:

Run the commands in an SSH session or on the Ubuntu console as an account that can use sudo. Start with Chrony disabled at boot and not running, with Ubuntu's default time sources configured.

  1. Identify the installed time client.
    $ systemctl list-unit-files chrony.service systemd-timesyncd.service
    UNIT FILE      STATE    PRESET
    chrony.service disabled enabled
    
    1 unit files listed.

    Continue only if chrony.service is the only unit listed. If the host uses systemd-timesyncd.service, use the related guide for that client.

  2. Check whether Chrony is enabled at boot.
    $ systemctl is-enabled chrony.service
    disabled

    Stop here if the result differs from disabled.

  3. Check whether Chrony is running.
    $ systemctl is-active chrony.service
    inactive

    Stop here if the result differs from inactive.

  4. Activate chrony.service immediately and at boot.

    Chrony can jump the clock during its first few updates if it finds a large offset. If the host runs time-sensitive workloads, start it during a maintenance window. To return the service to its disabled and stopped state, run sudo systemctl disable --now chrony.service.

    $ sudo systemctl enable --now chrony.service
  5. Confirm that Chrony is set to start at boot.
    $ systemctl is-enabled chrony.service

    The command should print enabled.

  6. Confirm that Chrony is running.
    $ systemctl is-active chrony.service

    The command should print active.

  7. Wait for Chrony to synchronize.
    $ chronyc waitsync 12

    The command polls Chrony up to 12 times at 10-second intervals. A successful exit means Chrony has synchronized. If it times out, check DNS and network access to the configured sources before rerunning it.

  8. Confirm that Chrony selected an NTP server.
    $ chronyc -N sources
    MS Name/IP address         Stratum Poll Reach LastRx Last sample
    ===============================================================================
    ^* 1.ntp.ubuntu.com              2   6    17     2  +2317us[+4417us] +/-   88ms
    ##### snipped #####

    The row starting with ^* names the selected server. The selected host may differ.

  9. Confirm that Ubuntu reports a synchronized system clock.
    $ timedatectl status
    ##### snipped #####
    System clock synchronized: yes
                  NTP service: active
    ##### snipped #####

    System clock synchronized must be yes. If it still reports no, give the clock a few moments and check again.

Share this guide