[SOLVED] ntpd: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized

Started by LouCipher, August 12, 2020, 12:20:59 PM

Previous topic - Next topic
Can't get ntpd to work. Clean install with default settings. It's stuck in Unreach/Pending no matter how long I wait.

Aug 12 10:25:38 OPNsense ntpd[19031]: ntpd 4.2.8p15@1.3728-o Tue Jul 28 02:25:36 UTC 2020 (1): Starting
Aug 12 10:25:38 OPNsense ntpd[19031]: Command line: /usr/local/sbin/ntpd -g -c /var/etc/ntpd.conf -p /var/run/ntpd.pid
Aug 12 10:25:38 OPNsense ntpd[19031]: ----------------------------------------------------
Aug 12 10:25:38 OPNsense ntpd[19031]: ntp-4 is maintained by Network Time Foundation,
Aug 12 10:25:38 OPNsense ntpd[19031]: Inc. (NTF), a non-profit 501(c)(3) public-benefit
Aug 12 10:25:38 OPNsense ntpd[19031]: corporation.  Support and training for ntp-4 are
Aug 12 10:25:38 OPNsense ntpd[19031]: available at https://www.nwtime.org/support
Aug 12 10:25:38 OPNsense ntpd[19031]: ----------------------------------------------------
Aug 12 10:25:38 OPNsense ntpd[22352]: proto: precision = 0.045 usec (-24)
Aug 12 10:25:38 OPNsense ntpd[22352]: basedate set to 2020-07-16
Aug 12 10:25:38 OPNsense ntpd[22352]: gps base set to 2020-07-19 (week 2115)
Aug 12 10:25:38 OPNsense ntpd[22352]: restrict: 'monitor' cannot be disabled while 'limited' is enabled
Aug 12 10:25:38 OPNsense ntpd[22352]: Listen and drop on 0 v6wildcard [::]:123
Aug 12 10:25:38 OPNsense ntpd[22352]: Listen and drop on 1 v4wildcard 0.0.0.0:123
Aug 12 10:25:38 OPNsense ntpd[22352]: Listen normally on 2 re0 10.0.0.4:123
Aug 12 10:25:38 OPNsense ntpd[22352]: Listen normally on 3 re0 [fe80::21e:6ff:fe45:2ce0%1]:123
Aug 12 10:25:38 OPNsense ntpd[22352]: Listen normally on 4 re1 [fe80::21e:6ff:fe45:2ce1%2]:123
Aug 12 10:25:38 OPNsense ntpd[22352]: Listen normally on 5 re1 10.0.0.197:123
Aug 12 10:25:38 OPNsense ntpd[22352]: Listen normally on 6 lo0 [::1]:123
Aug 12 10:25:38 OPNsense ntpd[22352]: Listen normally on 7 lo0 [fe80::1%4]:123
Aug 12 10:25:38 OPNsense ntpd[22352]: Listen normally on 8 lo0 127.0.0.1:123
Aug 12 10:25:38 OPNsense ntpd[22352]: Listening on routing socket on fd #29 for interface updates
Aug 12 10:25:38 OPNsense ntpd[22352]: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized
Aug 12 10:25:38 OPNsense ntpd[22352]: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized


NTP cannot synchronize when error is greater than the panic threshold, which is 1000s

Maybe this is the issue

Try to stop the service, then manually align with ntpdate, then restart the ntp service
https://www.signorini.ch
Protectli Pfsense Mi7500L6 Intel 7Th Gen Core I7 7500U 16Gb Ddr4 Ram
512Gb Msata Ssd
6 X Intel Gigabit Ethernet


Google says that this error message is not specific to Opnsense and often occurs during initial start up.  After a short while the clock stabilises and the message does not recur.

You can check the clock with:

# nptime

QuoteOr try chrony, pkg install os-chrony-devel

+1 for chrony


Thanks guys! I'll give set date manually a try then I'll try chrony.

Running ntptime gives an error

root@OPNsense:/var/log # ntptime
ntp_gettime() returns code 5 (ERROR)
  time e2dfbf6f.16e9f000  Thu, Aug 13 2020 15:32:31.089, (.244089507),
  maximum error 16032000 us, estimated error 16000000 us, TAI offset 0
ntp_adjtime() returns code 5 (ERROR)
  modes 0x0 (),
  offset 0.000 us, frequency 0.000 ppm, interval 4 s,
  maximum error 16032000 us, estimated error 16000000 us,
  status 0x41 (PLL,UNSYNC),
  time constant 3, precision 0.000 us, tolerance 496 ppm,
  pps frequency 0.000 ppm, stability 0.000 ppm, jitter 0.000 us,
  intervals 0, jitter exceeded 0, stability exceeded 0, errors 0.

the right command is ntpdate, ntptime is for checking...


here on a linux

root@linjs:/root # systemctl stop ntpd.service
root@linjs:/root # ntpdate -d time1.ethz.ch
13 Aug 16:33:22 ntpdate[28064]: ntpdate 4.2.8p12@1.3728-o (1)
Looking for host time1.ethz.ch and service ntp
192.33.96.101 reversed to time1.ethz.ch
host found : time1.ethz.ch
transmit(192.33.96.101)
receive(192.33.96.101)
transmit(192.33.96.101)
receive(192.33.96.101)
transmit(192.33.96.101)
receive(192.33.96.101)
transmit(192.33.96.101)
receive(192.33.96.101)

server 192.33.96.101, port 123
stratum 1, precision -22, leap 00, trust 000
refid [PPS], root delay 0.000000, root dispersion 0.001129
transmitted 4, in filter 4
reference time:    e2dfcdaf.e20b3677  Thu, Aug 13 2020 16:33:19.882
originate timestamp: e2dfcdb9.0419f314  Thu, Aug 13 2020 16:33:29.016
transmit timestamp:  e2dfcdb9.023592f9  Thu, Aug 13 2020 16:33:29.008
filter delay:  0.03868  0.03891  0.03833  0.03868
         0.00000  0.00000  0.00000  0.00000
filter offset: 0.000453 0.000584 0.000382 0.000520
         0.000000 0.000000 0.000000 0.000000
delay 0.03833, dispersion 0.00008
offset 0.000382

13 Aug 16:33:29 ntpdate[28064]: adjust time server 192.33.96.101 offset 0.000382 sec
root@linjs:/root # ntpdate time1.ethz.ch
13 Aug 16:33:42 ntpdate[28074]: adjust time server 192.33.96.101 offset 0.000278 sec
root@linjs:/root # ntptime
ntp_gettime() returns code 0 (OK)
  time e2dfcdd1.98178704 2020-08-13T14:33:53.594Z, (.594109583),
  maximum error 27000 us, estimated error 0 us, TAI offset 37
ntp_adjtime() returns code 0 (OK)
  modes 0x0 (),
  offset -0.020 us, frequency -17.823 ppm, interval 1 s,
  maximum error 27000 us, estimated error 0 us,
  status 0x2001 (PLL,NANO),
  time constant 4, precision 1.000 us, tolerance 500 ppm,
https://www.signorini.ch
Protectli Pfsense Mi7500L6 Intel 7Th Gen Core I7 7500U 16Gb Ddr4 Ram
512Gb Msata Ssd
6 X Intel Gigabit Ethernet

Tried stopping ntpd, setting date manually with date command, then restart ntpd. Still wont work. Any suggestions what is wrong?

Did a quick install of pfSense and it works straight away...but I would like to use OPNsense since it feel more modern.

Can you try to execute the following (when ntpd is not running)


ntpdate 0.opnsense.pool.ntp.org


Then wait a couple of minutes and the same again.

After that try to start ntpd the usual way via the services menu.

Ok, here's the result...

root@OPNsense:~ # ntpdate 0.opnsense.pool.ntp.org
14 Aug 10:24:59 ntpdate[87980]: step time server 83.168.200.198 offset +5655.643222 sec
root@OPNsense:~ # ntpdate 0.opnsense.pool.ntp.org
14 Aug 10:28:31 ntpdate[2106]: step time server 147.78.228.41 offset +157.351788 sec
root@OPNsense:~ #


Clock on dashboard seems to sync.

Starting ntpd...

Log shows:

Aug 14 10:28:35 OPNsense ntpd[77906]: 0.0.0.0 c016 06 restart
Aug 14 10:28:35 OPNsense ntpd[77906]: DNS 0.opnsense.pool.ntp.org -> 193.182.111.142
Aug 14 10:28:35 OPNsense ntpd[77906]: 193.182.111.142 8011 81 mobilize assoc 43417
Aug 14 10:28:36 OPNsense ntpd[77906]: DNS 1.opnsense.pool.ntp.org -> 193.182.111.141
Aug 14 10:28:36 OPNsense ntpd[77906]: 193.182.111.141 8011 81 mobilize assoc 43418
Aug 14 10:28:36 OPNsense ntpd[77906]: DNS 2.opnsense.pool.ntp.org -> 193.182.111.12
Aug 14 10:28:36 OPNsense ntpd[77906]: 193.182.111.12 8011 81 mobilize assoc 43419
Aug 14 10:28:36 OPNsense ntpd[77906]: DNS 3.opnsense.pool.ntp.org -> 162.159.200.123
Aug 14 10:28:36 OPNsense ntpd[77906]: 162.159.200.123 8011 81 mobilize assoc 43420
Aug 14 10:28:37 OPNsense ntpd[77906]: 162.159.200.123 8014 84 reachable
Aug 14 10:28:37 OPNsense ntpd[77906]: 193.182.111.142 8014 84 reachable
Aug 14 10:28:38 OPNsense ntpd[77906]: 193.182.111.141 8014 84 reachable
Aug 14 10:28:39 OPNsense ntpd[77906]: 193.182.111.12 8014 84 reachable


Services->Network time->Status shows:

Status   Server   Ref ID   Stratum   Type   When   Poll   Reach   Delay   Offset   Jitter
Unreach/Pending   193.182.111.142   192.36.143.152   2   u   41   64   1   12.357   +54612.   19739.1
Unreach/Pending   193.182.111.141   192.36.143.130   2   u   40   64   1   3.258   +57555.   19659.9
Unreach/Pending   193.182.111.12   192.36.143.153   2   u   39   64   1   2.974   +60612.   19798.2
Unreach/Pending   162.159.200.123   10.65.8.177   3   u   41   64   1   4.150   +54582.   19728.3

Your issue looks hardware related, as the rtc clock drifts 157 seconds within a couple of minutes, which will likely make ntpd stop at some point in time (which can even be during startup).

Ok, that might be it. I'll look in to that and report back. Thank you!

Ok, so problem solved :)

Seems like there is a problem with ODROID-H2(device used for OPNsense) and FreeBSD regarding hwclock.

What I did to fix this was to change the parameter kern.timecounter.hardware from TSC-low to ACPI-fast.

sysctl -w kern.timecounter.hardware=ACPI-fast

And made the change persistent with a tunable.

After that all looks good. Clock is correct.

Thanks AdSchellevis for pointing me in the right direction!

See below for more details of the fix.
https://forum.odroid.com/viewtopic.php?t=33911