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?

JGrana

Very Senior Member
I have been looking at what seems to be a long time for ntp_ready to go true. Seemed fine a few months ago ago.
In doing some looking around, I noticed that both /opt/etc/ntp and /opt/bin/timerserverd/chronyd.conf are running. At the same time.
I do use the Yaz/@Martinski ntpMerlin addon and have selected chronyd as the application to run.
For some reason both are running at the same time. I’m surprised.

Is this normal? Do I have some kind of configuration incorrect?
 
I have been looking at what seems to be a long time for ntp_ready to go true. Seemed fine a few months ago ago.
In doing some looking around, I noticed that both /opt/etc/ntp and /opt/bin/timerserverd/chronyd.conf are running. At the same time.
I do use the Yaz/@Martinski ntpMerlin addon and have selected chronyd as the application to run.
For some reason both are running at the same time. I’m surprised.

Is this normal? Do I have some kind of configuration incorrect?
That's very strange and completely unexpected because when using the CLI menu to toggle the time server selection between ntpd and chronyd, the code quite explicitly stops and then removes the Entware service script for the 'unselected' choice before replacing it with the newly selected time server, so I don't see how it's possible to have the 2 separate processes running at the same time unless some other script is installing and then restarting the Entware service script for the now-unselected time server.

To gather some initial diagnostics info, please download the following shell script onto the router:
Bash:
curl  -LSs --retry 3 --retry-delay 5 --retry-connrefused \
https://raw.githubusercontent.com/Martinski4GitHub/CustomMiscUtils/develop/Diags/DEBUG_ntpMerlin_INFO.sh \
-o "$HOME/DEBUG_ntpMerlin_INFO.sh" && chmod 755 "$HOME/DEBUG_ntpMerlin_INFO.sh"

Once it's downloaded, execute the script and post the output file that gets generated:
Bash:
$HOME/DEBUG_ntpMerlin_INFO.sh
 
Thanks @Martinski I also thought it odd.

I have attached the output from the script.
 
Following this, had the same thing happening for a bit. Attributed it to my AX88u meltdown. Then it kept on going as I rebuilt it. Eventually I uninstalled, reinstalled and upgraded to the latest version of the script in the process and reconfigured to use chrony and it sort of solved itself. Didn’t see anymore NTP references in the log afterwards.

Curious as to what if anything is determined/found.
 
@Martinski, Im having trouble attaching or pasting the output…
I keep getting the dreaded “Something went wrong” message.

I’ll try a few different ways
 
Different browser
Attach files
 
@Martinski, Im having trouble attaching or pasting the output…
I keep getting the dreaded “Something went wrong” message.

I’ll try a few different ways
It likely contains a forbidden word. Try this and post the link:
 
...
Let me know if there is anything else you would like me to do.
Thank you for providing the debug output file. That was very useful, and there were some very important clues. I just made a couple of quick changes to the diags shell script, so whenever you get a chance, please re-download it using the previously posted command, execute the script, and provide the resulting output file. This should provide the final piece of the puzzle.
 
I have been looking at what seems to be a long time for ntp_ready to go true. Seemed fine a few months ago ago.
In doing some looking around, I noticed that both /opt/etc/ntp and /opt/bin/timerserverd/chronyd.conf are running. At the same time.

"A man with a watch knows what time it is. A man with two watches is never sure." — Segal's Law​

 
Thank you for providing the debug output file. That was very useful, and there were some very important clues. I just made a couple of quick changes to the diags shell script, so whenever you get a chance, please re-download it using the previously posted command, execute the script, and provide the resulting output file. This should provide the final piece of the puzzle.
Thanks


Here is the new one


Good luck!
 
Thanks


Here is the new one


Good luck!
Thank you for the latest debug output file. As I suspected, the ntpd process currently running on your router was *NOT* installed by ntpMerlin. It may have been installed manually at some point, or by some other script that you have on your router. Whenever and however it got installed, it's clearly from some external source outside of ntpMerlin control.

Here are the 2 major clues from your latest debug output file:

1) The Entware service script that's launching the ntpd process on your router is *not* from ntpMerlin.

This is the script file you have in your router launching ntpd:

External_ntpd_ServiceScript.jpg


This is the script file that gets installed by ntpMerlin to launch ntpd:

ntpMerlin_ntpd_ServiceScript.jpg


2) The ntpd process running on your router is clearly not under the control of ntpMerlin.

