What's new

ntpMerlin ntpMerlin - 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!

Mine went down after a reboot again.
View attachment 23450
It stayed down until I went inside ntpmerlin and told it to restart ntpd from within ntpmerlin. I have no logs to indicate where it went down at, all the logs show that ntpmerlin was functioning as it should.

I've only "dabbled" a couple of times with ntpMerlin (and then uninstalled and run away) on my RT-AC86U but I could never get it to start up properly after a reboot - I always had to go in and do a Restart of ntpMerlin via AMTM, and after that it works fine until the next reboot.

Never had the spare time to start to troubleshoot it, but interested that it's not just me who has seen this. Looks like it's some kind of timing issue?

@Jack Yaz if I get a decent block of time to reinstall and fiddle with the router during these WFH times, what would you need to try and diagnose the issue?

Anyone else got any ideas?
 
I've only "dabbled" a couple of times with ntpMerlin (and then uninstalled and run away) on my RT-AC86U but I could never get it to start up properly after a reboot - I always had to go in and do a Restart of ntpMerlin via AMTM, and after that it works fine until the next reboot.

Never had the spare time to start to troubleshoot it, but interested that it's not just me who has seen this. Looks like it's some kind of timing issue?

@Jack Yaz if I get a decent block of time to reinstall and fiddle with the router during these WFH times, what would you need to try and diagnose the issue?

Anyone else got any ideas?
I'm fairly confident everything should behave after a reboot now, no fiddling required!
 
I'm fairly confident everything should behave after a reboot now, no fiddling required!

Thanks @Jack Yaz, in that case I’ll give it another crack when I next get a decent block of time to play (when no one will yell at me for taking down the internet again) and report back ... o_O
 
My little network is quiet and running along smoothly. Life is good.

Jack is definitely one of the gifted of our time, but I guarantee you most of it just boils down to plain old hard work, coding, patience, and persistence.
And I bet it doesn't even pay much, if anything, especially what he does here. We are fortunate to benefit from and enjoy the fruits of his and others sweat and hard labor.
Thanks a bunch,
jts
 
My little network is quiet and running along smoothly. Life is good.

Jack is definitely one of the gifted of our time, but I guarantee you most of it just boils down to plain old hard work, coding, patience, and persistence.
And I bet it doesn't even pay much, if anything, especially what he does here. We are fortunate to benefit from and enjoy the fruits of his and others sweat and hard labor.
Thanks a bunch,
jts
I agree, the developers on the numerous Merlin scripts (as well as Merlin) are a gifted bunch and do it for next to nothing (small "coffee/beer" donations). I know I am grateful that they all agree to share their awesome scripts with the world!
 
My little network is quiet and running along smoothly. Life is good.

Jack is definitely one of the gifted of our time, but I guarantee you most of it just boils down to plain old hard work, coding, patience, and persistence.
And I bet it doesn't even pay much, if anything, especially what he does here. We are fortunate to benefit from and enjoy the fruits of his and others sweat and hard labor.
Thanks a bunch,
jts
I agree, the developers on the numerous Merlin scripts (as well as Merlin) are a gifted bunch and do it for next to nothing (small "coffee/beer" donations). I know I am grateful that they all agree to share their awesome scripts with the world!
It makes me very happy to see what is effectively a hobby for me, bring benefit and usefulness to others :D
 
I'm fairly confident everything should behave after a reboot now, no fiddling required!

