LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-02-2018, 07:22 AM   #1
hazel
Senior Member
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: Debian, Crux, LFS, AntiX
Posts: 2,055
Blog Entries: 4

Rep: Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875
Curious about the time ntpd takes to correct the clock in different distros


As some of you may know, my computer is pretty old and the battery is failing. Unfortunately it can't be replaced; a friend who is better with his hands than I am was unable to remove it, probably because it is welded in place by corrosion products.

To save myself the hassle of having to set the clock each time I boot, I decided to install ntp, after noticing that my Debian system has a systemd service that runs it. Now I have noticed that in Crux, as in Debian, the correct time comes up almost as fast as the desktop. In LFS however, it takes over three minutes for the system clock to be set correctly. Both daemons are locally built.

I thought at first that it was the ntpd configuration file that made the difference, so I sidelined the one in LFS and copied over the one from Crux instead, but it seems to make no difference.

Can anyone explain this?
 
Old 06-02-2018, 08:23 AM   #2
RandomTroll
Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 934

Rep: Reputation: 151Reputation: 151
Instead of NTP I use a version of nist, an app NIST wrote that fetches the time from a source, daily. It tries servers until it finds one that works. If a server doesn't respond it waits a long time. If a number of them don't those times add up. I pay attention occasionally and find my list of servers is out-of-date: nist goes through a number of no-longer-available servers until it finds a good one. Then I change the list to put valid ones first. Your problem may be completely different.
 
Old 06-02-2018, 09:25 AM   #3
hazel
Senior Member
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: Debian, Crux, LFS, AntiX
Posts: 2,055
Blog Entries: 4

Original Poster
Rep: Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875
Yes, I thought at first that it could be differences in the servers used. But the server addresses are in ntp.conf. Changing the LFS version of this file for the Crux version should correct for any differences of that sort.
 
Old 06-02-2018, 09:34 AM   #4
_roman_
Member
 
Registered: Dec 2017
Location: _Austro_Bavaria_
Distribution: gentoo / linux mint
Posts: 433

Rep: Reputation: 28
IT is more an issue of having proper network. IF that is missing ntp screws up. Common flaw in my point of view
 
Old 06-02-2018, 09:43 AM   #5
hazel
Senior Member
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: Debian, Crux, LFS, AntiX
Posts: 2,055
Blog Entries: 4

Original Poster
Rep: Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875
Both systems run on the same machine using the same router. The only difference in the network is that LFS uses a fixed ip address (I use it as an ftp server among other things) while Crux and Debian use dhcp.
 
Old 06-02-2018, 11:30 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 17,352

Rep: Reputation: 2233Reputation: 2233Reputation: 2233Reputation: 2233Reputation: 2233Reputation: 2233Reputation: 2233Reputation: 2233Reputation: 2233Reputation: 2233Reputation: 2233
Quote:
In LFS however, it takes over three minutes for the system clock to be set correctly.
Is the time/date displayed basically start from 00:00:00 Thursday, 1 January 1970 and after 3 minutes display the correct time/date?

When the system is up look at the output of the command ntpq -pn It should show one of more servers and their status. Until you see an * before one of the servers your not going to be synced.

Are you using the same UK pool for all operating systems?

I am not familiar with how LFS is configured to start/run ntpd. Have you compared LFS with the other operating systems. Normally it is started with the -g option which will force a time sync since ntpd will fail if the system clock is off by more then 1024 seconds. In the old days before the -g option you would use the ntpdate command to force a time sync and then start ntpd.
 
Old 06-02-2018, 12:37 PM   #7
hazel
Senior Member
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: Debian, Crux, LFS, AntiX
Posts: 2,055
Blog Entries: 4

Original Poster
Rep: Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875
I think you've hit it. LFS starts ntpd simply with -g. Crux runs the program twice: the first time with -gqx (which I gather from the man page causes an immediate exit after syncing) and then again with just -g.

I'll try getting LFS to do that and see what happens.
 
Old 06-02-2018, 12:52 PM   #8
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,327

Rep: Reputation: 965Reputation: 965Reputation: 965Reputation: 965Reputation: 965Reputation: 965Reputation: 965Reputation: 965
OR, the startup script might run ntpdate to instantly sync the clock, and then launches the ntp daemon.
 
Old 06-02-2018, 02:15 PM   #9
hazel
Senior Member
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: Debian, Crux, LFS, AntiX
Posts: 2,055
Blog Entries: 4

Original Poster
Rep: Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875
Quote:
Originally Posted by AwesomeMachine View Post
OR, the startup script might run ntpdate to instantly sync the clock, and then launches the ntp daemon.
No, it doesn't do that in either system. I checked. Anyway ntpdate is supposed to be obsolete.
 
Old 06-02-2018, 10:42 PM   #10
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,327

Rep: Reputation: 965Reputation: 965Reputation: 965Reputation: 965Reputation: 965Reputation: 965Reputation: 965Reputation: 965
Then you looked at the startup scripts. 'sntp -s time.server' will also set the clock instantly.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
System clock correct, hardware clock wrong karlovac Linux - General 5 01-16-2009 07:19 PM
Benchmarking a tape drive, time to copy takes forever, time to append takes longer? jeriryan Linux - Hardware 2 06-15-2008 12:15 AM
GPS or Atomic Clock for NTPD slacky Linux - Networking 3 12-15-2006 06:13 AM
Various clock issues: Clock shows wrong time only in Knoppmyth, & CMOS time change ? davidbix General 1 04-05-2006 09:58 PM
clock never has correct time after booting up ki5eg Linux - Newbie 3 08-04-2004 02:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration