centos8 – CentOS 8 NTP: Chrony will not Sync with sources, timedatectl showing no sync but NTP active

I have been battling with Chrony for the last few hours and cannot seem to figure out what I’m doing wrong.
I found that my system time was set to 2015 when trying to activate Epel-release in DNF, some certificate errors lead me to trying to resolve time date issues. Below is all my relevant output:

    # timedatectl
               Local time: Wed 2021-05-05 16:24:27 EDT
           Universal time: Wed 2021-05-05 20:24:27 UTC
                 RTC time: Wed 2021-05-05 20:24:27
                Time zone: America/Detroit (EDT, -0400)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no

I had to set time manually, so this is actually one minute fast so that I could see if it ran correctly.

# chronyc sources
210 Number of sources = 4
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^? ntp.speculation.org           0   9     0     -     +0ns(   +0ns) +/-    0ns
^? c-73-239-136-185.hsd1.wa>     0   9     0     -     +0ns(   +0ns) +/-    0ns
^? 165.227.106.11                0   9     0     -     +0ns(   +0ns) +/-    0ns
^? x.ns.gin.ntt.net              0   9     0     -     +0ns(   +0ns) +/-    0ns

# chronyc activity
200 OK
5 sources online
0 sources offline
0 sources doing burst (return to online)
0 sources doing burst (return to offline)
0 sources with unknown address

Looking at other people’s sources output this seems not only unrealistic, but just wrong

# systemctl stop chronyd

# chronyd -q
2021-05-05T20:31:16Z chronyd version 3.5 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECHASH +IPV6 +DEBUG)
2021-05-05T20:31:16Z Frequency -97.480 +/- 1.274 ppm read from /var/lib/chrony/drift
2021-05-05T20:31:16Z Using right/UTC timezone to obtain leap second data
2021-05-05T20:31:27Z No suitable source for synchronisation
2021-05-05T20:31:27Z chronyd exiting

I’m not even sure where to start troubleshooting this, I have tried with and without firewalld running.

# cat /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
server 2.pool.ntp.org iburst
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift

# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3

# Enable kernel synchronization of the real-time clock (RTC).
rtcsync

# Enable hardware timestamping on all interfaces that support it.
#hwtimestamp *

# Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2

# Allow NTP client access from local network.
#allow 192.168.0.0/16

# Serve time even if not synchronized to a time source.
#local stratum 10

# Specify file containing keys for NTP authentication.
keyfile /etc/chrony.keys

# Get TAI-UTC offset and leap seconds from the system tz database.
leapsectz right/UTC

# Specify directory for log files.
logdir /var/log/chrony

# Select which information is logged.
#log measurements statistics tracking

I have edited my conf files a ton, my pools might be a little weird but I wasn’t sure what else to have them set to. before this there was just 1 pool directive that I foolishly removed without backing up.

# ntpstat
unsynchronised
poll interval unknown

Finally by suggestion of a friend, I used ntpstat and it gave me this output..

I have tried chronyc makestep and refresh, both of which have yielding nothing as well

time – Failed to set ntp: NTP not supported

Mu Ubuntu 20.04 suffers from time synchronisation problems. Particularly:

v@v-VirtualBox:~$ timedatectl
               Local time: Sat 2021-05-01 09:30:44 EEST
           Universal time: Sat 2021-05-01 06:30:44 UTC 
                 RTC time: Fri 2021-04-30 16:05:23     
                Time zone: Europe/Riga (EEST, +0300)   
System clock synchronized: no                          
              NTP service: n/a                         
          RTC in local TZ: no                          
v@v-VirtualBox:~$ sudo timedatectl set-ntp on
(sudo) password for v: 
Failed to set ntp: NTP not supported

What could I debug?

ubuntu – My NTP Server have a permission denied over the statsdir directory

I am running a NTP server on an Ubuntu 20.04 LTS. The server work fine and the client poll correctly the server. But i keep getting a permission error when i want to record statistics.

I tried to include the following lines in ntp.conf :

statistics rawstats
statsdir /var/log/ntpstats/
filegen rawstats file raw type day link enable

When looking at systemctl ntp status :

mars 05 09:08:48 RD-NTP ntpd[3534] : can't open /var/log/ntpstats/raw.20210305: Permission denied
mars 05 09:08:50 RD-NTP ntpd[3534] : can't open /var/log/ntpstats/raw.20210305: Permission denied
mars 05 09:08:52 RD-NTP ntpd[3534] : can't open /var/log/ntpstats/raw.20210305: Permission denied
mars 05 09:08:54 RD-NTP ntpd[3534] : can't open /var/log/ntpstats/raw.20210305: Permission denied

