What's new
  • 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!

Both Chrony and NTP at the same time?

How to check this?

Reason for asking: I noticed I also have both S77ntpd and S77chronyd in /opt/etc/init.d and might have the same issue as you?
Run the following command in an SSH window:
Bash:
top -b -n 1 | grep -E "ntpd|chronyd|timeserverd" | grep -v grep

If you do have both running, I suggest you install the latest 'develop' branch version (see post #12).
Bash:
ntpmerlin develop
 
Thanks @Martinski. I do suspect it was somehow installed by the recent Entware update.
...

Curious if this started happening with the latest Entware update, that’s about the timeframe it did for me, ...

Reason for asking: I noticed I also have both S77ntpd and S77chronyd in /opt/etc/init.d and might have the same issue as you?

I've made changes in the script to double-check that the selected NTP service script that's installed by ntpMerlin (for ntpd or chronyd) has not been overwritten or modified (e.g. via Entware package updates). If the service script doesn't match as expected, the code will re-download the ntpMerlin-specific script, replace the existing version, and restart the time server. It will also remove the additional time server script (if found).

These checks are performed at startup following a reboot, every time the NTP server is started or restarted, and every 10 minutes via the pre-existing cron job that generates time server stats.

The latest 'develop' branch version tag is v3.4.10_25073100.
Example:
ntpMerlin_Develop_v3.4.10_CLI_VersTag.jpg


One behavior i have notice when running ntpmerlin is that it still leaves the entware packages installed even when just switching between the two. This creates a bad behavior when users go to update and upgrade their entware repositories, it automatically reinstalls the init.d scripts for the unused ntp service because the package is still technically listed as one of entwares installed packages. So lets say we are using chronyd, but ntpd is still listed as an installed entware package even though we are not using it with ntpmerlin. Entware will recreate the init.d script upon upgrading entware repository of installed packages.
....
Thanks for the tips, but I think the simplest solution would be to double-check the existing Entware service scripts and replace or remove as needed (see above). At worst, there's a 10-minute gap between checks during which the wrong service scripts may exist simultaneously; however, the situation will be corrected automatically, and most users won't even notice. ;)
 
Last edited:

I've made changes in the script to double-check that the selected NTP service script that's installed by ntpMerlin (for ntpd or chronyd) has not been overwritten or modified (e.g. via Entware package updates). If the service script doesn't match as expected, the code will re-download the ntpMerlin-specific script, replace the existing version, and restart the time server. It will also remove the additional time server script (if found).

These checks are performed at startup following a reboot, every time the NTP server is started or restarted, and every 10 minutes via the pre-existing cron job that generates time server stats.

The latest 'develop' branch version tag is v3.4.10_25073100.
Example:
View attachment 67025


Thanks for the tips, but I think the simplest solution would be to double-check the existing Entware service scripts and replace or remove as needed (see above). At worst, there's a 10-minute gap between checks during which the wrong service scripts may exist simultaneously; however, the situation will be corrected automatically, and most users won't even notice. ;)
That is great for people who run ntpMerlin, but what about when they uninstall ntpMerlin. Surely you have a cleanup to remove the unused binary.
 
Run the following command in an SSH window:
Bash:
top -b -n 1 | grep -E "ntpd|chronyd|timeserverd" | grep -v grep
Looks like I am good?
Code:
➜ top -b -n 1 | grep -E "ntpd|chronyd|timeserverd" | grep -v grep
23059     1 nobody   S    79884  7.8   2  0.0 chronyd -r -u nobody -f /opt/share/ntpmerlin.d/chrony.conf
23032     1 me       S     3324  0.3   2  0.0 {timeserverd} /bin/sh /opt/bin/timeserverd S77chronyd
 
However, I don’t understand why this doesn’t start ntpd:
Code:
➜ cat /opt/etc/init.d/S77ntpd
#!/bin/sh

[ -f /opt/etc/config/ntpd ] && . /opt/etc/config/ntpd

ENABLED=yes
PROCS=ntpd
ARGS="-c /opt/etc/ntp.conf -p /opt/var/run/ntpd.pid -f /opt/var/spool/ntp/ntp.drift -s /opt/var/spool/ntp -k /opt/etc/ntp -g $OPTIONS"
PREARGS=""
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
 
Looks like I am good?
Code:
➜ top -b -n 1 | grep -E "ntpd|chronyd|timeserverd" | grep -v grep
23059     1 nobody   S    79884  7.8   2  0.0 chronyd -r -u nobody -f /opt/share/ntpmerlin.d/chrony.conf
23032     1 me       S     3324  0.3   2  0.0 {timeserverd} /bin/sh /opt/bin/timeserverd S77chronyd
Yep, looks good.
 
However, I don’t understand why this doesn’t start ntpd:
Code:
➜ cat /opt/etc/init.d/S77ntpd
#!/bin/sh

[ -f /opt/etc/config/ntpd ] && . /opt/etc/config/ntpd

ENABLED=yes
PROCS=ntpd
ARGS="-c /opt/etc/ntp.conf -p /opt/var/run/ntpd.pid -f /opt/var/spool/ntp/ntp.drift -s /opt/var/spool/ntp -k /opt/etc/ntp -g $OPTIONS"
PREARGS=""
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

If you reboot the router, or if you simply remove the USB-attached disk and then plug it back in, it will trigger a restart of the Entware services. If you have not done either of those actions *after* the package and associated service script were installed, in most cases, the service may just lie "dormant" unless you manually start it.

Note that if you install the latest 'develop' branch version, the code will automatically stop and remove the additional time server script at various checkpoints.
 
If you reboot the router, or if you simply remove the USB-attached disk and then plug it back in, it will trigger a restart of the Entware services.
Indeed; after the upgrade from Beta 2 to Beta 3:
Code:
➜ top -b -n 1 | grep -E "ntpd|chronyd|timeserverd" | grep -v grep
 8367     1 nobody   S    85792  8.3   0  0.0 chronyd -r -u nobody -f /opt/share/ntpmerlin.d/chrony.conf
 8353     1 me       S    76084  7.4   2  0.0 ntpd -c /opt/etc/ntp.conf -p /opt/var/run/ntpd.pid -f /opt/var/spool/ntp/ntp.drift -s /opt/var/spool/ntp -k /opt/etc/ntp -g -l /opt/var/log/ntp.log
 8299     1 me       S     3324  0.3   2  0.0 {timeserverd} /bin/sh /opt/bin/timeserverd S77chronyd

(I killed 8353 after running the command above - I do not run the develop branch version of ntpMerlin)
 
Last edited:
However, I don’t understand why this doesn’t start ntpd:
Code:
➜ cat /opt/etc/init.d/S77ntpd
#!/bin/sh

[ -f /opt/etc/config/ntpd ] && . /opt/etc/config/ntpd

ENABLED=yes
PROCS=ntpd
ARGS="-c /opt/etc/ntp.conf -p /opt/var/run/ntpd.pid -f /opt/var/spool/ntp/ntp.drift -s /opt/var/spool/ntp -k /opt/etc/ntp -g $OPTIONS"
PREARGS=""
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
On mine it looks like it actually does start ntpd but then exits because chrony is already listening on port 123
Code:
30 Jul 00:02:48 ntpd[6805]: Listen and drop on 0 v6wildcard [::]:123
30 Jul 00:02:48 ntpd[6805]: unable to bind to wildcard address 0.0.0.0 - another process may be running - EXITING
30 Jul 00:02:48 ntpd[6787]: daemon child exited with code 1
I may try the develop branch to clean this up.
UPDATE: The develop branch did indeed clean the NTP entries up :cool:
 
Last edited:

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!
Back
Top