How to sync the time to network with timedatectl on Ubuntu 18.04?

Solution 1:

From man timedatectl all you need is to enable NTP-sync.

sudo timedatectl set-ntp true

then it do the rest automatically.

If it does not work check status of systemd-timesyncd.service

systemctl status systemd-timesyncd.service

and restart it

sudo systemctl restart systemd-timesyncd.service

And then check again:

$ timedatectl
...
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no