Sorry to disappoint you @Jack Yaz , but this one has still got me scratching my head :(

Had a window of a couple of hours yesterday I could fiddle so as promised I reinstalled (latest) ntpMerlin, rebooted a couple of times and hoped ... in vain.
For me at least it doesn't ever seem to run after a reboot, but does its thing perfectly if I wait for the router to settle and then do a Restart from AMTM.
I do seem to get "kernel reports TIME_ERROR: 0x41: Clock Unsynchronized" messages after every ntpMerlin restart, but it seems to work anyway.
Graphs are "flat lines" after the reboot but then look plausible after the first manual restart after reboot.

I'm on an RT-AC86U, Merlin 384.17, and also currently run Diversion/uiDivStats, Skynet, FreshJR_QoS, Scribe/uiScribe, connmon, scMerlin, all up to date.

Pastebin links to (system) messages.log ntp.logs and ntp.conf, which is vanilla except for pointing to au.pool.ntp.org servers.

messages.log - https://pastebin.com/HSA8tPV1
ntp.log - https://pastebin.com/44LLALji
ntp.conf - https://pastebin.com/Mw4YmSRa

Latest reboot showing the issue is at around (May 17) 14:08, and then my manual restart of ntpMerlin at around 14:39.

If you had time to have a look and make some suggestions that would be much appreciated.
 
Sorry to disappoint you @Jack Yaz , but this one has still got me scratching my head :(

Had a window of a couple of hours yesterday I could fiddle so as promised I reinstalled (latest) ntpMerlin, rebooted a couple of times and hoped ... in vain.
For me at least it doesn't ever seem to run after a reboot, but does its thing perfectly if I wait for the router to settle and then do a Restart from AMTM.
I do seem to get "kernel reports TIME_ERROR: 0x41: Clock Unsynchronized" messages after every ntpMerlin restart, but it seems to work anyway.
Graphs are "flat lines" after the reboot but then look plausible after the first manual restart after reboot.

I'm on an RT-AC86U, Merlin 384.17, and also currently run Diversion/uiDivStats, Skynet, FreshJR_QoS, Scribe/uiScribe, connmon, scMerlin, all up to date.

Pastebin links to (system) messages.log ntp.logs and ntp.conf, which is vanilla except for pointing to au.pool.ntp.org servers.

messages.log - https://pastebin.com/HSA8tPV1
ntp.log - https://pastebin.com/44LLALji
ntp.conf - https://pastebin.com/Mw4YmSRa

Latest reboot showing the issue is at around (May 17) 14:08, and then my manual restart of ntpMerlin at around 14:39.

If you had time to have a look and make some suggestions that would be much appreciated.
Hm. What does the ntpq command and ps command return? (i posted these s few posts ago. If you can't find them I'll check the syntax - on phone atm)
 
Oh, and it would be useful to also see
Code:
/opt/etc/init.d/rc.unslung check

And what are you doing in post-mount here?
Code:
May 17 14:08:17 (post-mount): 2570 ***SUCCESS Router copied ntp.conf-file to /etc!
 
@Jack Yaz , output as requested after a reboot (I assumed).

Code:
admin@AsusRouter:/tmp/home/root# ps | grep ntp
 2200 admin     3364 S    /usr/sbin/ntp -t -S /sbin/ntpd_synced -p 162.159.200.1 -p 162.159.200.123
 2564 admin     3364 S    ntpd -l
admin@AsusRouter:/tmp/home/root# ntpq -4 -c rv
localhost.localdomain: timed out, nothing received
***Request timed out
admin@AsusRouter:/tmp/home/root# /opt/etc/init.d/rc.unslung check
 Checking syslog-ng...              alive.
 Checking ntpd...              alive.
 Checking pixelserv-tls (Diversion)...  alive

And what are you doing in post-mount here?
Code:
May 17 14:08:17 (post-mount): 2570 ***SUCCESS Router copied ntp.conf-file to /etc!

Nothing that I changed/added that I know of or remember? I thought that would be YOU doing that? :)

Edit: Looked in post-mount, looks like it may be code added by AMTM maybe?

Code:
#!/bin/sh
swapon /tmp/mnt/SSD250GB/myswap.swp # Swap file created by amtm

if [ "$(nvram get ntp_ready)" == "1" ];
then  # Only start the NTP server if router has itself synchronised with Internet
   cp /jffs/ntp/ntp.conf /etc/
   logger -st "($(basename $0))" $$ "***SUCCESS Router copied ntp.conf-file to /etc!"
   ntpd   -l
   logger -st "($(basename $0))" $$ "***SUCCESS Router initialized NTP Server!"
else
   logger -st "($(basename $0))" $$ "***ERROR Router cannot get initialise NTP Server!"
fi



FN="/opt/share/unbound/configs/cache.txt"; [ -s $FN ] && { unbound-control load_cache < $FN; rm $FN; logger -st "($(basename $0))" "unbound cache RESTORED from '$FN'"; } # unbound_manager
/jffs/addons/unbound/unbound_stats.sh startup # Unbound_Stats.sh

. /jffs/addons/diversion/mount-entware.div # Added by Diversion
cru a logrotate "5 0 * * * /opt/sbin/logrotate /opt/etc/logrotate.conf >> /opt/tmp/logrotate.daily 2>&1" # added by scribe

Interesting there still seems to be Unbound bits in there considering I uninstalled it?
Is that relevant?
 
Last edited:
@Jack Yaz , output as requested after a reboot (I assumed).

Code:
admin@AsusRouter:/tmp/home/root# ps | grep ntp
 2200 admin     3364 S    /usr/sbin/ntp -t -S /sbin/ntpd_synced -p 162.159.200.1 -p 162.159.200.123
 2564 admin     3364 S    ntpd -l
admin@AsusRouter:/tmp/home/root# ntpq -4 -c rv
localhost.localdomain: timed out, nothing received
***Request timed out
admin@AsusRouter:/tmp/home/root# /opt/etc/init.d/rc.unslung check
 Checking syslog-ng...              alive.
 Checking ntpd...              alive.
 Checking pixelserv-tls (Diversion)...  alive



Nothing that I changed/added that I know of or remember? I thought that would be YOU doing that? :)
It does look like the built in ntp is running. Hm. Can you check what settings are in Administration - > System please?

