We have a Debian Lenny server that runs mlocate daily to enable rapid ‘locate’ of files. A little while back it started to email me the following error:
Warning: /var/lib/mlocate/daily.lock present, not running today.
run-parts: /etc/cron.daily/mlocate exited with return code 1
Here is a thread where somebody describes experiencing similar issues with an Ubuntu system. They discuss NFS filesystems as a potential culprit although /etc/updatedb.conf should be configured not to scan them. This was the case on my system.
However, it turns out that I did have some NFS mounts from a few months ago which were never unmounted on the system of interest, even though that fileserver no longer exists.
This post describes how to force an unmount of an NFS filesystem, and in particular, if the file server is permanently gone then one can create an alias to the network interface by which the fileserver would have been reached. For example, if the server’s IP address is 192.0.2.55:
ifconfig eth0:fakenfs 192.0.2.55 netmask 255.255.255.255
umount -f should do the trick. It may be necessary to run it more than once. Once that umount was successful, all kinds of stuck mlocate / updatedb processes quickly sprang back to life and did their jobs. I simply did an
ifconfig eth0:fakenfs down to get rid of the alias, though the fileserver in my environment is gone so the system of interest will almost certainly reboot before anything cares about the former fileserver’s IP address.