Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

1 votes
1 answers
2889 views
How to set NTP tinker step (which unit)? and how to query?
One of the workaround for old CentOS/CentOS kernel (6.1-6.3) which may "Systems hang due to leap-second livelock." ([quoting redhat][1]), is to set `tinker step` in `/etc/ntp.conf`. Bug the documentation is not clear about the unit/syntax ( ). What is the exact syntax (unit) for `tinker step`? Also,...
One of the workaround for old CentOS/CentOS kernel (6.1-6.3) which may "Systems hang due to leap-second livelock." (quoting redhat ), is to set tinker step in /etc/ntp.conf. Bug the documentation is not clear about the unit/syntax (). What is the exact syntax (unit) for tinker step? Also, how can I query the current value of tinker step on a running NTP daemon?
Franklin Piat (3121 rep)
Jun 26, 2015, 02:56 PM • Last activity: Aug 4, 2025, 06:05 AM
1 votes
1 answers
2586 views
Orange Pi Zero: Wrong Date and Time even given Internet Access
I am using Orange Pi Zero and running Armbian Stretch OS 5.59 on it. Problem is, it is giving wrong date and time even in the presence of the Internet. I have tried restarting "ntp" service but to no avail. I have also tried rebooting, but the same annoying result. I have already set the right timez...
I am using Orange Pi Zero and running Armbian Stretch OS 5.59 on it. Problem is, it is giving wrong date and time even in the presence of the Internet. I have tried restarting "ntp" service but to no avail. I have also tried rebooting, but the same annoying result. I have already set the right timezone which is PKT, but it shouldn't matter. So what do I need to do or change? Thank you.
Saad (17 rep)
Nov 27, 2018, 08:36 AM • Last activity: Jul 19, 2025, 08:07 AM
1 votes
1 answers
28 views
Comparing Solaris NTP and MacOS SNTP results? Is this accurate time?
What are expected values for offset and jitter from NTP? I have Solaris 11.4 in a VM with NTP configured and am comparing Solaris time stats to my Mac. I notice that MacOS `sntp -sS time.apple.com` reports very low offset of ~0.01s +/- ~0.01s. On Solaris I invoke `ntpq -pcrv` and note my offset is ~...
What are expected values for offset and jitter from NTP? I have Solaris 11.4 in a VM with NTP configured and am comparing Solaris time stats to my Mac. I notice that MacOS sntp -sS time.apple.com reports very low offset of ~0.01s +/- ~0.01s. On Solaris I invoke ntpq -pcrv and note my offset is ~-6s +/- ~2s to time.nist.gov.
atod (155 rep)
Jul 13, 2025, 11:38 PM • Last activity: Jul 13, 2025, 11:59 PM
2 votes
1 answers
59 views
Why the NTP service systemd-timesyncd is not able to synchronize to an offline NTP Server?
### Configuration of `systemd-timesyncd` ### On my linux distribution I'm using the NTP client `systemd-timesyncd`. Its configuration file (`/etc/systemd/timesyncd.conf`) is: ``` [Time] NTP=192.168.127.11 FallbackNTP=192.168.127.11 #RootDistanceMaxSec=5 #PollIntervalMinSec=32 #PollIntervalMaxSec=204...
### Configuration of systemd-timesyncd ### On my linux distribution I'm using the NTP client systemd-timesyncd. Its configuration file (/etc/systemd/timesyncd.conf) is:
[Time]
NTP=192.168.127.11
FallbackNTP=192.168.127.11
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048
where 192.168.127.11 is the IP address of a Lubuntu workstation where is installed the package ntp. The Lubuntu workstation is **offline** (it is not connected to any other host other than the linux distribution where is in execution the systemd-timesyncd client). ### NTP Server configuration ### The Lubuntu workstation (ip address 192.168.127.201) executes the service ntpsec.service with the following configuration file /etc/ntpsec/ntp.conf:
# /etc/ntpsec/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

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

# This should be maxclock 7, but the pool entries count towards maxclock.
tos maxclock 11

# Comment this out if you have a refclock and want it to be able to discipline
# the clock by itself (e.g. if the system is not connected to the network).
#tos minclock 4 minsane 3

# Specify one or more NTP servers.

# Public NTP servers supporting Network Time Security:
# server time.cloudflare.com nts

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See https://www.pool.ntp.org/join.html  for
# more information.
#pool 0.ubuntu.pool.ntp.org iburst
#pool 1.ubuntu.pool.ntp.org iburst
#pool 2.ubuntu.pool.ntp.org iburst
#pool 3.ubuntu.pool.ntp.org iburst