Not me in post-mount!

Can you also check the contents of S77ntpd - it's meant to kill ntp and ntpd when it starts
 
It does look like the built in ntp is running. Hm. Can you check what settings are in Administration - > System please?

Not me in post-mount!

Can you also check the contents of S77ntpd - it's meant to kill ntp and ntpd when it starts

Not sure what put that in post-mount then ... or when, maybe something yonks ago? :)

NTP is definitely turned OFF in Administration/System

Where do I find S77ntpd?
 
@Jack Yaz

Not me in post-mount!

I just commented out those lines in post-mount and did another Reboot and now I get ...

Code:
admin@AsusRouter:/tmp/home/root# ps | grep ntp
 2716 admin    73152 S    ntpd -c /opt/share/ntpmerlin.d/ntp.conf -g
14558 admin     5432 S    grep ntp
admin@AsusRouter:/tmp/home/root# ntpq -4 -c rv
associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync,
version="ntpd 4.2.8p13@1.3847-o Mon Mar 23 13:21:49 UTC 2020 (1)",
processor="aarch64", system="Linux/4.1.27", leap=00, stratum=3,
precision=-22, rootdelay=184.470, rootdisp=74.723, refid=129.250.35.250,
reftime=e26b658c.669c267c  Sun, May 17 2020 17:26:04.400,
clock=e26b65c6.8d5693f9  Sun, May 17 2020 17:27:02.552, peer=9615, tc=6,
mintc=3, offset=3.396740, frequency=-2.624, sys_jitter=1.133134,
clk_jitter=2.668, clk_wander=0.000
admin@AsusRouter:/tmp/home/root# /opt/etc/init.d/rc.unslung check
 Checking syslog-ng...              alive.
 Checking ntpd...              alive.
 Checking pixelserv-tls (Diversion)...  alive

So I think that may have fixed it maybe?

Now all I have to figure out is why that other code was in there? :)
Probably something I added long ago from a post here on SNB and forgot about?
 
Last edited:
@Jack Yaz

What was in post mount?

The bits I commented out were:-

Code:
#if [ "$(nvram get ntp_ready)" == "1" ];
#then  # Only start the NTP server if router has itself synchronised with Internet
#   cp /jffs/ntp/ntp.conf /etc/
#   logger -st "($(basename $0))" $$ "***SUCCESS Router copied ntp.conf-file to /etc!"
#   ntpd   -l
#   logger -st "($(basename $0))" $$ "***SUCCESS Router initialized NTP Server!"
#else
#   logger -st "($(basename $0))" $$ "***ERROR Router cannot get initialise NTP Server!"
#fi
 
Last edited:
@Jack Yaz

Can you also check the contents of S77ntpd - it's meant to kill ntp and ntpd when it starts

Contents:-

Code:
#!/bin/sh

# shellcheck disable=SC2034

