LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-11-2010, 07:37 AM   #1
Wed
Member
 
Registered: Sep 2005
Location: Sweden
Distribution: Slackware
Posts: 173

Rep: Reputation: 34
ntp - no servers can be used, exiting


From other threads, I have managed to at least set the time straight once with ntpdate. But of course, I want that to be automated by the system. However, it didn't work as I had hoped for:

Code:
bash-4.1# ntpdate 0.pool.ntp.org
11 Sep 12:34:25 ntpdate[12709]: step time server 173.201.38.85 offset -356.823367 sec

bash-4.1# ntpdate 0.pool.ntp.org
11 Sep 12:35:59 ntpdate[12713]: adjust time server 173.201.38.85 offset -0.012421 sec
From pool.ntp.org I found the recommended servers for Sweden and put those in /etc/ntp.conf.

bash-4.1# nano /etc/ntp.conf
Code:
# Sample /etc/ntp.conf:  Configuration file for ntpd.
#
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available. The
# default stratum is usually 3, but in this case we elect to use stratum
# 0. Since the server line does not have the prefer keyword, this driver
# is never used for synchronization, unless no other other
# synchronization source is available. In case the local host is
# controlled by some external source, such as an external oscillator or
# another protocol, the prefer keyword would cause the local host to
# disregard all other synchronization sources, unless the kernel
# modifications are in use and declare an unsynchronized condition.
#
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10

server 0.se.pool.ntp.org
server 1.se.pool.ntp.org
server 2.se.pool.ntp.org
server 3.se.pool.ntp.org


#
# Drift file.  Put this in a directory which the daemon can write to.
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
#
driftfile /etc/ntp/drift
multicastclient                 # listen on default 224.0.1.1
broadcastdelay  0.008

#
# Keys file.  If you want to diddle your server at run time, make a
# keys file (mode 600 for sure) and define the key number to be
# used for making requests.
# PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote
# systems might be able to reset your clock at will.
#
#keys           /etc/ntp/keys
#trustedkey     65535
#requestkey     65535
#controlkey     65535

# Don't serve time or stats to anyone else by default (more secure)
restrict default noquery nomodify
# Trust ourselves.  :-)
restrict 127.0.0.1
Oh well, the servers were put in place.



Code:
bash-4.1# ntpq -pn
ntpq: read: Connection refused

bash-4.1# ntpdate 
11 Sep 13:01:28 ntpdate[12828]: no servers can be used, exiting
And tested, to no avail.

One thing that caught my eye though, was that pool.ntp.org, stated:
Quote:
driftfile /var/lib/ntp/ntp.drift

server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org
And that I had no such file as ntp.drift
Code:
bash-4.1# ls /etc/ntp/ 
ntp.keys  step-tickers

bash-4.1# locate drift    
/usr/man/man6/drift.6.gz
/usr/share/xscreensaver/config/drift.xml
/usr/libexec/xscreensaver/drift
bash-4.1#
Even if I had a driftfile, should it really contain addresses?
 
Old 09-11-2010, 07:45 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393
Hi,

What happens if you simplify the ntp.conf file?

Try this to start with:
Quote:
#----------------------------------------------------------------------------#
# /etc/ntp.conf
#----------------------------------------------------------------------------#
# Outside source of synchronized time
server 0.se.pool.ntp.org
server 1.se.pool.ntp.org
server 2.se.pool.ntp.org
server 3.se.pool.ntp.org
#------------------------------------------------------------------#
# Miscellaneous stuff
driftfile /var/lib/ntp/ntp.drift # remember the drift of the local clock
logconfig =all # what to log
logfile /var/log/ntp.log # alternate log file
#----------------------------------------------------------------------------#
# End
This will also enable logging, which could be of help to solve any problems (also watch your /var/log/message logfile).

Hope this helps.
 
Old 09-11-2010, 07:52 AM   #3
GazL
LQ Guru
 
Registered: May 2008
Posts: 5,245
Blog Entries: 18

Rep: Reputation: 2989Reputation: 2989Reputation: 2989Reputation: 2989Reputation: 2989Reputation: 2989Reputation: 2989Reputation: 2989Reputation: 2989Reputation: 2989Reputation: 2989
Check that ntpd is running. You should see something like:
Code:
gazl@nix:~$ ps -f -C ntpd
UID        PID  PPID  C STIME TTY          TIME CMD
root      1613     1  0 09:22 ?        00:00:00 /usr/sbin/ntpd -g -p /var/run/ntpd.pid
If it's not, then login as root and run /etc/rc.d/rc.ntpd start

If you get permission denied, you may need to chmod 755 /etc/rc.d/rc.ntpd

If the time adjustment is too large ntpd may exit on startup. running ntpdate prior to starting it can resolve that.

p.s. /etc/ntp.conf has nothing to do with ntpdate. it's for ntpd. when you use ntpdate you have to give it a server on the command line.

Last edited by GazL; 09-11-2010 at 07:55 AM.
 
Old 09-11-2010, 07:53 AM   #4
Wed
Member
 
Registered: Sep 2005
Location: Sweden
Distribution: Slackware
Posts: 173

Original Poster
Rep: Reputation: 34
Thanks a lot!
Code:
bash-4.1# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 127.127.1.0     .LOCL.          10 l  320   64  360    0.000    0.000   0.000
+193.228.143.13  62.119.40.98     2 u   21  128  377   12.070    5.260   1.511
+192.121.13.58   192.36.134.25    2 u   22  128  377   11.664    6.397   0.997
+192.157.38.60   192.36.143.151   2 u   25  128  377   11.092    6.235   0.952
*130.236.254.17  .GPS.            1 u   85  128  377   15.451    8.153   2.098
bash-4.1#
But I still wish I knew what the big difference is ...
 
Old 09-11-2010, 07:55 AM   #5
Wed
Member
 
Registered: Sep 2005
Location: Sweden
Distribution: Slackware
Posts: 173

Original Poster
Rep: Reputation: 34
It seems to be running:
Code:
bash-4.1# ps -f -C ntpd
UID        PID  PPID  C STIME TTY          TIME CMD
root     12827     1  0 13:01 ?        00:00:00 ntpd
bash-4.1#
 
Old 09-11-2010, 08:02 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393
Hi,

The version I posted only connects to time servers and does not configure for being a time server itself, which I believe your posted version does/tries to. Have a look here: LHN - The NTP Server.

Hope this clears things up a bit.
 
1 members found this post helpful.
Old 09-11-2010, 08:40 AM   #7
Wed
Member
 
Registered: Sep 2005
Location: Sweden
Distribution: Slackware
Posts: 173

Original Poster
Rep: Reputation: 34
I think those instructions are easier to follow than the official ones. I'm much obliged!
 
Old 09-11-2010, 08:44 AM   #8
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393
You're welcome
 
1 members found this post helpful.
  


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
ntpdate - no servers can be used, exiting Jedimastersa Linux - Newbie 4 10-19-2018 08:16 AM
trusted ntp servers tikit Linux - Security 2 06-02-2009 10:22 AM
Enable authentication on on NTP servers ashishja Linux - Software 1 07-11-2008 04:49 PM
ntp not synchronizing with internet servers apachenew Debian 9 08-22-2007 10:54 AM
NTP time servers with Suse 10.2 sadiqdm SUSE / openSUSE 0 03-18-2007 12:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:33 AM.

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