# Use Ubuntu's ntp server as a fallback.
#server ntp.ubuntu.com
server 127.127.1.0
fudge 127.127.1.0 stratum 1

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

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
### systemd-timesyncd is in Idle ### systemd-timesyncd client is in the "Idle" Status as showed by the following output message:
systemd-timesyncd.service - Network Time Synchronization
     Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; disabled; vendor preset: disabled)
     Active: active (running) since Thu 2025-07-10 10:28:13 CEST; 7min ago
       Docs: man:systemd-timesyncd.service(8)
   Main PID: 71449 (systemd-timesyn)
     Status: "Idle."
      Tasks: 2 (limit: 2199)
     Memory: 860.0K
     CGroup: /system.slice/systemd-timesyncd.service
             └─71449 /lib/systemd/systemd-timesyncd

Jul 10 10:28:12  systemd: Starting Network Time Synchronization...
Jul 10 10:28:13  systemd: Started Network Time Synchronization.
### Wireshark captured ### By Wireshark I can see that client and server exchange some datagrams. In the response datagram of the Server I can see the following information:
Frame 4379: 90 bytes on wire (720 bits), 90 bytes captured (720 bits) on interface 0
Ethernet II, Src:  (), Dst:  ()
Internet Protocol Version 4, Src: 192.168.127.11, Dst: 192.168.127.201
User Datagram Protocol, Src Port: 123, Dst Port: 45358
Network Time Protocol (NTP Version 4, server)
    Flags: 0xe4, Leap Indicator: unknown (clock unsynchronized), Version number: NTP Version 4, Mode: server
        11.. .... = Leap Indicator: unknown (clock unsynchronized) (3)
        ..10 0... = Version number: NTP Version 4 (4)
        .... .100 = Mode: server (4)
    Peer Clock Stratum: unspecified or invalid (0)
    Peer Polling Interval: invalid (0)
    Peer Clock Precision: 0,000000 sec
    Root Delay: 0 seconds
    Root Dispersion: 0,0037841796875 seconds
    Reference ID: (Initialization)
    Reference Timestamp: Jan  1, 1970 00:00:00.000000000 UTC
    Origin Timestamp: Jul 10, 2025 09:07:50.163961034 UTC
    Receive Timestamp: Jul 10, 2025 09:14:44.087945767 UTC
    Transmit Timestamp: Jul 10, 2025 09:14:44.088197457 UTC
