LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ntpd dead but pid file exists (https://www.linuxquestions.org/questions/linux-newbie-8/ntpd-dead-but-pid-file-exists-4175475647/)

Stannley 09-02-2013 10:35 PM

ntpd dead but pid file exists
 
Hi Guys

As the subject says, my ntp daemon keeps failing.

/var/log/messages:
Code:

Sep  3 11:02:47 spvx10599 ntpd[28882]: ntpd 4.2.4p8@1.1612-o Thu Jan 10 15:17:40 UTC 2013 (1)
Sep  3 11:02:47 spvx10599 ntpd[28883]: precision = 0.097 usec
Sep  3 11:02:47 spvx10599 ntpd[28883]: Listening on interface #0 wildcard, 0.0.0.0#123 Disabled
Sep  3 11:02:47 spvx10599 ntpd[28883]: Listening on interface #1 wildcard, ::#123 Disabled
Sep  3 11:02:47 spvx10599 ntpd[28883]: Listening on interface #2 lo, ::1#123 Enabled
Sep  3 11:02:47 spvx10599 ntpd[28883]: Listening on interface #3 eth0, fe80::250:56ff:fe83:1#123 Enabled
Sep  3 11:02:47 spvx10599 ntpd[28883]: Listening on interface #4 lo, 127.0.0.1#123 Enabled
Sep  3 11:02:47 spvx10599 ntpd[28883]: Listening on interface #5 eth0, 10.0.1.108#123 Enabled
Sep  3 11:02:47 spvx10599 ntpd[28883]: Listening on routing socket on fd #22 for interface updates
Sep  3 11:02:47 spvx10599 ntpd[28883]: kernel time sync status 2040
Sep  3 11:02:47 spvx10599 ntpd[28883]: Cannot chdir() to `eth0': No such file or directory

It seems to have a problem with eth0.

[root@spvx10599 ntp]# ntpq -p
ntpq: read: Connection refused

I can ping the servers in the config file:
Code:

[root@spvx10599 ntp]# ping 172.18.0.1
PING 172.18.0.1 (172.18.0.1) 56(84) bytes of data.
64 bytes from 172.18.0.1: icmp_seq=1 ttl=251 time=41.8 ms
64 bytes from 172.18.0.1: icmp_seq=2 ttl=251 time=41.8 ms
64 bytes from 172.18.0.1: icmp_seq=3 ttl=251 time=41.8 ms
^C
--- 172.18.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2561ms
rtt min/avg/max/mdev = 41.822/41.866/41.890/0.238 ms
[root@spvx10599 ntp]# ping 172.18.0.2
PING 172.18.0.2 (172.18.0.2) 56(84) bytes of data.
64 bytes from 172.18.0.2: icmp_seq=1 ttl=250 time=44.8 ms
64 bytes from 172.18.0.2: icmp_seq=2 ttl=250 time=44.0 ms
64 bytes from 172.18.0.2: icmp_seq=3 ttl=250 time=44.7 ms
^C
--- 172.18.0.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2264ms
rtt min/avg/max/mdev = 44.052/44.548/44.837/0.428 ms
[root@spvx10599 ntp]# ping 172.19.0.2
PING 172.19.0.2 (172.19.0.2) 56(84) bytes of data.
64 bytes from 172.19.0.2: icmp_seq=1 ttl=250 time=45.6 ms
64 bytes from 172.19.0.2: icmp_seq=2 ttl=250 time=45.6 ms
^C
--- 172.19.0.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1905ms
rtt min/avg/max/mdev = 45.631/45.657/45.683/0.026 ms
[root@spvx10599 ntp]# ping 172.19.0.1
PING 172.19.0.1 (172.19.0.1) 56(84) bytes of data.
64 bytes from 172.19.0.1: icmp_seq=1 ttl=251 time=44.2 ms
64 bytes from 172.19.0.1: icmp_seq=2 ttl=251 time=44.2 ms
64 bytes from 172.19.0.1: icmp_seq=3 ttl=251 time=44.2 ms
64 bytes from 172.19.0.1: icmp_seq=4 ttl=251 time=44.2 ms
^C
--- 172.19.0.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3236ms
rtt min/avg/max/mdev = 44.215/44.237/44.257/0.149 ms

I have the same setup on other machines and its working correctly. I have even copied the config file from a working install to this machine. Of course this is the production machine where its not working :rolleyes:

I would be very grateful if anyone has any ideas on how to get this working.

We are using Red Hat 6.3.

Thanks

Simon

unSpawn 09-03-2013 04:21 PM

Quote:

Originally Posted by Stannley (Post 5020622)
Code:

Sep  3 11:02:47 spvx10599 ntpd[28883]: Cannot chdir() to `eth0': No such file or directory

I'd check for command line or configuration file errors first.

Stannley 09-05-2013 12:57 AM

Quote:

Originally Posted by unSpawn (Post 5021151)
I'd check for command line or configuration file errors first.

Hi unSpawn

I thought it might be the ntpd config which is why I copied the file (scp) from a server that was working and therefore (presumably) is set up correctly. Still no good.

If I could understand what it was trying to do then I might be better placed in figuring out whats going wrong. For example, what is the path its trying to reach when it reports the following:

Code:

Sep  3 11:02:47 spvx10599 ntpd[28883]: Cannot chdir() to `eth0': No such file or directory
Cheers

Simon

unSpawn 09-05-2013 01:43 AM

/var/lib/ntp prolly.

Stannley 09-05-2013 11:58 PM

Quote:

Originally Posted by unSpawn (Post 5022085)
/var/lib/ntp prolly.

Hi unSpawn

I checked that location and the drift file did not exist. I tried copying one from a working server but it still did not work:

Code:

[root@spvx10599 ntp]# ls -lah
total 12K
drwxr-xr-x.  2 ntp  ntp  4.0K Sep  6 12:54 .
drwxr-xr-x. 53 root root 4.0K Nov 14  2012 ..
-rw-r--r--.  1 ntp  ntp    6 Sep  6 12:54 drift
[root@spvx10599 ntp]# service ntpd restart
Shutting down ntpd:                                        [FAILED]
Starting ntpd:                                            [  OK  ]
[root@spvx10599 ntp]# service ntpd status
ntpd dead but pid file exists
[root@spvx10599 ntp]# ls -lah
total 12K
drwxr-xr-x.  2 ntp  ntp  4.0K Sep  6 12:54 .
drwxr-xr-x. 53 root root 4.0K Nov 14  2012 ..
-rw-r--r--.  1 ntp  ntp    6 Sep  6 12:54 drift


unSpawn 09-06-2013 01:06 AM

No that's not how you should do that. Post the complete command line for starting ntpd and its configuration file without comments (use 'grep -v "^#" /path/to/conffile|grep .;').

Stannley 09-08-2013 08:01 PM

Quote:

Originally Posted by unSpawn (Post 5022814)
No that's not how you should do that. Post the complete command line for starting ntpd and its configuration file without comments (use 'grep -v "^#" /path/to/conffile|grep .;').

Hi unSpawn

I have fixed this issue now. I found that the /etc/sysconfig/ntpd config contained the following:

Code:

OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -g -x -i eth0"
Whereas all the other machines have this:

Code:

OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -g"
I made the config look the same as the others, restarted ntpd and its now working.

Thanks for all your help.

Simon

unSpawn 09-11-2013 12:32 PM

Well done fixing that yourself!


All times are GMT -5. The time now is 07:29 PM.