Enable System clock synchronization

Solution 1:

It can be done without deploying NTP like this:

sudo nano /etc/systemd/timesyncd.conf  

Edit the NTP Server detail

[Time]
NTP=ur.ntp.srv
FallbackNTP=ur.fallbackntp.srv

Then

sudo systemctl daemon-reload
sudo timedatectl set-ntp off
sudo timedatectl set-ntp on

and you can check it with

timedatectl status

Solution 2:

One way to do it is to use ntp which still works in Ubuntu 18.04. Run the following command to install ntp.

sudo apt install ntp

After it is installed you can run ntpq -p to make sure that it is working.

~$ ntpq -p
     remote           refid      st t when poll reach   delay   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
 ntp.ubuntu.com  .POOL.          16 p    -   64    0    0.000    0.000   0.000

Then in your /etc/crontab file add @reboot root /usr/sbin/ntpd -n so that the ntpd will automatically start when the system reboots. Use your favorite editor like gedit or mousepad or whatever you like:

pkexec gedit /etc/crontab

It should kind of look like this when the line is added:

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
@reboot     root    /usr/sbin/ntpd -n
#

Then reboot the computer for the settings to take effect.

~$ timedatectl status
                      Local time: Wed 2018-06-13 06:55:35 MDT
                  Universal time: Wed 2018-06-13 12:55:35 UTC
                        RTC time: Wed 2018-06-13 12:55:36
                       Time zone: America/Denver (MDT, -0600)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

If you want to change your servers to the Asia Pool servers add them into the # Use servers from the NTP Pool Project. part of the /etc/ntp.conf file like so:

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org

Hope this helps!

Solution 3:

The following worked for me:

timedatectl set-ntp true

and then...

systemctl restart systemd-timesyncd

Example:

enter image description here