This is the ntpd process currently running on your router:

External_ntpd_Process_WRONG.jpg


This is what it should look like when the ntpd process is running under ntpMerlin control:

ntpMerlin_ntpd_Process_OK.jpg


In short, you have a running ntpd process that was clearly *NOT* installed by ntpMerlin.

Last night, I made some changes in the ntpMerlin code to double-check and try to avoid getting into your current situation where 2 time server processes are running simultaneously. The extra checks are performed at the time the Entware service script (installed by ntpMerlin) is executed (started or restarted).

I'd suggest installing and running the very latest code by switching to the 'develop' branch version using the following command:
Bash:
ntpmerlin develop

The latest 'develop' branch version tag should be shown as "v3.4.10_25072920"
Example:
ntpMerlin_Develop_v3.4.10_CLI_VersTag.jpg


You can easily and quickly force a restart of your currently selected time server (i.e. chronyd) by choosing option 'r' from the CLI menu. This will also force a stop and removal of the externally-installed ntpd process, and you should be left with a clean time server process running.

HTH.
 
Curious if this started happening with the latest Entware update, that’s about the timeframe it did for me, but let it go when the router wiped itself and I had to redo it from scratch.

I remember getting NTPD messages in the log about it starting, failing to start or just failing. May have even posted about it or DM’d it. But not home to look it up or through the logs I have to be sure.
 
Curious if this started happening with the latest Entware update, that’s about the timeframe it did for me, ...
Yeah, that's possible. When Entware updates occur, there's always a possibility that it may overwrite and/or mess with pre-existing services. The recommended practice would be to always reboot the router after any Entware updates, and then double-check that the Entware service scripts have not been left "corrupted."

I can make some changes in the ntpMerlin code to double-check for this scenario as well.
 
Thanks @Martinski. I do suspect it was somehow installed by the recent Entware update.
I haven’t used ntpd for years. In fact, I actually compiled chrony years ago to run on my router. I worked with Jack to get it incorporated into nptMerlin (after @ryzhov_al added it to Entware).
Nothing against ntpd, by chrony runs much better.
I will run your new code now.
 
Ran the develop branch. Did the trick. No more ntpd running and no more /opt/etc/init.d/S77ntpd
Very nice - thanks!
 
One last thing. I did notice that ntpd is in my Entware package list. Maybe a recent update had a new ntpd. Which, when it updates, likely re-installs S77ntpd.

I am going to remove the ntpd package.
 
Same thing for me, but after the router meltdown. I redid the update as I reinstalled Entware after a hardware reset. But then installed ntpmerlin from scratch (v3.4.9) over it and the issue went away for me as well, just never took the extra step to remove the ntpd package or look back for the way/why it happened with all that I dealt with in putting it all together again.

Glad there's answer...
 
That's very strange and completely unexpected because when using the CLI menu to toggle the time server selection between ntpd and chronyd, the code quite explicitly stops and then removes the Entware service script for the 'unselected' choice before replacing it with the newly selected time server, so I don't see how it's possible to have the 2 separate processes running at the same time unless some other script is installing and then restarting the Entware service script for the now-unselected time server.

To gather some initial diagnostics info, please download the following shell script onto the router:
Bash:
curl  -LSs --retry 3 --retry-delay 5 --retry-connrefused \
https://raw.githubusercontent.com/Martinski4GitHub/CustomMiscUtils/develop/Diags/DEBUG_ntpMerlin_INFO.sh \
-o "$HOME/DEBUG_ntpMerlin_INFO.sh" && chmod 755 "$HOME/DEBUG_ntpMerlin_INFO.sh"

Once it's downloaded, execute the script and post the output file that gets generated:
Bash:
$HOME/DEBUG_ntpMerlin_INFO.sh
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.
@Martinski
There are a few ways to deal with this issue. The first option would just be to uninstall the package point blank period when it is no longer being used. The caveat would be that it may be difficult to retain old config files when switching between the two ntp services for users who like to test the waters between the two.

The second option would be to place both entware packages on "hold". By flagging hold on the specific package the package will not get updated whenever entwares repository updates. This would mean ntpMerlin would become solely responsible for managing the updates through entware for these two packages.

The third option would be to remove the package from the opkg list of installed config file which is a file that stores the list entware packages that are installed. This will create a different delimma because it will make it difficult to detect updates through opkg for these installed packages.
 
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