But for me, the directory have the correct permissions ls -al :

drwxr-xr-x 2 ntp ntp 4096 april 2 2020 .

Before choosing the default folder, i tried with one i created and adding ntp in the permission using this command : chmod ntp:ntp /home/ubuntu/ntpstats/, it wasnt working so i switched to this one, not working either.

Do you know why ntpd keep getting error even if ntp have the upper hand on the folder ?

linux – Sync ntp immediately at boot with undiciplined clock

I have setup one ntp server and 5 clients. I want to force sync the clients to server clock on boot. With my current ntp settings the computers are syncing but after several minutes. I cannot wait so long for them to synchronise. I am not using a RTC/GPS and all machines are in a LAN.
What config or commands do I need to use to force them to sync all clients immediately on boot with the undisciplined server clock*?

Server ntp.conf

driftfile /var/lib/ntp/ntp.drift
leapfile /usr/share/zoneinfo/leap-seconds.list

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

server 127.127.1.0
fudge 127.127.1.0 stratum 8

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Needed for adding pool entries
restrict source notrap nomodify noquery

# (Again, the address is an example only.)
broadcast 192.168.0.255

Client ntp conf

driftfile /var/lib/ntp/ntp.drift
leapfile /usr/share/zoneinfo/leap-seconds.list

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

server 192.168.0.51

restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Needed for adding pool entries
restrict source notrap nomodify noquery

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network!
disable auth
broadcastclient

Pull time from ntp instead of os

I want to show the current time but I don’t want to use “os.time” because the user can always change their operating system time and thus also the time displayed on my script.

Is there a way to get the time from a time server with NTP like “time.google.com” instead of just asking the operating system.

powershell – NTP Time – Get time of remote NTP server in DOS

I’ve been looking at many forums and google results and can’t find what I’m looking for.

Essentially I want to get an accurate time from a public NTP server, in DOS or powershell.
I know there’s the w32tm which can query a remote ntp server, but the result it gives is how much out my computer time is, not the actual time of the remote ntp server.

I’ve found various windows apps that work exactly as I want, but i can’t get the output to a variable to do anything with. I’m dead surprised there’s no .exe that just gets the time from a source, or that it wasn’t written into w32tm.

Something like ntpquery.exe pool.ntp.org (followed maybe like a timezone or something) with an output of the date / time is all I’m after.

Perhaps one of you knowledgeable folk know of a way I can do this?

Many thanks in advance.

ntp – Redhat Enterprise Linux 7: How to disable DST – Daylight Saving Time

You don’t disable DST per se, you set the desired time zone, and you get DST if the time zone has DST.

You can check the configured time zone with timedatectl.

If your timezone has DST you’ll see something like this:

(root@stonard ~)# timedatectl 
      Local time: Sat 2020-06-20 18:27:30 EDT
  Universal time: Sat 2020-06-20 22:27:30 UTC
        RTC time: Sat 2020-06-20 22:27:30
       Time zone: America/New_York (EDT, -0400)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: yes
 Last DST change: DST began at
                  Sun 2020-03-08 01:59:59 EST
                  Sun 2020-03-08 03:00:00 EDT
 Next DST change: DST ends (the clock jumps one hour backwards) at
                  Sun 2020-11-01 01:59:59 EDT
                  Sun 2020-11-01 01:00:00 EST

Otherwise you’ll see something like this:

(root@farshire ~)# timedatectl 
      Local time: Sat 2020-06-20 22:26:50 GMT
  Universal time: Sat 2020-06-20 22:26:50 UTC
        RTC time: Sat 2020-06-20 22:26:50
       Time zone: Etc/GMT (GMT, +0000)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

To change the time zone, use timedatectl set-timezone ZONE, where ZONE is a valid zoneinfo zone. For example:

# timedatectl set-timezone Europe/Kiev

yocto – ntp recipe didn’t install ntpdate files

I have included ntp package.

When yocto OS image comes out, it has only ntp, there is no ntpdate.

I found someone has the same problem but no solution:

https://forums.xilinx.com/t5/Embedded-Linux/How-to-install-ntpdate-command/td-p/1052770

Why it has only ntp? The recipe did include ntpdate.

https://git.congatec.com/yocto/meta-openembedded/blob/ddd3ccd63949f9a24040eb39c136ef9730f2662a/meta-networking/recipes-support/ntp/ntp_4.2.8.bb

ex:

 install -m 755 ${WORKDIR}/ntpdate ${D}${bindir}/ntpdate-sync
 ...
 install -m 0644 ${WORKDIR}/ntpdate.service ${D}${systemd_unitdir}/system/