if [ "$1" = "start" ] || [ "$1" = "restart" ]; then
        # Wait for NTP before starting
        logger -st "S77ntpd" "Waiting for NTP to sync before starting..."
        ntptimer=0
        while [ "$(nvram get ntp_ready)" = "0" ] && [ "$ntptimer" -lt "300" ]; do
                ntptimer=$((ntptimer+1))
                sleep 1
        done

        if [ "$ntptimer" -ge "300" ]; then
                logger -st "S77ntpd" "NTP failed to sync after 5 minutes - please check immediately!"
                exit 1
        fi
fi

if [ -f "/opt/share/ntpmerlin.d/config" ]; then
        SCRIPT_STORAGE_DIR="/opt/share/ntpmerlin.d"
else
        SCRIPT_STORAGE_DIR="/jffs/addons/ntpmerlin.d"
fi

ENABLED=yes
PROCS=ntpd
ARGS="-c $SCRIPT_STORAGE_DIR/ntp.conf -g"
PREARGS=""
PRECMD="killall ntp && killall ntpd"
POSTCMD=""
DESC=$PROCS
PATH=/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

. /opt/etc/init.d/rc.func
 
I just commented out those lines in post-mount and did another Reboot and now I get ...

Code:
admin@AsusRouter:/tmp/home/root# ps | grep ntp
 2716 admin    73152 S    ntpd -c /opt/share/ntpmerlin.d/ntp.conf -g
14558 admin     5432 S    grep ntp
admin@AsusRouter:/tmp/home/root# ntpq -4 -c rv
associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync,
version="ntpd 4.2.8p13@1.3847-o Mon Mar 23 13:21:49 UTC 2020 (1)",
processor="aarch64", system="Linux/4.1.27", leap=00, stratum=3,
precision=-22, rootdelay=184.470, rootdisp=74.723, refid=129.250.35.250,
reftime=e26b658c.669c267c  Sun, May 17 2020 17:26:04.400,
clock=e26b65c6.8d5693f9  Sun, May 17 2020 17:27:02.552, peer=9615, tc=6,
mintc=3, offset=3.396740, frequency=-2.624, sys_jitter=1.133134,
clk_jitter=2.668, clk_wander=0.000
admin@AsusRouter:/tmp/home/root# /opt/etc/init.d/rc.unslung check
 Checking syslog-ng...              alive.
 Checking ntpd...              alive.
 Checking pixelserv-tls (Diversion)...  alive

So I think that may have fixed it maybe?

Now all I have to figure out is why that other code was in there? :)
Probably something I added long ago from a post here on SNB and forgot about?
Looks like that code was invoking the built in ntpd, so was probably tripping over the entware version from ntpMerlin. I don't specifically recognise that code but it's not needed with ntpmerlin :)
 
@Jack Yaz

Looks like that code was invoking the built in ntpd, so was probably tripping over the entware version from ntpMerlin. I don't specifically recognise that code but it's not needed with ntpmerlin :)

Well whatever it was it doesn't seem to be needed for my current setup, I've done another Reboot and ntpMerlin is definitely purring along ...

Thanks for your help, I'll try and unravel the "mystery code" but pretty sure it came from SNB somewhere ... and no doubt I had good reason at the time to add it. I've changed internet suppliers a couple of times so it may have been for a past config.

So I gather the ntp.log "kernel reports TIME_ERROR: 0x41: Clock Unsynchronized" messages are "expected"?
Is that just the router complaining the built-in ntp is dead?
 
Well whatever it was it doesn't seem to be needed for my current setup, I've done another Reboot and ntpMerlin is definitely purring along ...

Thanks for your help, I'll try and unravel the "mystery code" but pretty sure it came from SNB somewhere ... and no doubt I had good reason at the time to add it. I've changed internet suppliers a couple of times so it may have been for a past config.
No worries!


So I gather the ntp.log "kernel reports TIME_ERROR: 0x41: Clock Unsynchronized" messages are "expected"?
Is that just the router complaining the built-in ntp is dead?
I'll have to defer to google on this point!
https://www.linuxquestions.org/ques...-clock-unsynchronized-4175636606/#post5892946

Code:
ntptime
returns "OK" for me, so I think it's just a startup message
 
returns "OK" for me, so I think it's just a startup message

Likewise, so I think we are all good, graphs behaving normally ... mystery solved! :)
 

Similar threads

Latest threads

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