I'm trying to troubleshoot an issue on a MediaTemple server (running CentOS5) where the DNS cache has grown stale - I think because nscd has crashed. I've tried restarting nscd:

# service nscd restart
Stopping nscd:                                             [FAILED]
Starting nscd:                                             [  OK  ]

This makes sense since I believe nscd has crashed so it shouldn't already be running, but When I view the status of nscd:

# service nscd status
nscd dead but subsys locked

And ps -A returns no processes related to nscd (I assume because it's dead). I've edited /etc/nscd.conf and uncommented the line that defines the location for the log file. It created the file but it never writes anything to it.

I tried looking at the init script but found that it's no help since the script thinks everything is running fine - the service returns that it started up correctly.

How do I 'unlock' the subsys that nscd is complaining about?

link|improve this question
feedback

3 Answers

Unfortunately these are bugs in the nscd init scripts and thhe status has no meaning. The init script is expecting the pid file to be /var/run/nscd.pid (which it would be if the init script was writing the pid file). Alas, nscd itself writes its pid file to /var/run/nscd/nscd.pid.

To simplify, try troubleshooting with nscd off.

If you want to know what ncsd is failing to start examine the output of strace -f /usr/sbin/nscd.

link|improve this answer
Can I ask what you mean by troubleshooting with nscd off? As far as I can tell, it's already not running. – Phunt Jun 15 '11 at 6:19
Have you ruled out other name resolution problems? That is what I meant. – Mark Wagner Jun 15 '11 at 15:58
I'm able to ping a new host from the server (just tried serverfault.com) and the DNS lookup works fine so I don't think that's the issue. What else could I look for with regards to name resolution issues? – Phunt Jun 15 '11 at 18:59
feedback

Explore the option of the package bind-chroot (and its dependencies). Simply yum install and modify your /etc/resolv.conf to point at 127.0.0.1. It is bit more robust than nscd out of the gates.

link|improve this answer
feedback

Nscd writes it's cache files to disk. I've seen problems with it before where it crashes starting if there's a problem reading this cache. Try deleting any files in the cache directory (should be /var/cache/nscd) and restarting nscd again.

link|improve this answer
That directory doesn't exist on the server. I tried creating it and chown'd it to the nscd user but still no luck starting the service. – Phunt Jun 15 '11 at 18:52
Try /var/db/nscd – theotherreceive Jun 15 '11 at 23:22
Ah, that's where the files are. I moved all the files out of the dir and tried starting it - it generated new files (group, passwd, and hosts) but still failed to start. – Phunt Jun 16 '11 at 7:56
Rather than using the init script, try running nscd in debug mode ('nscd -d') and see if that produces any useful error messages – theotherreceive Jun 16 '11 at 10:30
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.