In this captured datagram I would highlight the Flags byte=0xe4 and in particular the 2 bits:
11.. .... = Leap Indicator: unknown (clock unsynchronized)  # in the Flags byte
Furthermore I highlight the 2 bytes (equal to 0):
Peer Clock Stratum: unspecified or invalid (0)
Peer Polling Interval: invalid (0)
I have noted that with an other NTP server the byte Peer Clock Stratum is equal to 1 and the client is able to synchronize its date and time. ### Question ### Why in my context the service systemd-timesyncd is not able to synchronize to my offline NTP Server? ### links read but not useful ### I have checked many posts (for example [this link](https://unix.stackexchange.com/questions/323348/ntp-client-not-synchronizing-from-a-private-ntp-server) or [this other](https://unix.stackexchange.com/questions/714732/system-clock-not-synchronized-with-ntp-server-using-systemd-timesyncd)) but none of these have been useful.
User051209 (498 rep)
Jul 10, 2025, 09:34 AM • Last activity: Jul 11, 2025, 04:36 PM
12 votes
7 answers
56949 views
How to get system time with microsecond Resolution
I want to know current system time with microsecond Resolution. `date +%s` returns Time in seconds since epoch(1-1-1970). How can I get time in microseconds Resolution. How much delay is in querying this value? By delay I mean suppose at time `t` secs i query and it gives me value `t + t'` what is `...
I want to know current system time with microsecond Resolution. date +%s returns Time in seconds since epoch(1-1-1970). How can I get time in microseconds Resolution. How much delay is in querying this value? By delay I mean suppose at time t secs i query and it gives me value t + t' what is t' ?
My Use case: I am recording Videos using multiple Raspberry Pis simulatenously. Now I want to timestamp each frame of videos so that I can align them. Currently for timestamp it's using boot time(time since boot). Boot time is accurate but it's different for each Raspberry Pi. I have configured all Pi's to a NTP Server thus all have same System time. So basically I want the timestamp of System time not Boot Time. How can I do that ?
Coderaemon (229 rep)
May 21, 2015, 10:23 AM • Last activity: Jul 11, 2025, 10:46 AM
5 votes
0 answers
39 views
Units of tick in struct timex
Linux header files and man pages for adjtimex(2) and ntp_adjtime(2) describe struct timex, containing a tick field that is described as the number of microseconds for each system clock tick. However, my Debian 10 and 12 systems have CONFIG_HZ=250, while ntp_adjtime(2) says that tick=10000, which wou...
Linux header files and man pages for adjtimex(2) and ntp_adjtime(2) describe struct timex, containing a tick field that is described as the number of microseconds for each system clock tick. However, my Debian 10 and 12 systems have CONFIG_HZ=250, while ntp_adjtime(2) says that tick=10000, which would correspond to a clock rate of 100Hz, not 250Hz. This old-ish source says that in fact the adjtimex(2) and ntp_adjtime(2) tick value is an abstract value (mainly for use by NTP) that is the number of times an NTP abstract tick occurs in a day. This would resolve the conflict of an OS running with 250Hz clock ticks but having tick=10000. This tick=10000 would thus correspond to about 8.64 seconds. It looks like the struct time tick value was originally the number of microseconds in a clock tick; early papers from David Mills say that this was the rate (100Hz) that the Solaris machines he was using ticked their system clock. Are the units of struct timex's tick field now "number of ticks per day" or are they still number of microseconds per tick? If the latter, what ticks are being referenced, since clearly it does not correspond to the CONFIG_HZ value for my Linux kernels?
A Rooks (51 rep)
Jun 17, 2025, 06:17 PM
0 votes
1 answers
75 views
Is there a way different from restart the systemd-timesyncd service to know the synchronization status between the client and the NTP server?
On my Linux distribution I'm using the NTP client `systemd-timesyncd`. ### Test case ### The test case is: 1. Boot while the system is able to reach the NTP server (that is `time1.google.com`) by a connection to a Wi-Fi network. 2. `systemd-timesyncd` is able to synchronize to the server as we can s...
On my Linux distribution I'm using the NTP client systemd-timesyncd. ### Test case ### The test case is: 1. Boot while the system is able to reach the NTP server (that is time1.google.com) by a connection to a Wi-Fi network. 2. systemd-timesyncd is able to synchronize to the server as we can see by this log on journald:
Jun 03 10:38:24  systemd-timesyncd: Initial synchronization to time server 216.239.35.0:123 (time1.google.com).
3. Disconnection of the system from the Wi-Fi network: the NTP server is no longer reachable. 4. systemd-timesyncd does not give any warning that the server is unreachable. ### Workaround: restart the service ### To know that the server is not reachable I need to restart the systemd-timesyncd service. After the restart of the service, the file /run/systemd/timesync/synchronized is not present so I can programmatically know that the NTP server is not reachable. Without the restart the file /run/systemd/timesync/synchronized is still present so it seems that client and server are synchronized. **NOTE**: also after the restart in the journald of the service systemd-timesyncd does not appear any log about the fact that the NTP server time1.google.com is not reachable. ### Question ### There is an other way than restart the systemd-timesyncd service to know the synchronization status between the client and the server NTP? --- **EDIT** After the step number 4 described in the post, it is not possible to see by timedatectl status that systemd-timesyncd is not synchronized to the server. Below there is the output of the timedatectl command:
> timedatectl status
               Local time: Tue 2025-06-03 12:02:30 CEST
           Universal time: Tue 2025-06-03 10:02:30 UTC 
                 RTC time: Tue 2025-06-03 10:02:29     
                Time zone: Europe/Rome (CEST, +0200)   
System clock synchronized: yes                         
              NTP service: active                      
          RTC in local TZ: no
User051209 (498 rep)
Jun 3, 2025, 09:07 AM • Last activity: Jun 3, 2025, 12:21 PM
2 votes
3 answers
4162 views
ntp server reachable but never select/set the time
We have some embedded devices using ntpd(4.2.8p10) to sync the time. One of our customers is using their own ntp server inside an internal network. From the ntpd -dgq debug mode, we found the server is reachable and we can get the offset, delay and jitter info. However, the ntpd will only exit with"...
We have some embedded devices using ntpd(4.2.8p10) to sync the time. One of our customers is using their own ntp server inside an internal network. From the ntpd -dgq debug mode, we found the server is reachable and we can get the offset, delay and jitter info. However, the ntpd will only exit with"**ntpd: no servers found**" and never select and set the local time.
2 Nov 11:57:05 ntpd: ntpd 4.2.8p10@1.3728-o Thu Jul 26 19:52:20 UTC 2018 (2): Starting
2 Nov 11:57:05 ntpd: Command line: ntpd -dgq
2 Nov 11:57:05 ntpd: proto: precision = 2.000 usec (-19)
Finished Parsing!!
restrict: op 1 addr 0.0.0.0 mask 0.0.0.0 mflags 00000000 flags 000005f0
restrict: op 1 addr 127.0.0.1 mask 255.255.255.255 mflags 00000000 flags 00000000
restrict source template mflags 4000 flags 1c0
restrict: op 1 addr (null) mask (null) mflags 00004000 flags 000001c0
move_fd: estimated max descriptors: 1024, initial socket boundary: 16
2 Nov 11:57:05 ntpd: Listen and drop on 0 v4wildcard 0.0.0.0:123
2 Nov 11:57:05 ntpd: Listen normally on 1 lo 127.0.0.1:123
restrict: op 1 addr 127.0.0.1 mask 255.255.255.255 mflags 00003000 flags 00000001
2 Nov 11:57:05 ntpd: Listen normally on 2 eth1 192.168.168.109:123
restrict: op 1 addr 192.168.168.109 mask 255.255.255.255 mflags 00003000 flags 00000001
2 Nov 11:57:05 ntpd: Listen normally on 3 wlan0 192.168.100.1:123
restrict: op 1 addr 192.168.100.1 mask 255.255.255.255 mflags 00003000 flags 00000001
2 Nov 11:57:05 ntpd: Listening on routing socket on fd #27 for interface updates
key_expire: at 0 associd 60163
peer_clear: at 0 next 1 associd 60163 refid INIT
restrict: op 1 addr 10.160.129.161 mask 255.255.255.255 mflags 00004000 flags 000001c0
restrict_source: 10.160.129.161 host restriction added
event at 0 10.160.129.161 8011 81 mobilize assoc 60163
newpeer: 192.168.168.109->10.160.129.161 mode 3 vers 4 poll 6 10 flags 0x101 0x1 ttl 0 key 00000000
event at 0 0.0.0.0 c016 06 restart
peer_xmit: at 1 192.168.168.109->10.160.129.161 mode 3 len 48 xmt 0xe52bde52.ddf3c87c
auth_agekeys: at 1 keys 0 expired 0
event at 1 10.160.129.161 8014 84 reachable
clock_filter: n 1 off 30.082946 del 0.048598 dsp 7.945314 jit 0.000002
peer_xmit: at 3 192.168.168.109->10.160.129.161 mode 3 len 48 xmt 0xe52bde54.ddf0a416
clock_filter: n 2 off 30.083616 del 0.047583 dsp 3.949228 jit 0.000670
peer_xmit: at 5 192.168.168.109->10.160.129.161 mode 3 len 48 xmt 0xe52bde56.dde968ab
clock_filter: n 3 off 30.078398 del 0.054469 dsp 1.951189 jit 0.004895
peer_xmit: at 7 192.168.168.109->10.160.129.161 mode 3 len 48 xmt 0xe52bde58.dde80026
clock_filter: n 4 off 30.079499 del 0.074539 dsp 0.952172 jit 0.003164
peer_xmit: at 9 192.168.168.109->10.160.129.161 mode 3 len 48 xmt 0xe52bde5a.ddea03c8
clock_filter: n 5 off 30.083616 del 0.044472 dsp 0.452664 jit 0.003340
2 Nov 11:57:16 ntpd: ntpd: no servers found
END OF FILE

Also, when running ntpd in the background and using **ntpq -p** to query the ntpd status. We get the following result, the st, delay, offset and reach seem fine.
root@S8P20092901:~# ntpq -c as

ind assid status  conf reach auth condition  last_event cnt
===========================================================
  1 59609  9014   yes   yes  none    reject   reachable  1

root@S8P20092901:~# ntpq -np
     remote           refid      st t when poll reach   delay    offset  jitter
==============================================================================
 10.160.129.161  162.159.200.123  4 u  24   64   377    40.404    -180.122   20.122

However, the ntpd never select the ntp server as the time source(never show "*" or "+" before the remote address ) or sets the local time after a long time of waiting.
I looked into the source code. When using ntpdate(-q) mode the ntpd will exit after doing all bursts for every server when there is no clock selected/ set
} else {
		peer->burst--;
		if (peer->burst == 0) {

			/*
			 * If ntpdate mode and the clock has not been
			 * set and all peers have completed the burst,
			 * we declare a successful failure.
			 */
			if (mode_ntpdate) {
				peer_ntpdate--;
				if (peer_ntpdate == 0) {
					msyslog(LOG_NOTICE,
					    "ntpd: no servers found");
					if (!msyslog_term)
						printf(
						    "ntpd: no servers found\n");
					exit (0);
				}
			}
		}
	}

However, I am still not understand why ntpd didn't select and set a time form the server. Thanks for your help in advance.
tj2298 (23 rep)
Nov 14, 2021, 08:01 PM • Last activity: May 23, 2025, 07:18 PM
28 votes
4 answers
39563 views
how do you set up a linux client to use ntp information provided through dhcp?
there are so many tutorials out there explaining how to setup `dhcpd` server, in relation to providing ntp suggestions to dhcp clients, that I had always thought that `ntp` configuration was carried out automatically. Recently I started seeing clock drifts in my local network, so I assume this was a...
there are so many tutorials out there explaining how to setup dhcpd server, in relation to providing ntp suggestions to dhcp clients, that I had always thought that ntp configuration was carried out automatically. Recently I started seeing clock drifts in my local network, so I assume this was a wrong assumption. So I set out to see how can one minimize the ntp client configuration, provided one has carried out the effort to set up ntp-server suggestions through dhcpd. I have not been able to find much apart from this Ubuntu specific help tutorial https://help.ubuntu.com/community/UbuntuTime . Even here (see paragraph under "Troubleshooting -> Which configuration file is it using?") the information is scarce but it says that if an /etc/ntp.conf.dhcp file is found it will be used instead. First of all the actual location that the writer meant here is /var/lib/ntp/ntp.conf.dhcp as observed in /etc/init.d/ntp , but regardless of that the presence of this file does not guarantee that the ntp will request servers from dhclient. As a result, I have to explicitly add the server clause in ntp.conf.dhcp for my local ntp server. But in that case, why do I even setup ntp settings on the dhcpd server? This seems to go against intuition, ie setup ntp settings once (ie on the server) and let dhcpd server delegate the information to the clients. How can I minimize (if not avoid altogether), client configuration for the ntp. Alternatively, how can I get ntp information through dhclient. Is there a cli solution that fits all linux distros? I assume every client should have the executables of ntpd, but I do not know how to proceed from there. Thank you EDIT: ubuntu client verbose output when running manually dhclient: sudo dhclient -1 -d -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0 Internet Systems Consortium DHCP Client 4.2.4 Copyright 2004-2012 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ Listening on LPF/eth0/20:cf:30:0e:6c:12 Sending on LPF/eth0/20:cf:30:0e:6c:12 Sending on Socket/fallback DHCPREQUEST of 192.168.112.150 on eth0 to 255.255.255.255 port 67 (xid=0x2e844b8f) DHCPACK of 192.168.112.150 from 192.168.112.112 reload: Unknown instance: invoke-rc.d: initscript smbd, action "reload" failed. RTNETLINK answers: File exists * Stopping NTP server ntpd ...done. * Starting NTP server ntpd ...done. bound to 192.168.112.150 -- renewal in 41963 seconds. The ntpd service is restarted, yet running ntpq -cpe -cas afterwards I still do not see my local ntp server in the list of ntp servers. Of course my dhcpd server does have option ntp-servers subnet 192.168.112.0 netmask 255.255.255.0 { max-lease-time 604800; default-lease-time 86400; authoritative; ignore client-updates; option ntp-servers 192.168.112.112; #self ... (many other options) }
nass (1508 rep)
Dec 4, 2016, 03:09 PM • Last activity: May 20, 2025, 10:55 AM
4 votes
1 answers
4674 views
systemd-timesyncd: Timed out
I'm struggling to synchronize my system clock on Pop OS 21.04. I've read a lot of posts on the subject but it doesn't seem to help. my system clock are not synchronized, which caused issues with loading some resources (e.g. gitlab) ``` $ timedatectl Local time: Sat 2021-10-09 23:02:20 CEST Universal...
I'm struggling to synchronize my system clock on Pop OS 21.04. I've read a lot of posts on the subject but it doesn't seem to help. my system clock are not synchronized, which caused issues with loading some resources (e.g. gitlab)
$ timedatectl 
               Local time: Sat 2021-10-09 23:02:20 CEST
           Universal time: Sat 2021-10-09 21:02:20 UTC
                 RTC time: Sat 2021-10-09 21:02:21
                Time zone: Europe/Madrid (CEST, +0200)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no
