Enable Auto Time Sync On Ubuntu

May 13, 2018

My system clock is off by 5 minutes, so I assume auto time synchrozation is not working properly. I try to check by using timedatectl

timedatectl

I get NTP enabled: yes but NTP synchronized: no.

      Local time: Sat 2018-05-12 15:50:22 UTC
  Universal time: Sat 2018-05-12 15:50:22 UTC
        Timezone: Etc/UTC (UTC, +0000)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a

I try to run sudo ntpq -p but command is not found. So I try to install ntp.

sudo apt-get install ntp

Now I get NTP synchronized: yes.

timedatectl
      Local time: Sat 2018-05-12 15:52:33 UTC
  Universal time: Sat 2018-05-12 15:52:33 UTC
        Timezone: Etc/UTC (UTC, +0000)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

The clock get updated within 5 minutes the above is done (yes, I believe the clock sync is not immediate).

I following command seems to enable immediate time sync, but I didn’t really get to test it.

sudo service ntp stop
sudo ntpdate -s time.nist.gov
sudo service ntp start
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.