Select Page


Correct timekeeping has turn into a important element of contemporary instrument deployments. Whether or not it is ensuring logs are recorded in the proper order or database updates are implemented accurately, out-of-sync time could cause mistakes, knowledge corruption, and different exhausting to debug problems.

Ubuntu 18.04 has time synchronization in-built and activated via default the usage of systemd’s timesyncd carrier. On this article we will be able to take a look at some fundamental time-related instructions, check that timesyncd is energetic, and learn to set up another community time carrier.


Sooner than beginning this instructional, you’re going to want an Ubuntu 18.04 server with a non-root, sudo-enabled person, as described in this Ubuntu 18.04 server setup tutorial.

Probably the most fundamental command for locating out the time in your server is date. Any person can sort this command to print out the date and time:


Tue Jul 10 14:48:52 UTC 2018

Maximum continuously your server will default to the UTC time zone, as highlighted within the above output. UTC is Coordinated Common Time, the time at 0 levels longitude. Persistently the usage of Common Time reduces confusion when your infrastructure spans more than one time zones.

In case you have other necessities and want to exchange the time zone, you’ll be able to use the timedatectl command to take action.

First, record the to be had time zones:

  • timedatectl list-timezones

An inventory of time zones will print for your display. You’ll press SPACE to web page down, and b to web page up. While you in finding the proper time zone, make observe of it then sort q to go out the record.

Now set the time zone with timedatectl set-timezone, ensuring to exchange the highlighted portion underneath with the time zone you discovered within the record. You can want to use sudo with timedatectl to make this transformation:

  • sudo timedatectl set-timezone The united states/New_York

You’ll check your adjustments via working date once more:


Tue Jul 10 10:50:53 EDT 2018

The time zone abbreviation must mirror the newly selected price.

Now that we know the way to test the clock and set time zones, let’s make certain our time is being synchronized correctly.

Controlling timesyncd with timedatectl

Till lately, maximum community time synchronization used to be treated via the Community Time Protocol daemon or ntpd. This carrier connects to a pool of different NTP servers that offer it with consistent and correct time updates.

Ubuntu’s default set up now makes use of timesyncd as an alternative of ntpd. timesyncd connects to the similar time servers and works in kind of the similar manner, however is extra light-weight and extra built-in with systemd and the low degree workings of Ubuntu.

We will be able to question the standing of timesyncd via working timedatectl and not using a arguments. You do not want to use sudo on this case:


Native time: Tue 2018-07-10 10:54:12 EDT Common time: Tue 2018-07-10 14:54:12 UTC RTC time: Tue 2018-07-10 14:54:12 Time zone: The united states/New_York (EDT, -0400) Gadget clock synchronized: sure systemd-timesyncd.carrier energetic: sure RTC in native TZ: no

This prints out the native time, common time (that may be the similar as native time, if you happen to did not transfer from the UTC time zone), and a few community time standing data. Gadget clock synchronized: sure signifies that the time has been effectively synced, and systemd-timesyncd.carrier energetic: sure signifies that timesyncd is enabled and working.

If timesyncd is not energetic, flip it on with timedatectl:

  • sudo timedatectl set-ntp on

Run timedatectl once more to substantiate the community time standing. It is going to take a minute for the real sync to occur, however ultimately each Community time on: and NTP synchronized: must learn sure.

Switching to ntpd

Despite the fact that timesyncd is ok for many functions, some programs which can be very delicate to even the slightest perturbations in time is also higher served via ntpd, because it makes use of extra subtle ways to repeatedly and steadily stay the gadget time not off course.

Sooner than putting in ntpd, we must flip off timesyncd:

  • sudo timedatectl set-ntp no

Examine that timesyncd is off:

Search for systemd-timesyncd.carrier energetic: no within the output. This implies timesyncd has been stopped. We will be able to now set up the ntp bundle with apt:

  • sudo apt replace
  • sudo apt set up ntp

ntpd will likely be began routinely after set up. You’ll question ntpd for standing data to make sure that the entirety is operating:


faraway refid st t when ballot achieve lengthen offset jitter ============================================================================== 0.ubuntu.pool.n .POOL. 16 p - 64 0 0.000 0.000 0.000 1.ubuntu.pool.n .POOL. 16 p - 64 0 0.000 0.000 0.000 2.ubuntu.pool.n .POOL. 16 p - 64 0 0.000 0.000 0.000 3.ubuntu.pool.n .POOL. 16 p - 64 0 0.000 0.000 0.000 .POOL. 16 p - 64 0 0.000 0.000 0.000 +ec2-52-0-56-137 2 u 16 64 1 7.872 -2.137 1.485 + 2 u 12 64 1 65.204 3.740 2.686 +block.steinhoff 2 u 11 64 1 33.364 1.710 3.586 +eterna.binary.n Three u 11 64 1 35.330 2.821 2.839 +2604:a880:800:1 2 u 14 64 1 0.394 0.386 2.462 +ec2-52-6-160-3. 2 u 11 64 1 8.150 2.050 3.053 +mx.danb.e mail 2 u 13 64 1 63.868 1.539 2.240 *hydrogen.consta 2 u 12 64 1 2.989 1.755 2.563 +ntp-3.jonlight. 2 u 10 64 1 64.561 2.122 3.593 Three u 12 64 1 33.508 1.631 3.647 +ntp-3.jonlight. 2 u 8 64 1 64.253 2.645 3.174 2001:67c:1560:8 2 u 22 64 1 71.155 -1.059 0.000 +check.diarizer.c 2 u 11 64 1 64.378 4.648 3.244 2001:67c:1560:8 2 u 18 64 1 70.744 -0.964 0.000 alphyn.canonica 2 u 17 64 1 7.973 -0.170 0.000 2 u 10 64 1 65.874 1.902 2.608

ntpq is a question instrument for ntpd. The -p flag asks for details about the NTP servers (or peers) ntpd has hooked up to. Your output will likely be relatively other, however must record the default Ubuntu pool servers plus a couple of others. Consider that it might probably take a couple of mins for ntpd to ascertain connections.


On this article we’ve proven tips on how to view the gadget time, exchange time zones, paintings with Ubuntu’s default timesyncd, and set up ntpd. In case you have extra subtle timekeeping wishes than what we’ve lined right here, chances are you’ll reference the offical NTP documentation, and in addition check out the NTP Pool Project, a world workforce of volunteers offering a lot of the arena’s NTP infrastructure.