Solved

linux ntpd not working correctly

Posted on 2014-07-24
16
180 Views
Last Modified: 2014-10-09
I've recently installed slackware distro 14.1. I'm having trouble with ntpd. The time on my computer is always off. The first time it was off 12 hours. I reset the time using `ntpdate -s time.nist.gov`. After rebooting, it is was off again, this time 4 hours. I've enabled ntpd on 3 other Debian systems and had no problem. According to /var/log/messages, ntpd is running. My TZ is set correctly to EDT.

What's wrong?
0
Comment
Question by:jmarkfoley
  • 8
  • 6
  • 2
16 Comments
 
LVL 13

Expert Comment

by:Sandy
ID: 40218524
Seems like you have installed it on VMware, If this is the case then please disable host sync from vmware for this VM then NTP will work perfectly.

TY/SA
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40218562
This is not a virtual machine. Other ideas?
0
 
LVL 13

Accepted Solution

by:
Sandy earned 500 total points
ID: 40218571
then check with CMOS battery or system time it must be conflicting..

TY/SA
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40218612
Actually, I think I need to properly configure my ntp.conf file. I find the documentation on this wonderfully confusing. I want to set up to synchronize with server pool.ntp.org, and permit only hosts on 192.168.0.0/24 to synchronize with this host. What should I set in ntp.conf?

I believe I can accomplish the 1st goal by uncommenting the "#server pool.ntp.org iburst" line in ntp.conf. As to permitting hosts, the following is currently set in ntp.conf:
# Don't serve time or stats to anyone else by default (more secure)
restrict default noquery nomodify

# Trust ourselves.  :-)
restrict 127.0.0.1

Open in new window

I've read about default noquery and nomodify options. The documentation appears to be written in English,  but I confess I'm mystified as to its meaning. How do I permit only hosts on 192.168.0.0/24 to synchronize with this host?
0
 
LVL 13

Expert Comment

by:Sandy
ID: 40218616
you need to enter server x.x.x.x parameter to sync with and i would suggest to use iburst iburst with it..

Apart from this there is not much check with

#ntpq -np

TY/SA
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40220728
I've got:
server pool.ntp.org iburst
server  127.127.1.0     # local clock

Open in new window

and that appears to be working. I set my time off by +10 minutes last night and now it is back to the correct time.  ntpq -p gives me:
$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 LOCAL(0)        .LOCL.          10 l   6h   64    0    0.000    0.000   0.000
*repos.lax-noc.c 216.218.254.202  2 u  695 1024  377   69.032    0.777   2.003

Open in new window

but my question was not about syncing with the ntp server, I want to know what directive I need to let other hosts on the 192.168.0.0/24 LAN sync with *this* host. I believe I need a "restrict" directive, but can't figure out what that should be. Currently the restrict directives are set to the as-shipped defaults:
restrict default noquery nomodify
# Trust ourselves.  :-)
restrict 127.0.0.1

Open in new window

What do I need to let LAN member hosts sync with this host?
0
 
LVL 13

Expert Comment

by:Sandy
ID: 40221001
This is fine.. You can start using this as a NTP server for your LAN client ? configure and see...

TY/SA
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40237802
OK - will set up a client and post back results.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 1

Author Comment

by:jmarkfoley
ID: 40267085
Well, sorry to be a bad penny - but this just isn't working and I can't figure out why. All of the above worked just fine until I rebooted. Now, I'm back to having my system time 4 hours ahead of the real time and the ntpd daemon did not start (or at least I can say it is not currently running). I really need to know how to fix this. I don't get why this simple facility is such a problem. I have it running fine on Ubuntu and Debian, but Slackware is giving me fits! Help!
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 40281412
Hi Mark,

What happened to your Q where /include/sys was not saved to backup and it transpired you had dumped a 64-bit SW install over a 32-bit system? I can no longer find it, but never got a mail that it was to be deleted.

As to this Q, it sounds to me like your hardware clock is local time but Linux is configured to expect it to be UTC, or vice versa.
ntp generally exits when the time difference is more than the panic threshold (default 1000s; documented at  file:///usr/doc/ntp-4.2.6p5/html/miscopt.html#tinker ). When invoked with the -g option, a huge gap is allowed once; see -g, --panicgate in man ntpd. Perhaps some process is doing hwclock --hctosys after ntpd has started. That would kill ntpd but it should have logged something in /var/log/ntp.log

If you correct the setting of your hardware (BIOS) clock, all should be well.
0
 
LVL 13

Expert Comment

by:Sandy
ID: 40282519
I was saying the same. :D

Ty/SA
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40283622
Duncan Roe: > What happened to your Q where /include/sys was not saved to backup and it transpired you had dumped a 64-bit SW install over a 32-bit system?

That question was/is: http://www.experts-exchange.com/OS/Linux/Q_28493144.html, and perhaps you did find it after all because yours is the most recent response.

Duncan Roe, Sandy: I don't think the hardware clock as a timezone component and my local timezone is set to EDT. I will reboot and check the hardware clock setting this afternoon and report back.
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 40284308
Check the contents of /etc/adjtime. If the last line of that file is UTC, that is your problem: the kernel expects a UTC BIOS clock but yours is EDT
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40324694
Duncan Roe: The last line of /etc/adjtime is "LOCAL".

Not sure what the problem is here. I set the hardware clock to the correct time and verified it a couple of days later by looking at the actual BIOS settings. After running for several weeks I rebooted a couple of times. I didn't notice a problem with the first couple of reboots, but when I just rebooted again my system time was set to +4 hours from the correct time and the hardware clock was set to +4 hours from that. I reset the hardware clock again and reset the system clock from the hardware clock (hwclock -s) and rebooted. Time is OK.

I don't know if I have a flakey hardware clock or what. I've used ntpd on other Debian systems w/o problem. This is my only Slackware running ntpd. OS? Hardware?

I'll scratch my head on this for a couple of days and if nothing interesting, I'll close it and eventually try on different hardware and see if I have the same problem.
0
 
LVL 13

Expert Comment

by:Sandy
ID: 40324695
similarly i was stating in comment #I40218571
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40371139
I've come to the conclusion that it must be my hardware. This seems to happen after a power outage which probably means the CMOS battery is not keeping the clock up to date -- however, it doesn't lose other settings. I'll close this out and will eventually change hardware.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now