LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   ntp - no servers can be used, exiting (https://www.linuxquestions.org/questions/slackware-14/ntp-no-servers-can-be-used-exiting-831535/)

Wed 09-11-2010 06:37 AM

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?

druuna 09-11-2010 06:45 AM

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.

GazL 09-11-2010 06:52 AM

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.

Wed 09-11-2010 06:53 AM

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 ...

Wed 09-11-2010 06:55 AM

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#


druuna 09-11-2010 07:02 AM

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.

Wed 09-11-2010 07:40 AM

I think those instructions are easier to follow than the official ones. I'm much obliged!

druuna 09-11-2010 07:44 AM

You're welcome :)


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