my timesyncd.conf looks as following
[Time]
NTP=0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org
FallbackNTP=ntp.ubuntu.com
RootDistanceMaxSec=5
PollIntervalMinSec=32
PollIntervalMaxSec=2048
I've changed NTP servers several time, used IPs and different servers but no matter what I do I always end up with:
$ systemctl status systemd-timesyncd
● systemd-timesyncd.service - Network Time Synchronization
     Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-10-09 22:42:10 CEST; 23min ago
       Docs: man:systemd-timesyncd.service(8)
   Main PID: 9955 (systemd-timesyn)
     Status: "Connecting to time server 162.159.200.123:123 (1.pool.ntp.org)."
      Tasks: 2 (limit: 37919)
     Memory: 1.1M
     CGroup: /system.slice/systemd-timesyncd.service
             └─9955 /lib/systemd/systemd-timesyncd

Oct 09 22:55:08 pop-os systemd-timesyncd: Timed out waiting for reply from 69.164.213.136:123 (0.pool.ntp.org).
Oct 09 22:55:18 pop-os systemd-timesyncd: Timed out waiting for reply from 82.64.172.48:123 (0.pool.ntp.org).
Oct 09 22:55:29 pop-os systemd-timesyncd: Timed out waiting for reply from 85.25.128.62:123 (0.pool.ntp.org).
Oct 09 22:55:39 pop-os systemd-timesyncd: Timed out waiting for reply from 216.197.228.230:123 (0.pool.ntp.org).
Oct 09 22:55:49 pop-os systemd-timesyncd: Timed out waiting for reply from 185.132.136.116:123 (1.pool.ntp.org).
Oct 09 22:55:59 pop-os systemd-timesyncd: Timed out waiting for reply from 5.56.160.3:123 (1.pool.ntp.org).
Oct 09 22:56:10 pop-os systemd-timesyncd: Timed out waiting for reply from 162.159.200.123:123 (2.pool.ntp.org).
Oct 09 22:56:20 pop-os systemd-timesyncd: Timed out waiting for reply from 185.18.52.78:123 (2.pool.ntp.org).
Oct 09 23:05:02 pop-os systemd-timesyncd: Timed out waiting for reply from 51.38.162.10:123 (0.pool.ntp.org).
Oct 09 23:05:13 pop-os systemd-timesyncd: Timed out waiting for reply from 90.165.120.190:123 (0.pool.ntp.org).
AFAIK it uses 123 udp port to send requests, I don't have any firewall and it seems it's accessible
$ nc -vzu 0.pool.ntp.org 123
Connection to 0.pool.ntp.org (90.165.120.190) 123 port [udp/ntp] succeeded!
any help on how to synchronize system clock?
Pavel K (141 rep)
Oct 9, 2021, 09:13 PM • Last activity: May 15, 2025, 05:08 AM
0 votes
2 answers
2123 views
chronyd not responding to some hosts
I have a vanilla install of CentOS 8 ad am using it as an NTP server with Chronyd. It is silently refusing to answer a host on its own network, but it *will* answer another host I have tested off network: [![enter image description here][1]][1] On the left, a host on its own network. Asking it repea...
I have a vanilla install of CentOS 8 ad am using it as an NTP server with Chronyd. It is silently refusing to answer a host on its own network, but it *will* answer another host I have tested off network: enter image description here On the left, a host on its own network. Asking it repeatedly for response and it sending nothing. On the right, a host off network that syncs without problem. I have not configured any sort of ACL nor set any settings on chronyd other than to set an upstream NTP server. I just don't have any idea why it would respond to one but not the other.
Grant Curell (769 rep)
Dec 17, 2020, 08:22 PM • Last activity: May 1, 2025, 12:08 AM
0 votes
1 answers
2145 views
how to forward ntp traffic to default gateway instead of vpn tunnel
I have a small Raspberry Pi server connected to an openvpn provider, used as a VPN gateway. Almost everything works fine with the following `iptables` rules: iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE iptables -A FORWARD -i tun0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT iptabl...
I have a small Raspberry Pi server connected to an openvpn provider, used as a VPN gateway. Almost everything works fine with the following iptables rules: iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE iptables -A FORWARD -i tun0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A FORWARD -i eth0 -o tun0 -j ACCEPT However, the VPN provider blocks NTP traffic (udp port 123). How do I make iptables route all NTP traffic via the default gateway (which is 192.168.1.1 on eth0)?
Branislav Zlatkovic (1 rep)
Jun 4, 2016, 10:29 AM • Last activity: Apr 4, 2025, 09:10 PM
1 votes
3 answers
149 views
How to prove that NTP time sync is checking regularly
How does one prove that `systemd-timesyncd` is regularly polling the NTP servers to ensure that the system's clock remains "synchronized"? I understand that I can check the *yes/no* sync'd status by running `timedatectl`, and it does tell me 'yes', but couldn't that just be a stale status from month...
How does one prove that systemd-timesyncd is regularly polling the NTP servers to ensure that the system's clock remains "synchronized"? I understand that I can check the *yes/no* sync'd status by running timedatectl, and it does tell me 'yes', but couldn't that just be a stale status from months prior? I don't see any evidence that any software component is actually reaching out to the NTP server pool to actually check on a regular basis. With the default config PollIntervalMaxSec of 2048, it's my understanding that it should reach out to NTP, at most, every 34 minutes to do a clock comparison. Is this how it should work? If I run journalctl -u systemd-timesyncd I only see evidence of sync events for reboots or apt upgrades. In fact, weeks go by without any clock synchronization log entries. For my time-sensitive application, I'm concerned that if weeks/months go by without any NTP checking, my system's clock can drift perhaps significantly. I'd like it to check once a day and *prove* that it is.
BCA (113 rep)
Mar 19, 2025, 02:24 PM • Last activity: Mar 19, 2025, 10:09 PM
0 votes
1 answers
88 views
How to set `iptables` so NTP works while internet access is blocked
I want to configure `iptables` such that it blocks everything except 1. Date time synchronization over the internet using NTP and 2. Access from machines in the LAN. I wrote the following script: ```bash # Reset firewall: iptables -F # Allow NTP so the hour syncs over the internet: iptables -A OUTPU...
I want to configure iptables such that it blocks everything except 1. Date time synchronization over the internet using NTP and 2. Access from machines in the LAN. I wrote the following script:
# Reset firewall:
iptables -F

# Allow NTP so the hour syncs over the internet:
iptables -A OUTPUT -p udp --dport 123 -j ACCEPT
iptables -A INPUT -p udp --sport 123 -j ACCEPT

# Allow LAN:
iptables -A INPUT -s $NETWORK_ADDRESS/$MASK -j ACCEPT
iptables -A OUTPUT -d $NETWORK_ADDRESS/$MASK -j ACCEPT

# Block all the rest:
iptables -A INPUT -j DROP
iptables -A OUTPUT -j DROP
following [this answer](https://superuser.com/a/141795/1210408) . After the script, I run sudo date -s "2 OCT 2006 18:00:00" && sudo service ntp stop && sudo service ntp start && date && watch -n 1 date. However, the date and time never synchronize until I do iptables -F. What am I doing wrong?
user171780 (286 rep)
Mar 1, 2025, 10:34 AM • Last activity: Mar 1, 2025, 01:48 PM
0 votes
2 answers
9756 views
timedatectl fails to query server
When running `timedatectl` to check if my system clock has been synchronized via NTP I get the following: ``` ~> timedatectl Failed to query server: The name org.freedesktop.timedate1 was not provided by any .service files ``` systemd-timedated.service has ran. ``` ~> systemctl status systemd-timeda...
When running timedatectl to check if my system clock has been synchronized via NTP I get the following:
~> timedatectl
Failed to query server: The name org.freedesktop.timedate1 was not provided by any .service files
systemd-timedated.service has ran.
~> systemctl status systemd-timedated.service
● systemd-timedated.service - Time & Date Service
     Loaded: loaded (/usr/lib/systemd/system/systemd-timedated.service; static; vendor preset: enabled)
     Active: inactive (dead)
       Docs: man:systemd-timedated.service(8)
             man:localtime(5)
             https://www.freedesktop.org/wiki/Software/systemd/timedated 

