Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
NTPD with Sys5 init is not Continuously Synchronizing Time
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
RAPHEAD
Tux's lil' helper
Tux's lil' helper


Joined: 20 Jun 2003
Posts: 134
Location: Germany

PostPosted: Mon Sep 02, 2013 8:51 pm    Post subject: NTPD with Sys5 init is not Continuously Synchronizing Time Reply with quote

Hi,
I have a fairly recent system but after 90 days uptime I noticed that there is a time drift.
I have ntpd running:

Code:
/usr/sbin/ntpd -p /var/run/ntpd.pid -u ntp:ntp


With this config:

Code:
restrict default nomodify nopeer
restrict 127.0.0.1


The wiki says "Add ntpd to the default runlevel to have the time synchronized automatically"
http://wiki.gentoo.org/wiki/NTP

So I don't understand why it is not syncing.

Only after running ntp-client manually, the time got synced.
Back to top
View user's profile Send private message
massimo
Veteran
Veteran


Joined: 22 Jun 2003
Posts: 1226

PostPosted: Fri Sep 06, 2013 11:23 am    Post subject: Reply with quote

You have to add other NTP servers to /etc/ntp.conf.
_________________
Hello 911? How are you?
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Fri Sep 06, 2013 12:37 pm    Post subject: Reply with quote

some of the wiki was a little messed up and out of order. some client stuff bleeding into server configs.

you don't need to add to the configs.

look at the wiki again i fixed it 4 u.

b4

https://wiki.gentoo.org/index.php?title=NTP&oldid=18801

after

https://wiki.gentoo.org/index.php?title=NTP&oldid=49167


Last edited by 666threesixes666 on Fri Sep 06, 2013 5:51 pm; edited 1 time in total
Back to top
View user's profile Send private message
RAPHEAD
Tux's lil' helper
Tux's lil' helper


Joined: 20 Jun 2003
Posts: 134
Location: Germany

PostPosted: Fri Sep 06, 2013 5:02 pm    Post subject: Reply with quote

Hi,
many thanks for your support and for putting it in the wiki!
Unfortunately, I think I have ntp-client running which
Code:
rc-service ntp-client status
confirms.
But still there was a time drift in half a year by 6 minutes and only after restarting ntp-client manually again fixed it.
So I think that ntp-client is not synchronizing continuously.
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3920
Location: Hamburg

PostPosted: Fri Sep 06, 2013 5:17 pm    Post subject: Reply with quote

RAPHEAD wrote:
So I think that ntp-client is not synchronizing continuously.
Yes.

I use this config values - they do work since last century :
Code:
tfoerste@n22 ~ $ grep -v -e '^$' -e '#'  /etc/ntp.conf
server 0.gentoo.pool.ntp.org
server 1.gentoo.pool.ntp.org
server 2.gentoo.pool.ntp.org
server 3.gentoo.pool.ntp.org
driftfile       /var/lib/ntp/ntp.drift
restrict default nomodify nopeer
restrict 127.0.0.1
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Fri Sep 06, 2013 5:51 pm    Post subject: Reply with quote

id just run the server, and remove the client / ntpdate.... id run ntpdate pool.ntp.org once, then ntpd for the long haul.

id then /etc/conf.d/hwclock

Code:

clock_hctosys="YES"

clock_systohc="YES"


&&

rc-update add hwclock boot

ive yet to wiki this.
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3920
Location: Hamburg

PostPosted: Fri Sep 06, 2013 6:26 pm    Post subject: Reply with quote

666threesixes666 wrote:
Code:

clock_hctosys="YES"

clock_systohc="YES"
The reporter mentioned a 90 day uptime period, so although this is helpful in general it is not the root cause of his problem. The root cause is the missing external time source/s, isn't it ?
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Fri Sep 06, 2013 6:48 pm    Post subject: Reply with quote

ntpdate should be called frequently from a cron job, or ntp-client should be restarted from a cron job frequently. or run the ntpd server and have it adjust clock rates gradually all the time. they want ntpd behavior, and to turn ntp-client / ntpdate stuff off, those are like stand alone sync right now clients. ntpd would adjust drift rates and correct the drift and sync against online atomic clocks.
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3264
Location: Canada

