What's new

NTP Daemon for ASUSWRT/Merlin

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

this is a back to the future bug and the delta between system time (at boot) and real time is larger than the double... hence the assert...

Double is a huge difference. Looking at his log in #78, the system clock is already synchronised to a sensible time..
 
I have used the latest binaries and get the same result:

Jun 6 21:11:02 ntpd[11595]: ntpd 4.2.8p7@1.3265 Fri May 13 15:44:00 UTC 2016 (8): Starting
Jun 6 21:11:02 ntpd[11595]: Command line: ntpd -c /jffs/etc/ntp.conf
Jun 6 21:11:02 ntpd[11596]: systime.c:111: INSIST(sys_fuzz >= 0) failed
Jun 6 21:11:02 ntpd[11596]: exiting (due to assertion failure)
 
I have used the latest binaries and get the same result:

Jun 6 21:11:02 ntpd[11595]: ntpd 4.2.8p7@1.3265 Fri May 13 15:44:00 UTC 2016 (8): Starting
Jun 6 21:11:02 ntpd[11595]: Command line: ntpd -c /jffs/etc/ntp.conf
Jun 6 21:11:02 ntpd[11596]: systime.c:111: INSIST(sys_fuzz >= 0) failed
Jun 6 21:11:02 ntpd[11596]: exiting (due to assertion failure)

Try with "-d" debug option to see more error messages available. E.g. you can run manually with "/jffs/bin/ntpd -d -d -c /jffs/etc/ntp.conf"

More "-d" will increase verbosity.
 
Thank you for the suggestion, but there is no additional information in the system log.

The error message indicates that: with two subsequent queries into your system clock, ntpd gets an earlier time in the second query than the first one.

So your system clock must be running backward LoL ...or the crystal is super unstable.

I'm running out of idea at the moment. Sorry..
 
Back to the future - also make sure if the ntpstats is enabled in ntp.conf that the directory is writeable...
 
From my DYI series ... setting up NTP

Code:
==== NTP =====

Time is the school in which we learn,\\
Time is the fire in which we burn.

-- Delmore Schwartz

Time is incredibly important when tracking performance, so we need to have a solid baseline for current time.

**Install NTP**

  sudo apt install ntp
Not much to do here, except enable logging, and set up the servers...

  sudo nano /etc/ntp.conf
Uncomment the stats...

  # Enable this if you want statistics to be logged.
  statsdir /var/log/ntpstats/
Optional - Update/modify the servers - in 16.04, the default pack has pools, not servers, so it's a choice, both are good.

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

And save the file, restart/kick ntp...

  sudo service ntp restart

you can check status by;

  $ ntpq -p
Should see something similar to

  $ ntpq -p
   remote           refid      st t when poll reach   delay   offset  jitter
  ==============================================================================
  repos.lax-noc.c 127.67.113.92    2 u    1   64    1   19.803   -0.605   1.258
  blue.1e400.net  173.66.221.127   2 u    -   64    1   85.346   -0.744   0.581
  hydrogen.consta 200.98.196.212   2 u    1   64    1  154.068  -32.902  16.849
  *time-a.timefreq .ACTS.           1 u    1   64    1   75.428    2.214   1.264
  2001:67c:1560:8 193.79.237.14    2 u    7   64    1  173.743   10.322   0.000
 
I just did "opkg install ntpd" (didn't know this was an option)

This binary seems to work just fine?...

jason@RT-N66U-39E8:/jffs/bin# /tmp/mnt/sda1/entware/sbin/ntpd -n -c /jffs/etc/ntp.conf
6 Jun 22:22:41 ntpd[1662]: ntpd 4.2.8p2@1.3265-o Tue Sep 22 14:18:11 UTC 2015 (1): Starting
6 Jun 22:22:41 ntpd[1662]: Command line: /tmp/mnt/sda1/entware/sbin/ntpd -n -c /jffs/etc/ntp.conf
6 Jun 22:22:41 ntpd[1662]: proto: precision = 52.500 usec (-14)
6 Jun 22:22:41 ntpd[1662]: Listen normally on 0 lo 127.0.0.1:123
6 Jun 22:22:41 ntpd[1662]: Listen normally on 1 br0 192.168.1.1:123
6 Jun 22:22:41 ntpd[1662]: Listening on routing socket on fd #18 for interface updates

I don't quite understand entware / opkg. Is there some reason I should not use this binary?

Edit:
I did get this error after a few minutes, but appears to still be serving time fine:
6 Jun 22:35:56 ntpd[1662]: kernel reports TIME_ERROR: 0x41: pll unsync Resource temporarily unavailable
 
Back to the future - also make sure if the ntpstats is enabled in ntp.conf that the directory is writeable...

ntpstats is disabled in the package of this thread. we don't use ntpstats for graphing.

Nice quote in your conf file btw :)
 
