LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   NTP problems in Slackware 13.1 (https://www.linuxquestions.org/questions/slackware-14/ntp-problems-in-slackware-13-1-a-871718/)

mlpa 03-29-2011 09:15 AM

NTP problems in Slackware 13.1
 
Hi, I use Slackware64 13.1 and this Sunday the hour change and ntp daemon don't start automatically and my clock is an hour late.

It's normal or a bug?

Richard Cranium 03-29-2011 09:16 AM

What version of glibc-zoneinfo do you have? Is your timezone set correctly?

Quote:

ntp daemon don't start automatically
Do you run ntp on a cron job or something?

mlpa 03-29-2011 09:22 AM

Quote:

Originally Posted by Richard Cranium (Post 4307500)
What version of glibc-zoneinfo do you have? Is your timezone set correctly?



Do you run ntp on a cron job or something?

How can I check glibc-zoneinfo and timezone?

I have ntp running in rc.ntp.

willysr 03-29-2011 09:27 AM

you have to update the /etc/ntp.conf with the correct NTP Server or else it won't get any updates at all

mlpa 03-29-2011 09:30 AM

Quote:

Originally Posted by willysr (Post 4307521)
you have to update the /etc/ntp.conf with the correct NTP Server or else it won't get any updates at all

Yes i have done that, I have the server from my University.
Until the change in hour was working well.
I ran ntpq -p and see connected to peers.
Now says
Code:

ntpq: read: Connection refused

mlpa 03-29-2011 09:33 AM

My timezone is WEST and since I'm in Portugal I think is correct.

allend 03-29-2011 09:35 AM

To set your local time zone run, as root, 'timeconfig'.
To get ntp to run automatically, /etc/rc.d/rc.ntpd needs to be executable. Use 'ntpd -q' for one off time updates.

A properly configured ntp setup will handle daylight saving changes. Perhaps you could post your /etc/ntp.conf file.

mlpa 03-29-2011 09:37 AM

My ntp.conf

Quote:

# 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 pool.ntp.org

# Portugal NTP SERVER
server 3.pt.pool.ntp.org
server 3.europe.pool.ntp.org
server 2.europe.pool.ntp.org

# UA NTP SERVER
server 193.136.172.21
server 193.136.172.20

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

Richard Cranium 03-29-2011 09:37 AM

Quote:

Originally Posted by mlpa (Post 4307515)
How can I check glibc-zoneinfo and timezone?

I have ntp running in rc.ntp.

For glibc-zoneinfo, try
Code:

ls /var/log/packages/glibc-zoneinfo*
For the timezone, try
Code:

strings /etc/localtime | tail -1l
(Or just run /usr/sbin/timeconfig as root)

willysr brought up a good point about configuring ntpd. Here's what my configuration (/etc/ntp.conf) looks like:

Code:

restrict default notrust nomodify noquery
restrict 172.16.0.0 mask 255.255.255.0 nomodify
fudge 127.127.1.0 stratum 10
server pool.ntp.org iburst
server pool.ntp.org iburst
server pool.ntp.org iburst
server pool.ntp.org iburst
server 127.127.1.0
restrict pool.ntp.org nomodify
restrict pool.ntp.org nomodify
restrict pool.ntp.org nomodify
restrict pool.ntp.org nomodify
restrict 127.0.0.1
driftfile /etc/ntp/ntp.drift
logfile /var/log/ntp.log

This code runs on my gateway computer running Slackware 13.1. The second "restrict" line allows only the computers in my home network to access the NTP daemon on the gateway. Other than the two restrict lines, you should be able to use that configuration since there are now pool servers that are farmed out as needed to clients.

allend 03-29-2011 09:38 AM

Quote:

multicastclient # listen on default 224.0.1.1
Try commenting out this line.

audriusk 03-29-2011 09:43 AM

Are you by any chance dual booting into Windows? AFAIK, Windows stores localtime in system clock, while Linux can be configured to store localtime or UTC. What's inside /etc/hardwareclock file?

mlpa 03-29-2011 09:45 AM

I'm trying commenting that line now.

mlpa 03-29-2011 10:05 AM

Comment multicast is not doing anything special...

allend 03-29-2011 10:18 AM

What do you see if you do, as root, '/etc/rc.d/rc.ntpd stop' and then 'ntpd -gq'?

mlpa 03-29-2011 10:50 AM

Quote:

Originally Posted by allend (Post 4307584)
What do you see if you do, as root, '/etc/rc.d/rc.ntpd stop' and then 'ntpd -gq'?

I reboot the computer and it's correct now. Maybe it's the multicast thing.
That command gives
Code:

bash-4.1# ntpd -gq
ntpd: time slew +0.000000s



All times are GMT -5. The time now is 07:57 AM.