PostPosted: Fri Sep 06, 2013 8:28 pm    Post subject: Reply with quote

toralf wrote:
666threesixes666 wrote:
Code:

clock_hctosys="YES"

clock_systohc="YES"
The reporter mentioned a 90 day uptime period, so although this is helpful in general it is not the root cause of his problem. The root cause is the missing external time source/s, isn't it ?



Of course, it is, it seems he does not have external time servers specified and is synchronizing just with himself.
However, one should remember that if the time mismatch is too large, ntpd will refuse to synchronize and will exit - you need to synchronize manually first. It can happen if uptime is large with synchronization off or when system clock is not synced to hardware, so on reboot you get hardware time which is off. So uptime and options above may have some relevance to the situation.


Last edited by dmpogo on Fri Sep 06, 2013 11:02 pm; edited 1 time in total
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Fri Sep 06, 2013 9:18 pm    Post subject: Reply with quote

ive seen other distributions run ntp-date to set local time, then hand over to ntpd. (slackware) maybe there is a method to do this, like set client to run @ boot & ntpd @ default. (or maybe both default would do this since its alphabetical?)

"it seems he does not have external time servers specified and is synchronizing just with himself. " he's syncing remotely once, and then never syncing or adjusting clock skew again. " it seems he does not have external time servers" or both.
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3920
Location: Hamburg

PostPosted: Fri Sep 06, 2013 9:29 pm    Post subject: Reply with quote

666threesixes666 wrote:
ive seen other distributions run ntp-date to set local time, then hand over to ntpd. (slackware) maybe there is a method to do this
?
That's exactly, how it works in Gentoo - simply add ntpd and ntp-client to "default" runlevel.
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3264
Location: Canada

PostPosted: Fri Sep 06, 2013 11:05 pm    Post subject: Reply with quote

666threesixes666 wrote:
ive seen other distributions run ntp-date to set local time, then hand over to ntpd. (slackware) maybe there is a method to do this, like set client to run @ boot & ntpd @ default. (or maybe both default would do this since its alphabetical?)

"it seems he does not have external time servers specified and is synchronizing just with himself. " he's syncing remotely once, and then never syncing or adjusting clock skew again. " it seems he does not have external time servers" or both.


(or maybe both default would do this since its alphabetical?)

Yep, sure, you now openrc has things like 'after', 'need', etc. If you look at /etc/init.d/ntpd it says

Code:

depend() {
        use net dns logger
        after ntp-client
}


so adding both ntp-client and ntpd to default will launch them in the required sequence.
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Fri Sep 06, 2013 11:09 pm    Post subject: Reply with quote

ok i think the wiki has a sufficiently proper flow to it now.

https://wiki.gentoo.org/wiki/NTP <---

added

https://wiki.gentoo.org/wiki/NTP#Ntp-Client <--- (for those adjusting config files going to ntpd not ntp-client)


Last edited by 666threesixes666 on Fri Sep 06, 2013 11:14 pm; edited 1 time in total
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Fri Sep 06, 2013 11:12 pm    Post subject: Reply with quote

net-misc/openntpd or net-misc/ntp ?
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Fri Sep 06, 2013 11:21 pm    Post subject: Reply with quote

Jaglover wrote:
net-misc/openntpd or net-misc/ntp ?


net-misc/openntpd should be its own wiki page, go crazy on it i don't intend to follow through past working on the net-misc/ntp.

net-misc/ntpclient & net-misc/openntpd & net-misc/ntp could make good ntp protocol sub pages.
Back to top
View user's profile Send private message
RAPHEAD
Tux's lil' helper
Tux's lil' helper


Joined: 20 Jun 2003
Posts: 134
Location: Germany

PostPosted: Mon Sep 09, 2013 7:43 am    Post subject: Reply with quote

Hi,

I double checked with the wiki but everything is set up as documented, also the kernel settings.
I will track it and hope that it works now.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum