2

I'm wondering how I can get timedatectl to show that NTP is enabled in CentOS 7

root@voip:~ $ timedatectl
      Local time: Tue 2016-10-18 20:58:23 EDT
  Universal time: Wed 2016-10-19 00:58:23 UTC
        RTC time: Wed 2016-10-19 00:58:23
       Time zone: America/New_York (EDT, -0400)
     NTP enabled: no ##THIS LINE##
NTP synchronized: yes
 RTC in local TZ: no
      DST active: yes
 Last DST change: DST began at
                  Sun 2016-03-13 01:59:59 EST
                  Sun 2016-03-13 03:00:00 EDT
 Next DST change: DST ends (the clock jumps one hour backwards) at
                  Sun 2016-11-06 01:59:59 EDT
                  Sun 2016-11-06 01:00:00 EST
FreeSoftwareServers
  • 2,482
  • 10
  • 37
  • 57

3 Answers3

6

Well, its because of Chrony. (RHEL 7 new NTP Server)

First

yum remove chrony

Then

timedatectl set-ntp true

Not sure what effect this has other then making me happy with timedatectl, everything else said it was working, but I have an XYMon script for NTP which greps that line. Suppose thats the point of the script, it was red because it was telling me something was wrong!

FreeSoftwareServers
  • 2,482
  • 10
  • 37
  • 57
  • Thanks! This worked for me. A downstream NTP client was reporting that it was getting no NTP input, and this helped track it down. – Jason Oct 15 '17 at 02:02
  • It seems weird to me that you remove the NTP client and then NTP starts working. – Bratchley Apr 18 '20 at 19:34
5

On CentOS 7.3.1611, I faced the same problem but had to do the reverse:

$ sudo yum install chrony
$ sudo timedatectl set-ntp true
pdp
  • 707
  • 7
  • 8
3
timedatectl set-ntp true

needs a (secure) ntp client to synchronize time via systemd.

systemd from v213 supports "systemd-timesyncd" but in latest version of systemd on CentOS 7, they have decided to disable it. I am current on 7.7.1908 and systemd-timesyncd does not exist.

That means two things:

  • If your distro supports systemd-timesyncd, you can disable chrony and enable systemd-timesyncd
  • If it does not, you should install a (secure) ntp client (like chrony but there are also other options).

Only then you can indeed set ntp true in timedatectl.

ebal
  • 465
  • 2
  • 6