The nscd.prerm script should cleanup the caches
nscd -i {group,hosts,netgroup,passwd,services}
rm -f /var/cache/nscd/{group,hosts,netgroup,passwd,services}
to invalidate and remove all caches, before the service is stopped
and removed.
The nscd -i is necessary to tell running processes about the change.
They might keep these cache files open with a local file descriptor,
even if they are erased.
You might want to consider to move /var/cache/nscd to /run.
Regards
Harri
control: tag -1 + moreinfo Hi, What is the reason to remove the cache in the prerm? The cache is removed in the postrm when the --purge option is used, as specified by the policy. The nscd process is stopped before the package is removed (in the prerm), so it will stop using those cache files when the postinst script is ran. /run is a tmpfs filesystem backed by RAM, which might be limited, and thus not designed to hold caches. While on most system the nscd cache is relatively small, it might get relatively big on some system. Regards, Aurelien
The caches have to be invalidated before nscd is removed, because after removing nscd (the binary) you cannot run "nscd -i" anymore. The cache files have to be removed to make sure that new jobs ignore the caches completely. A general problem with nscd is that running jobs continue to use the caches, even though nscd is gone. Sample: # lsof | grep nscd | wc -l 474 # systemctl stop nscd # lsof | grep nscd | wc -l 56 See that its not even close to 0? Obviously some jobs didn't recognize that nscd has been stopped. Running nscd -i and removing the caches is all the nscd maintainer script could do. About /run: /var/cache/nscd is appr 1MByte on the hosts I checked. This is the perfect size to store it RAM. The caches are mapped into memory, anyway. Please check the output of lsof | grep nscd It says "mem" in the FD column. There is no reason to store the caches on SSD or rusty disks. Regards Harri