View previous topic :: View next topic |
Author |
Message |
tld Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 09 Dec 2003 Posts: 1816
|
Posted: Tue Apr 01, 2014 4:02 pm Post subject: ntp-client sntp randomly fails? |
|
|
EDIT: I've changed the subject of this thread because of my findings (in my reply below).
I've been going crazy trying to get the ntp-client service working reliably on my MythTV frontend machine.
I use my MythTV backend server as a master ntp server and sync other machines, including the above frontend, to it.
I recently discovered that without realizing it, my /etc/conf.d/ntp-client, unlike my ntp.conf setup, was using the default settings (pointed to 0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org etc). The reason I was looking into any of this in the first was because I periodically had that part of the boot process hang for a VERY long time...I'll get into that later.
Here's what's in my current /etc/conf.d/ntp-client:
Code: |
NTPCLIENT_CMD="sntp"
NTPCLIENT_OPTS="-p -t 5 -s mythback" |
When rebooting today, that failed. I shelled into the machine and tried to start it, and had it fail twice:
Code: | mythfront ~ # /etc/init.d/ntp-client start
* Setting clock via the NTP client 'sntp' ...
1 Apr 11:26:52 sntp[1308]: Started sntp
* Failed to set clock [ !! ]
* ERROR: ntp-client failed to start
mythfront ~ # /etc/init.d/ntp-client start
* Setting clock via the NTP client 'sntp' ...
1 Apr 11:27:05 sntp[1320]: Started sntp
* Failed to set clock [ !! ]
* ERROR: ntp-client failed to start
|
However I manually ran the same sntp command being run by the service and that worked:
Code: | mythfront ~ # sntp -p -t 5 -s mythback
1 Apr 11:28:58 sntp[1370]: Started sntp
2014-04-01 11:28:58.128453 (+0500) +0.070404 +/- 0.954361 secs |
After that, it started with no problem, and I can't even make it fail if I wanted to:
Code: | mythfront ~ # /etc/init.d/ntp-client start
* Setting clock via the NTP client 'sntp' ...
1 Apr 11:29:05 sntp[1383]: Started sntp
2014-04-01 11:29:05.040283 (+0500) +0.000012 +/- 0.954468 secs |
WTF? As far as the "-t 5" option: When pointed to the gentoo ntp servers I periodically had issues where the boot would hang on that step. That got me looking into what sntp might have as far as timeout options. That led me to this all but indiscernible mess:
http://bugs.ntp.org/show_bug.cgi?id=2233
According to that, apparently recent versions of sntp have a -g option for overall wait timeout. However the current version has only -t which is number of seconds to wait for broadcasts. What I discovered is that the person who logged that bug was correct in that it actually takes five times the "-t" value for an actual timeout. Also, it turns out the default -t value is 68 seconds, meaning it can hand for up to 5:40!...I was able to prove that out by attempting to sync to an invalid ip...I mean seriously(??).
Anyway...if anyone has any ideas as to those failures I'd love to hear it.
Tom
Last edited by tld on Fri Jul 25, 2014 12:57 pm; edited 3 times in total |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
tld Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 09 Dec 2003 Posts: 1816
|
Posted: Tue Jul 15, 2014 3:10 pm Post subject: |
|
|
Wow...I figured out the issue with that ntp-client service, though I was pretty surprise at what I found:
During the boot process the sntp program is apparently failing to resolve the name mythback, which is in my /etc/hosts file. As you can see above, after the system's up, it works.
I've changed to the title of the thread accordingly. Any ideas what would cause that?
Tom |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Tony0945 Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
Joined: 25 Jul 2006 Posts: 5127 Location: Illinois, USA
|
Posted: Tue Jul 15, 2014 11:21 pm Post subject: |
|
|
I'm guessing that it's got to do with the order that services start at boot.
Just wanted to post to encourage you to continue. I'm very interested in this, but very much the noob. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
freke l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
Joined: 23 Jan 2003 Posts: 977 Location: Somewhere in Denmark
|
Posted: Wed Jul 16, 2014 8:10 am Post subject: |
|
|
Have you tried editing /etc/conf.d/ntp-client to point to the ip-address instead? (ie. just to verify that it really it's because it's not using /etc/hosts - or it's because the network is not available at the time?) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
khayyam Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/9397496074fd0189143bb7.png)
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Wed Jul 16, 2014 11:50 am Post subject: |
|
|
tom ...
please try replacing 'rc_use=dns' with 'rc_need=net' in /etc/conf.d/ntp-client
If this doesn't resolve the issue, could you post /etc/hosts and the ntp-client config
HTH & best ... khay |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
tld Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 09 Dec 2003 Posts: 1816
|
Posted: Wed Jul 16, 2014 8:34 pm Post subject: |
|
|
Thanks for the replies! In answer to all the various questions, I have to back-pedal on my previous post:
I thought this was related to the hosts file etc, because it worked when I changed my /etc/conf.d/ntp-client to use the ip and rebooted:
Code: | cat ntp-client
# /etc/conf.d/ntp-client
# Command to run to set the clock initially
# Most people should just leave this line alone ...
# however, if you know what you're doing, and you
# want to use ntpd to set the clock, change this to 'ntpd'
#NTPCLIENT_CMD="ntpdate"
NTPCLIENT_CMD="sntp"
# Options to pass to the above command
# This default setting should work fine but you should
# change the default 'pool.ntp.org' to something closer
# to your machine. See http://www.pool.ntp.org/ or
# try running `netselect -s 3 pool.ntp.org`.
#NTPCLIENT_OPTS="-s -b -u \
# 0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org \
# 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"
#NTPCLIENT_OPTS="-p -s \
# 0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org \
# 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"
# NOTE: Based on the double talk here:
# http://bugs.ntp.org/show_bug.cgi?id=2233
# There's supposed to be a wait timeout in some version (-g?) but for now, it appears to
# wait for 5 times the -t timeout, which means a default of 5:40!...so I'm usig -t 5.
#NTPCLIENT_OPTS="-p -t 5 -s mythback"
NTPCLIENT_OPTS="-p -t 5 -s 192.168.1.51"
|
...and that did in fact work after I made that change. However I rebooted earlier today after installing a new kernel, and it failed again, so the behavior is clearly random. This is from my /etc/var/rc.log:
Code: | * Setting clock via the NTP client 'sntp' ...
16 Jul 09:44:22 sntp[1008]: Started sntp
* Failed to set clock
[ !! ]
|
Again, that exact command works manually every time with either the ip or name:
Code: | mythfront ~ # sntp -p -t 5 -s 192.168.1.51
16 Jul 16:28:16 sntp[2317]: Started sntp
2014-07-16 16:28:16.817586 (+0500) +0.000371 +/- 0.036148 secs
mythfront ~ # sntp -p -t 5 -s mythback
16 Jul 16:28:29 sntp[2318]: Started sntp
2014-07-16 16:28:29.188293 (+0500) +0.000018 +/- 0.036331 secs
|
Both of those result in a status ($?) of 0.
I have to say that, in many ways, that sntp replacement for ntpdate has been a complete mess. Aside from whatever is going on here, I've found it to be poorly or even incorrectly documented...just a mess from the word go frankly.
Tom |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
tld Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 09 Dec 2003 Posts: 1816
|
Posted: Wed Jul 16, 2014 8:58 pm Post subject: |
|
|
Yea...just had a chance to reboot it again, with absolutely nothing different since this mornings reboot when it failed and this time it worked. Like I said, it seems totally random when run from the service, and works without fail manually. Craziness.
Code: | * Setting clock via the NTP client 'sntp' ...
16 Jul 16:49:22 sntp[1009]: Started sntp
2014-07-16 16:49:24.694737 (+0500) +1.061825 +/- 0.055161 secs
[ ok ]
|
EDIT: Also, I know for a fact that the network is working at that point because I have NFS mounts (on the same machine!...mythback) that mount flawlessly before that.
Tom |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|