Mar 23 14:28:16 cm1sd systemd: Starting Time & Date Service...
Mar 23 14:28:16 cm1sd systemd: Started Time & Date Service.
Mar 23 14:29:00 cm1sd systemd: systemd-timedated.service: Succeeded.
Looking online I haven't found anything talking about this error message. How can I use systemd and timedatectl to have my system clock synchronized with an NTP server? I've also noted nothing under /etc/systemd/ defines the NTP server to use. I'm on an embedded Linux system, built using Buildroot, systemd version 244.5.
dangeroushobo (707 rep)
Mar 23, 2021, 02:27 PM • Last activity: Feb 1, 2025, 06:02 AM
1 votes
1 answers
88 views
GNU `make`, modification times, leap seconds and NTP
GNU `make` relies on timestamps to see if a dependency was changed after some file was built. If you make a change during the leap second or an NTP adjustment, is it possible that `make` will believe the dependency is older than the built file when it really isn't? This would cause the file to never...
GNU make relies on timestamps to see if a dependency was changed after some file was built. If you make a change during the leap second or an NTP adjustment, is it possible that make will believe the dependency is older than the built file when it really isn't? This would cause the file to never be rebuilt.
Tomek Czajka (121 rep)
Dec 17, 2024, 08:38 PM • Last activity: Dec 17, 2024, 08:58 PM
51 votes
3 answers
67638 views
ntpd vs. systemd-timesyncd - How to achieve reliable NTP syncing?
When I query the status of the NTP daemon with `ntpdc -c sysinfo` I get the following output: system peer: 0.0.0.0 system peer mode: unspec leap indicator: 11 stratum: 16 precision: -20 root distance: 0.00000 s root dispersion: 12.77106 s reference ID: [73.78.73.84] reference time: 00000000.00000000...
When I query the status of the NTP daemon with ntpdc -c sysinfo I get the following output: system peer: 0.0.0.0 system peer mode: unspec leap indicator: 11 stratum: 16 precision: -20 root distance: 0.00000 s root dispersion: 12.77106 s reference ID: [73.78.73.84] reference time: 00000000.00000000 Thu, Feb 7 2036 7:28:16.000 system flags: auth monitor ntp kernel stats jitter: 0.000000 s stability: 0.000 ppm broadcastdelay: 0.000000 s authdelay: 0.000000 s This indicates that the NTP sync failed. However the system time is accurate within 1 second precision. When I ran my system without network connection for the same period as I did now the system time would deviate ~10s. This behavior suggests that the system has another way of syncing the time. I realized that there is also systemd-timesyncd.service (with configuration file at /etc/systemd/timesyncd.conf) and timedatectl status gives me the correct time: Local time: Thu 2016-08-25 10:55:23 CEST Universal time: Thu 2016-08-25 08:55:23 UTC RTC time: Thu 2016-08-25 08:55:22 Time zone: Europe/Berlin (CEST, +0200) NTP enabled: yes NTP synchronized: yes RTC in local TZ: no DST active: yes Last DST change: DST began at Sun 2016-03-27 01:59:59 CET Sun 2016-03-27 03:00:00 CEST Next DST change: DST ends (the clock jumps one hour backwards) at Sun 2016-10-30 02:59:59 CEST Sun 2016-10-30 02:00:00 CET So my question is what is the difference between the two mechanisms? Is one of them deprecated? Can they be used in parallel? Which one should I trust when I want to query the NTP sync status? (Note that I have a different system (in a different network) for which both methods indicate success and yield the correct time.)
a_guest (643 rep)
Aug 25, 2016, 09:08 AM • Last activity: Oct 12, 2024, 11:22 AM
0 votes
0 answers
312 views
Missing read access to /etc/chrony/chrony.keys and Cannot open /var/log/chrony/tracking.log due to permission denied
i hope this post finds you well, i have a three NTP servers ( two chrony , and one ntpsec ) , that peer to peer to each , the problem is when i pass to authentication ( symmetric key between ntp servers ), when i run sudo systemctl restart chronyd it always : ]: chronyd version 4.5 starting (+CMDMON...
i hope this post finds you well, i have a three NTP servers ( two chrony , and one ntpsec ) , that peer to peer to each , the problem is when i pass to authentication ( symmetric key between ntp servers ), when i run sudo systemctl restart chronyd it always : ]: chronyd version 4.5 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP ]: Wrong owner of /run/chrony (UID = 110) 1: Disabled command socket /run/chrony/chronyd.sock ]: Loaded 2 symmetric keys ] ]: Missing read access to /etc/chrony/chrony.keys: Permission denied Initial frequency -4.700 ppm ]: Could not open /var/log/chrony/tracking.log Permission denied ]: Loaded seccomp filter (level 1) Started chrony.service- chrony, an NTP client/server. ]: Could not open /var/log/chrony/measurements.log: Permission denied whoever i do : > sudo useradd -r -s /usr/sbin/nologin -d /var/lib/chrony -U chrony > sudo chown -R chrony:chrony /etc/chrony sudo chown -R chrony:chrony > /var/log/chrony sudo chown -R chrony:chrony /var/lib/chrony sudo chown > -R chrony:chrony /run/chrony sudo chmod -R 755 /var/log/chrony sudo chmod -R 750 /var/lib/chrony sudo chmod -R 750 /run/chrony sudo chmod > 640 /etc/chrony/chrony.keys
faten-zz (1 rep)
Sep 26, 2024, 12:19 PM
0 votes
1 answers
156 views
Chrony NTP: synchronization with an external NTP server in my Docker container works for a few seconds, but after that, synchronization stops working
Time synchronization with an external NTP server in my Docker container works for a few seconds, but after that, synchronization stops working : logs : 2024-09-08T20:54:15Z chronyd version 4.0 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +NTS +SECHASH +IPV6 -DEBUG) 2024...
Time synchronization with an external NTP server in my Docker container works for a few seconds, but after that, synchronization stops working : logs : 2024-09-08T20:54:15Z chronyd version 4.0 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +NTS +SECHASH +IPV6 -DEBUG) 2024-09-08T20:54:15Z Initial frequency 83333.333 ppm 2024-09-08T20:54:15Z Using right/UTC timezone to obtain leap second data *2024-09-08T20:54:20Z Selected source 196.200.160.123 (2.debian.pool.ntp.org)* 2024-09-08T20:54:20Z System clock wrong by -5318.299142 seconds 2024-09-08T19:25:41Z System clock was stepped by -5318.299142 seconds 2024-09-08T19:25:41Z System clock TAI offset set to 37 seconds 2024-09-08T20:54:45Z Forward time jump detected! **2024-09-08T20:54:45Z Can't synchronise: no selectable sources** /etc/chrony/chrony.conf file : confdir /etc/chrony/conf.d pool 2.debian.pool.ntp.org iburst sourcedir /run/chrony-dhcp sourcedir /etc/chrony/sources.d keyfile /etc/chrony/chrony.keys driftfile /var/lib/chrony/chrony.drift ntsdumpdir /var/lib/chrony logdir /var/log/chrony maxupdateskew 100.0 rtcsync makestep 1 3 leapsectz right/UTC
AHmedRef (151 rep)
Sep 8, 2024, 08:52 PM • Last activity: Sep 13, 2024, 08:06 PM
0 votes
2 answers
737 views
NTP client cannot sync date from a specific Server
I want to create a NTP server, and my clients could sync date from this Server. So I add restrict policy in my server, and then restart the NTP service to my it works as a NTP server. Then I add this server to my clients, and remote other NTP servers and pools to make it the only NTP server in this...
I want to create a NTP server, and my clients could sync date from this Server. So I add restrict policy in my server, and then restart the NTP service to my it works as a NTP server. Then I add this server to my clients, and remote other NTP servers and pools to make it the only NTP server in this client. I have already run this command to check this server chosen by the client:
ntpq -pn

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*xx.xx.xx.xx     91.189.91.157    3 u  342   64  340    0.087    8.349 4492269
As you can see, it works fine. I also run **ntpdate -q xx.xx.xx.xx** to check the time by hand. But I want to change a specific time in my NTP server, so I disabled all the pools in my NTP Server, and then using **date -s** to change the time. I also restarted this Server. The problem is that when I finished all these steps, the client cannot sync the datetime from my NTP server!
ntpdate -q xx.xx.xx.xx
server xx.xx.xx.xx, stratum 16, offset -26584.931234, delay 0.02574
27 Aug 07:23:49 ntpdate: no server suitable for synchronization found
Does that mean I still need to define a pool or a server in my NTP server, and how could I change a specific time in my NTP server?
Dodge_X (3 rep)
Aug 28, 2024, 01:01 AM • Last activity: Aug 28, 2024, 12:58 PM
Showing page 1 of 20 total questions