Solved

linux ntpd not working correctly

Posted on 2014-07-24
16
187 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AWS RDS 3 83
CentOS 7 Installation 7 72
installing docker on ubuntu 6 28
AWS Central Authentication 1 52
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.

813 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

11 Experts available now in Live!

Get 1:1 Help Now