CentOS 7 timedatectl does not work properly with chronyd

5,954

timedatectl works with any ntp client (like chrony). systemd supports systemd-timesyncd from v213 but in latest version of CentOS 7 (I am currently on 7.7.1908) they have decided to disabled it.

If you want to use an ntp client instead of timedatectl then I would propose to use cron. @daily should do the job.

eg.

@daily /usr/sbin/ntpdate -u gr.pool.ntp.org

But you can always install chrony and just set ntp true to timedatectl

# timedatectl set-ntp true 
Failed to set ntp: NTP not supported

# yum -y install chrony

# timedatectl set-ntp true

# timedatectl | grep NTP                                 
     NTP enabled: yes          
NTP synchronized: no

and if you enable chrony service, then you will see that timedatectl has also synced NTP

# systemctl enable chronyd
# systemctl start chronyd

# timedatectl | grep -i ntp
     NTP enabled: yes
NTP synchronized: yes
Share:
5,954

Related videos on Youtube

3bdalla
Author by

3bdalla

Updated on September 18, 2022

Comments

  • 3bdalla
    3bdalla almost 2 years

    In order to have timedatectl NTP enabled and synchronized to be yes, I had to disable chronyd, stop ntpd, perfrom ntpdate, then start ntpd. After that I can get NTP enabled and synchronized in timedatectl. For both /etc/chrony.conf and /etc/ntp.conf I have server <server-ip> prefer iburst nothing else.

    1. Is there any problem with this situation?
    2. Is there a way to force chrony to manually sync? Something similar to ntpdate?