ntpstats is disabled in the package of this thread. we don't use ntpstats for graphing.

Nice quote in your conf file btw :)

The stats are handy for debug, but as kvic points out - it will take up more ram, and on a small footprint device like a router/AP, there's are fair amount of data written to the directory, and that's not good for an SD card or USB thumb drive...
 
Cleaning my desktop and here are some pictures I saved on another day. Want to say thank you to the NTP guys. Their algorithms are working so well in the following incident.

Something struck the network around 16:00 9/10. Network latency increased 20 folds from <0.5ms to 10ms. The algorithm responded immediately as shown with its bigger swings. It coped with the situation very well. The volatility only increased from +/- 0.2ms to +/-0.8ms.

stats-ntp-sysjit.png
stats-ntp-offset.png


At 22:00 9/10, network latency restored to 'normal". The algorithm responded immediately with another round of big but smaller swings until everything calmed down to +/- 0.2ms offset. Things back to 'normal' at 23:00 9/10:
stats-ntp-offset-1.png
 
Had to go back in time to dig it out of my RRD database, so the resolution is just hourly. My clock data is sourced from a GPS receiver, so there is less that can go wrong in the data.

6fbl7d.jpg

33crqzk.jpg

2dtdx08.jpg

16iefl2.jpg



How to go back in time to see the plots
Code:
rrdtool graph \
    --imgformat PNG /opt/home/public/localhost-ntp-offset.png \
    --width 600 --height 200 \
        --vertical-label "localhost" \
        --title "`TZ=EST5EDT /bin/date -d 197001010000.1473552000`" \
        --start 1473552000 \
        --end 1473652800 \
        DEF:offset=/opt/home/ntp/localhost.rrd:offset:LAST \
        CDEF:noffset=offset,1000,/ \
        LINE1:noffset#0000FF:"offset" \
        GPRINT:noffset:LAST:%le

rrdtool graph \
    --imgformat PNG /opt/home/public/localhost-ntp-sysjit.png \
    --width 600 --height 200 \
        --vertical-label "localhost" \
        --title "`TZ=EST5EDT /bin/date -d 197001010000.1473552000`" \
        --start 1473552000 \
        --end 1473652800 \
        DEF:sjit=/opt/home/ntp/localhost.rrd:sjit:LAST \
        CDEF:nsjit=sjit,1000,/ \
        LINE1:nsjit#0000FF:"sysjit" \
        GPRINT:nsjit:LAST:%le

rrdtool graph \
    --imgformat PNG /opt/home/public/localhost-ntp-clkjit.png \
    --width 600 --height 200 \
        --vertical-label "localhost" \
        --title "`TZ=EST5EDT /bin/date -d 197001010000.1473552000`" \
        --start 1473552000 \
        --end 1473652800 \
        DEF:cjit=/opt/home/ntp/localhost.rrd:cjit:LAST \
        CDEF:ncjit=cjit,1000,/ \
        LINE1:ncjit#0000FF:"cjit" \
        GPRINT:ncjit:LAST:%le

rrdtool graph  \
    --imgformat PNG /opt/home/public/localhost-ntp-wander.png \
    --width 600 --height 200 \
        --vertical-label "localhost" \
        --title "`TZ=EST5EDT /bin/date -d 197001010000.1473552000`" \
        --start 1473552000 \
        --end 1473652800 \
        DEF:wander=/opt/home/ntp/localhost.rrd:wander:LAST \
        LINE1:wander#0000FF:"wander" \
        GPRINT:wander:LAST:%le

rrdtool graph \
    --imgformat PNG /opt/home/public/localhost-ntp-freq.png \
    --width 600 --height 200 \
    --alt-autoscale \
        --vertical-label "localhost" \
        --title "`TZ=EST5EDT /bin/date -d 197001010000.1473552000`" \
        --start 1473552000 \
        --end 1473652800 \
        DEF:freq=/opt/home/ntp/localhost.rrd:freq:LAST \
        LINE1:freq#0000FF:"frequency (ppm)" \
        GPRINT:freq:LAST:%lf

rrdtool graph \
    --imgformat PNG /opt/home/public/localhost-ntp-disp.png \
    --width 600 --height 200 \
    --alt-autoscale \
        --vertical-label "localhost" \
        --title "`TZ=EST5EDT /bin/date -d 197001010000.1473552000`" \
        --start 1473552000 \
        --end 1473652800 \
        DEF:disp=/opt/home/ntp/localhost.rrd:disp:LAST \
        CDEF:ndisp=disp,1000,/ \
        LINE1:ndisp#0000FF:"dispersion" \
        GPRINT:ndisp:LAST:%lf
 
I followed the guide step by step, and all seems to be working. However, check my graph, is this possible? It's only been a few hours but looking at everyone else's charts, seems too good.

