25

I've installed the OS and the time is incorrect.

The timedatectl shows:

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

How to force it to sync now?

2 Answers 2

40

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
13
  • 4
    The status of systemd-timesyncd.service was useful - helped to see the problem with the server connectivity.
    – Velkan
    Jul 24, 2018 at 9:22
  • On Ubuntu 18.04 this doesn't work... can someone please verify?
    – lewis4u
    Jun 13, 2019 at 11:08
  • @lewis4u: it works for me in Ubuntu18.04, the systemctl part. Does your firewall allow you to access the NTP servers?
    – HongboZhu
    Jul 2, 2019 at 14:18
  • 3
    Even after restarting systemd-timesynd.service, timedatectl still reports System clock synchronized: no. Does anyone know why this would be?
    – snark
    Sep 26, 2019 at 13:28
  • 2
    @PresidentJamesMoveonPolk: At least on Ubuntu 20.04, ntp conflicts with systemd-timesyncd and wants to remove it. It must be something else. In my case, the error was a typo in the NTP configuration.
    – emk2203
    Apr 23, 2020 at 12:37
5

It worked for me, when I edited /etc/systemd/timesyncd.conf, because lines below were commented. I uncommented them and changed NTP and FallbackNTP lines by my Network servers:

[Time]
NTP=172.24.3.1
FallbackNTP=172.24.44.51
RootDistanceMaxSec=5
PollIntervalMinSec=32
PollIntervalMaxSec=2048

After that, I restarted systemd-timesyncd.service, so System clock synchronized status turned to yes

1
  • I don't have this file centos Jun 28, 2022 at 7:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .