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!

@Jack Yaz



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
I wonder if this is significant because it appears to copy the ntp.conf from jffs to entware repo before entware ntp starts. Also it looks like it is stalling entware ntp from starting until routers is finished. Could this be for when the ntp.conf gets edited?.
 
Old out dated guide

Thanks @SomeWhereOverTheRainBow , @dave14305 it does ring a bell that I played around with that aeons ago ...

I think I must have reverted an old version of /jffs/scripts at some point and it’s just been sitting there waiting to blow up @Jack Yaz ’s ntpMerlin for me! :)

Hopefully I’m a bit better at keeping track of what I’ve done and documenting things nowadays, but ...
 
Looking for help my NTP just keep failing to start on reboot

May 5 06:10:17 ntpMerlin: NTP failed to sync after 5 minutes. Please resolve!
May 5 06:10:20 S61unbound: NTP failed to sync after 5 minutes - please check immediately!
May 5 06:10:20 S77ntpd: Waiting for NTP to sync before starting...
May 5 06:10:24 Skynet: [*] NTP Failed To Start After 5 Minutes - Please Fix Immediately!
 
Looking for help my NTP just keep failing to start on reboot

May 5 06:10:17 ntpMerlin: NTP failed to sync after 5 minutes. Please resolve!
May 5 06:10:20 S61unbound: NTP failed to sync after 5 minutes - please check immediately!
May 5 06:10:20 S77ntpd: Waiting for NTP to sync before starting...
May 5 06:10:24 Skynet: [*] NTP Failed To Start After 5 Minutes - Please Fix Immediately!
Maybe adding an NTP server by IP to ntpmerlin's ntp.conf would allow NTP to begin synchronizing while DNS is in the process of starting. If you nslookup time.cloudflare.com, perhaps it will return a close server.
 
Maybe adding an NTP server by IP to ntpmerlin's ntp.conf would allow NTP to begin synchronizing while DNS is in the process of starting. If you nslookup time.cloudflare.com, perhaps it will return a close server.
This wouldn't help. The built in ntp failed to sync, so ntpMerlin and thus entware ntpd were not launched
 
Looking for help my NTP just keep failing to start on reboot

May 5 06:10:17 ntpMerlin: NTP failed to sync after 5 minutes. Please resolve!
May 5 06:10:20 S61unbound: NTP failed to sync after 5 minutes - please check immediately!
May 5 06:10:20 S77ntpd: Waiting for NTP to sync before starting...
May 5 06:10:24 Skynet: [*] NTP Failed To Start After 5 Minutes - Please Fix Immediately!
I used to see weird stuff like this when I had too many things going on in /jffs/scripts/service-event because it blocks the original event from completing. More syslog messages would be good to see. I remember you posted them before, but a fresh look might be good.
 
Last edited:
I used to see weird stuff like this when I had too many things going on in /jffs/scripts/service-event because it blocks the original event from completing. More syslog messages would be good to see. I remember you posted them before, but a fresh look might be good.

Morning

If I have diversion instilled NTP stops working

diversion instilled log - https://1drv.ms/t/s!ApZr4PK0Md8XtgxEcps8Qix-RH0M

diversion not instilled - https://1drv.ms/t/s!ApZr4PK0Md8Xtg3_wyT6Uk_vNVR8

So is it coming from entware

Service-event
Code:
#!/bin/sh

if [ "$1" = "start" ] && [ "$2" = "SkynetStats" ]; then sh /jffs/scripts/firewall debug genstats; fi # Skynet
/jffs/scripts/ntpmerlin service_event "$1" "$2" & # ntpMerlin
/jffs/addons/unbound/unbound_stats.sh generate "$1" "$2" & # Unbound_Stats.sh

Services-start
Code:
#!/bin/sh
/jffs/scripts/ntpmerlin startup & # ntpMerlin
cru a root_servers  "12 4 * * * curl -o \/opt\/var\/lib\/unbound\/root\.hints https://www.internic.net/domain/named.cache"    # unbound_manager

Post-mount
Code:
#!/bin/sh
swapon /tmp/mnt/network/myswap.swp # Skynet

. /jffs/addons/diversion/mount-entware.div # Added by Diversion
/jffs/addons/unbound/unbound_stats.sh startup # Unbound_Stats.sh

Nat-start
Code:
#!/bin/sh

/jffs/scripts/ntpmerlin ntpredirect # ntpMerlin

S77ntpd
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
 
Last edited:
Last edited:
Morning

If I have diversion instilled NTP stops working

diversion instilled log - https://1drv.ms/t/s!ApZr4PK0Md8XtgxEcps8Qix-RH0M

diversion not instilled - https://1drv.ms/t/s!ApZr4PK0Md8Xtg3_wyT6Uk_vNVR8

So is it coming from entware

Service-event
Code:
#!/bin/sh

if [ "$1" = "start" ] && [ "$2" = "SkynetStats" ]; then sh /jffs/scripts/firewall debug genstats; fi # Skynet
/jffs/scripts/ntpmerlin service_event "$1" "$2" & # ntpMerlin
/jffs/addons/unbound/unbound_stats.sh generate "$1" "$2" & # Unbound_Stats.sh

Services-start
Code:
#!/bin/sh
/jffs/scripts/ntpmerlin startup & # ntpMerlin
cru a root_servers  "12 4 * * * curl -o \/opt\/var\/lib\/unbound\/root\.hints https://www.internic.net/domain/named.cache"    # unbound_manager

Post-mount
Code:
#!/bin/sh
swapon /tmp/mnt/network/myswap.swp # Skynet

. /jffs/addons/diversion/mount-entware.div # Added by Diversion
/jffs/addons/unbound/unbound_stats.sh startup # Unbound_Stats.sh

Nat-start
Code:
#!/bin/sh

/jffs/scripts/ntpmerlin ntpredirect # ntpMerlin

S77ntpd
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
There's no "NTP failed to sync" in either of your syslog outputs.
 
Can you post your post-mount unmount and nat-start scripts and /opt/etc/init.d/s77ntpd. Suggest you install scribe it willmake for easier reading of logs

Please post unmount as well as well as dnsmasq.conf.add
I would uninstall ntpmerlin - and enable NTP server from GUI administration menu using valid IP addresses for NTP server primary and secondary. Reboot and see if NTP server starts OK. If that works then retry installing NTPmerlin from amtm.
 
Last edited:
There's no "NTP failed to sync" in either of your syslog outputs.

May 5 06:06:28 Skynet: [*] Waiting For NTP To Sync

With Diversion installed - its continually waiting for NTP to sync and date remains at May 5th.
 
May 5 06:06:28 Skynet: [*] Waiting For NTP To Sync

With Diversion installed - its continually waiting for NTP to sync and date remains at May 5th.
What I mean is, the 5 minute failure condition isn't being met. The last reboot, the router has only been up for 2m30, which may not be long enough for NTP to sync

EDIT: syslog-1 doesn't even seem to contain a reboot!
 

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!

Staff online

Top