Warning: /var/lib/mlocate/daily.lock present, not running today.

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

ifconfig eth0:fakenfs netmask

Then, 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.


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s