“Warning: /var/lib/mlocate/daily.lock present”

I am still fixing small issues as they appear in my home setup. Right now I have a file server running FreeNAS named capella.home and a virtualization box running Proxmox named andromeda.home.

I configured andromeda to map a NFS share from capella as a repository for images and templates and for backups to be saved as well. Everyday andromeda performs full backups of all my VMs but to conserve power and to preserve the hardware I turn capella off whenever I’m travelling and every single time I was getting multiple warning e-mails with the message:

Warning: /var/lib/mlocate/daily.lock present, not running updatedb.
run-parts: /etc/cron.daily/mlocate exited with return code 1

This message was being sent both from andromeda and multiple VMs hosted inside it.

At first I thought that this was somehow due to auto-upgrade issues, even scheduled my VM host to auto reboot every couple days to see if it would avoid it (terribly bad practice, I know) with no success.

It turns out this was happening because the NFS server was offline and mlocate was trying to index it, so I adapted my puppet base recipe to include the following:

# locate, mlocate and updatedb

# Limit where updatedb scans
file {'/etc/updatedb.conf':
  ensure  => 'present',
  owner   => 'root',
  group   => 'root',
  source  => 'puppet:///etc/base/updatedb.conf'

and borrowed the contents of updatedb.conf from :

PRUNENAMES=".git .bzr .hg .svn"
PRUNEPATHS="/tmp /var/spool /media"
PRUNEFS="NFS nfs nfs4 rpc_pipefs afs binfmt_misc proc smbfs autofs iso9660 ncpfs coda devpts ftpfs devfs mfs shfs sysfs cifs lustre_lite tmpfs usbfs udf fuse.glusterfs fuse.sshfs ecryptfs fusesmb devtmpfs"

And that is it!