When NetworkManager changes /etc/resolv.conf, it wants to inform nscd (the service that caches dns names, among others). Most distribution backends in NetworkManager just do "/usr/sbin/nscd -i hosts", which invalidates the hosts cache. But the Gentoo backend for some reason stops nscd entirely with "/usr/bin/killall -q nscd". There is code for restarting it, but is under "#ifdef NM_NO_NAMED" which seems to me is never defined. That makes it impossible to use nscd with NetworkManager. For example, nscd will be killed whenever a connection is lost or made, and when NetworkManager exits. The init script reports that nscd crashed when this happens. I've made a patch to invalidate nscd's cache rather than stopping it (it is not needed to check if nscd is running, in that case the program will just do nothing). Reproducible: Always Steps to Reproduce: 1. /etc/init.d/nscd start 2. /etc/init.d/NetoworkManager start 3. /etc/init.d/NetoworkManager stop 4. /etc/init.d/nscd status Actual Results: * status: crashed Expected Results: NetworkManager shouldn't kill nscd.
Created attachment 217076 [details, diff] patch to not stop nscd
The Gentoo backend seems to kill any loose nscd instances only when it finds no instance was started by the init.d script. So if nscd was running on your system because you really wanted it to, then it would restart the service. You could argue that it (the init.d script) should learn to invalidate the cache (the reload command is often used in that case) so that the service does not need to be restarted. After that you could change the nm backend to reflect that.
(In reply to comment #2) > The Gentoo backend seems to kill any loose nscd instances only when it finds no > instance was started by the init.d script. So if nscd was running on your > system because you really wanted it to, then it would restart the service. No, this is not what it does. Take a look at the code: void nm_system_update_dns (void) { #ifdef NM_NO_NAMED if (nm_spawn_process ("/etc/init.d/nscd status") == 0) nm_spawn_process ("/etc/init.d/nscd restart"); #else nm_spawn_process("/usr/bin/killall -q nscd"); #endif } Seeing that NM_NO_NAMED is never defined, it can be concluded that it always kills nscd, no matter what started it. > You could argue that it (the init.d script) should learn to invalidate the > cache (the reload command is often used in that case) so that the service does > not need to be restarted. After that you could change the nm backend to reflect > that. nscd doesn't have a reload command. It supports invalidating a specific cache (e.g. the hosts cache), and this is done by connecting to the nscd server, rather than with a signal. As nscd is designed to run as a single instance (it is hardcoded to use /var/run/nscd/socket), it always correct to do "/usr/sbin/nscd -i hosts". Nothing would benefit adding a reload command to the init script that does just that.
Created attachment 219321 [details, diff] Clear nscd hosts cache if nscd is installed. I think it would be better to add one extra if.
Created attachment 220679 [details, diff] Clear nscd hosts cache if nscd is installed. I submitted that patch upstream
I'll be adding 0.8 to the tree very soon (once upstream make an official announcement) with this patch included.
already committed upstream: http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=2183af36b6cb06d7d686f8e7913b63983cd3a172 courtesy of Alexander Sack
Included with Networkmanager-0.8