f86964e3ca85f5857dca7b1484b70da7.jpg


Edit: Seems that the service didn't start for some reason.... after starting it, things seem to be going "normal"


Sent from my  iPhone using Tapatalk
 
Last edited:
Hello!

I've followed the tutorial from the first page, but I'm stuck when I have to start ntp daemon:

Code:
admin@RT-N66U:/tmp/home/root# cp /jffs/configs/fstab /etc; mount -a
admin@RT-N66U:/tmp/home/root# /opt/etc/init.d/S77ntpd-custom start
Starting ntpd...              failed.
admin@RT-N66U:/tmp/home/root# /opt/etc/init.d/S77ntpd-custom start
Starting ntpd...              failed.
admin@RT-N66U:/tmp/home/root# /jffs/bin/ntpstats.sh
/jffs/bin/ntpq: read: Connection refused618x248
618x248
618x248
618x248
618x248
admin@RT-N66U:/tmp/home/root#

Any help would be appreciated!

Thanks!
 
Hello!

I've followed the tutorial from the first page, but I'm stuck when I have to start ntp daemon:

Code:
admin@RT-N66U:/tmp/home/root# cp /jffs/configs/fstab /etc; mount -a
admin@RT-N66U:/tmp/home/root# /opt/etc/init.d/S77ntpd-custom start
Starting ntpd...              failed.
admin@RT-N66U:/tmp/home/root# /opt/etc/init.d/S77ntpd-custom start
Starting ntpd...              failed.
admin@RT-N66U:/tmp/home/root# /jffs/bin/ntpstats.sh
/jffs/bin/ntpq: read: Connection refused618x248
618x248
618x248
618x248
618x248
admin@RT-N66U:/tmp/home/root#

Any help would be appreciated!

Thanks!

Hi, for the start failure, what errors did you see in syslog? If no error messages logged, you can increase debug verbosity by adding additional arg "-d 2" to ARGS="".

Increase the integer to see more errors..

The second error is expected since ntpd died.
 
Hi, for the start failure, what errors did you see in syslog? If no error messages logged, you can increase debug verbosity by adding additional arg "-d 2" to ARGS="".

Increase the integer to see more errors..

The second error is expected since ntpd died.

Hi,

In syslog I see:
Code:
Sep 19 14:01:41 ntpd[12087]: ntpd 4.2.8p4@1.3265 Fri Jan  1 10:34:19 UTC 2016 (8): Starting
Sep 19 14:01:41 ntpd[12087]: Command line: ntpd -c /jffs/etc/ntp.conf
Sep 19 14:01:41 ntpd[12088]: systime.c:109: INSIST(sys_fuzz >= 0) failed
Sep 19 14:01:41 ntpd[12088]: exiting (due to assertion failure)
Sep 19 14:01:52 admin: Failed to start ntpd from .
Sep 19 14:02:02 ntpd[12147]: ntpd 4.2.8p4@1.3265 Fri Jan  1 10:34:19 UTC 2016 (8): Starting
Sep 19 14:02:02 ntpd[12147]: Command line: ntpd -c /jffs/etc/ntp.conf
Sep 19 14:02:02 ntpd[12148]: systime.c:109: INSIST(sys_fuzz >= 0) failed
Sep 19 14:02:02 ntpd[12148]: exiting (due to assertion failure)
Sep 19 14:02:02 admin: Failed to start ntpd from .
 
Hi,

In syslog I see:
Code:
Sep 19 14:01:41 ntpd[12087]: ntpd 4.2.8p4@1.3265 Fri Jan  1 10:34:19 UTC 2016 (8): Starting
Sep 19 14:01:41 ntpd[12087]: Command line: ntpd -c /jffs/etc/ntp.conf
Sep 19 14:01:41 ntpd[12088]: systime.c:109: INSIST(sys_fuzz >= 0) failed
Sep 19 14:01:41 ntpd[12088]: exiting (due to assertion failure)
Sep 19 14:01:52 admin: Failed to start ntpd from .
Sep 19 14:02:02 ntpd[12147]: ntpd 4.2.8p4@1.3265 Fri Jan  1 10:34:19 UTC 2016 (8): Starting
Sep 19 14:02:02 ntpd[12147]: Command line: ntpd -c /jffs/etc/ntp.conf
Sep 19 14:02:02 ntpd[12148]: systime.c:109: INSIST(sys_fuzz >= 0) failed
Sep 19 14:02:02 ntpd[12148]: exiting (due to assertion failure)
Sep 19 14:02:02 admin: Failed to start ntpd from .

Hmm...i've seen this error before. Can't recall the fix on top of my head. I think we might have discussed int his thread. Did you find anything? I'll try to look for the fix...and update you later.
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top