# ntpd dying silently

## Slimvdl

My ntpd was working fine until I upgraded to 4.2.2 about 3 wks ago. When it stopped working, my first reaction was to go back to the previous version ntp-4.2.0.20040617-r3 but the problem remains:

ntpd starts at bootup but doesn't log anything to my logfile. 

I also can't find any trace (via ps) of its pid (found in /var/run/ntpd.pid). 

ntpq -p gives me a "ntpq: read: Connection refused".

However if I do a /var/init.d/ntpd start it tells me that ntpd is running.

ntpd -q works fine

1st question: is it running or not. Surely if it doesn't show up via ps, it's not there.

2nd question: if it's not running, why not? I've reverted entirely back to pre 4.2.2 setting (ntpd.conf etc) but the problem persists: I get no logging and my clock is not accurate.

I've read in the forums that ntpd dies quietly which is a shame since I've nothing to work with.

If I run ntpd myself (/usr/sbin/ntpd -p /var/run/ntpd.pid -u ntp:ntp -l /tmp/logntp) it prints a little log message to /tmp/logntp:

13 Nov 14:25:35 ntpd[26532]: ntpd 4.2.0a@1.1190-r Wed Nov  1 19:23:35 CET 2006 (1)

13 Nov 14:25:35 ntpd[26532]: precision = 3.000 usec

13 Nov 14:25:35 ntpd[26532]: Listening on interface wildcard, 0.0.0.0#123

13 Nov 14:25:35 ntpd[26532]: Listening on interface lo, 127.0.0.1#123

13 Nov 14:25:35 ntpd[26532]: Listening on interface eth0, 192.168.1.101#123

13 Nov 14:25:35 ntpd[26532]: kernel time sync status 0040

And then nothing...

----------

## claw

If "ps -ef | grep ntpd" shows no processes, then ntpd is not running.

So why does it die during boot, but not when manually started? Could be because your network is not fully configured when ntpd is started during boot. If your network comes up after ntpd, then ntpd will not notice the change. This is a problem for DHCP users. See http://ntp.isc.org/bin/view/Support/ConfiguringNTP for reiteration of this sad fact.

Speaking of networking, why is your eth0 configured with IP address 192.168.1.101 ? That's not a valid public address. Is this system on a private LAN?

Additional clues may be obtained by logging NTP events to its own log file by adding "logfile   /var/log/ntpd.log" to /etc/ntp.conf.

----------

## Mousee

 *claw wrote:*   

> 
> 
> Speaking of networking, why is your eth0 configured with IP address 192.168.1.101 ? That's not a valid public address. Is this system on a private LAN?
> 
> 

 

Most people use something called a 'router'  :Smile: 

I second your belief that it's DHCP causing the issue though. I had this problem when I first started using ntpd (ages ago now), and discovered it was due to the mis-configuration of /etc/conf.d/net

----------

## padoor

why not try 

/etc/init.d/ntpd stop

ntpdate asia.pool.ntp.org (or your nearest server)

this will atleast make sure ntp works or not.

if you are using kde sysguard processtable will show if ntpd is running.

just typing ntpd 

will give ntpd already running message if it is.

----------

## dmpogo

One reason can be is that

ntpd exits if the  your clock is way off (more than something like 10 minutes). Then you have to adjust the clock manually and restart 

ntpd.  Don't forget to sync hardware and system clock

----------

## Slimvdl

A little precision:

Ntpd was working perfectly for about 2 years. My setup is basically untouched (except for the ntp upgrade I mentioned). My network conf (dhcp etc) hasn't changed at all.

ntpd -q work perfectly so I'm able to connect to ntp servers.

Even when I run ntpd manually, it dies after the brief log message I posted.

If I'm the only one with this problem then obviously there is something wrong with my setup. I'll look at /etc/conf.d/net to see if it's changed. Any other files worth looking at (besides the obvious: ntp.conf, conf.d/ntpd)?

----------

## dmpogo

 *Slimvdl wrote:*   

> A little precision:
> 
> Ntpd was working perfectly for about 2 years. My setup is basically untouched (except for the ntp upgrade I mentioned). My network conf (dhcp etc) hasn't changed at all.
> 
> ntpd -q work perfectly so I'm able to connect to ntp servers.
> ...

 

Let me repeat. If you current time setting is substantially off, ntpd will exit silently (there may be a message in one of the logs). With all the old setup. Even when run manually. Check your clock !

----------

## dmpogo

 *Slimvdl wrote:*   

> A little precision:
> 
> Ntpd was working perfectly for about 2 years. My setup is basically untouched (except for the ntp upgrade I mentioned). My network conf (dhcp etc) hasn't changed at all.
> 
> ntpd -q work perfectly so I'm able to connect to ntp servers.
> ...

 

BTW, in my setup ntpd writes the log into /var/log/daemon.log    Have a look if it says anything

----------

## sbonnell

Hi,

   I have exactly the same problem, ntpd dies after launch withour any explanation. It does not start neither automatically at boot, by running /etc/init.d/ntpd nor by running /usr/sbin/ntpd.

   At each start I can see the log lines you are presenting in my /var/log/messages.

   This is not a DHCP problem since my linux server is using a static IP address...

Stephane

----------

## sbonnell

Hi,

    I solved my problem. Now ntpd starts fine. To solve the problem I re-emerge ntp package with flags caps set.

    I found the followaing bug : https://bugs.gentoo.org/show_bug.cgi?id=105978

    The ebuild is supposed to remove the -u ntp:ntp if caps use flag is not set. I don't know why but on my config the -u was in the config and the caps use flag was not set.

Hope that help

Regards

Stephane

----------

## Slimvdl

Thanks sbonnell.  It was indeed the caps which was killing my ntp. Somewhat curiously I'd stumbled across the same recommendation before posting my question, but when I did an equery, portage told me it had compiled ntp with "caps" in USE (assuming I properly interpreted the equery output).

But since you had the same problem I decided to recompile anyway ($ USE=caps emerge ntp) and now everything works fine.

Thanks again (to everyone).

----------

## dmpogo

 *Slimvdl wrote:*   

> Thanks sbonnell.  It was indeed the caps which was killing my ntp. Somewhat curiously I'd stumbled across the same recommendation before posting my question, but when I did an equery, portage told me it had compiled ntp with "caps" in USE (assuming I properly interpreted the equery output).
> 
> But since you had the same problem I decided to recompile anyway ($ USE=caps emerge ntp) and now everything works fine.
> 
> Thanks again (to everyone).

 

Another option (perhaps inferior) is to eliminate -u ntp:ntp flag,which is left behind in /etc/conf.d/ntpd

----------

