updatedb: can not open a temporary file for `/var/lib/mlocate/mlocate.db'
You have to run the updatedb command as the super user. For example,
sudo updatedb
If you lack time and want to locate a file,
you don't need to sudo updatedb
in order to update cache.
Instead, you can use locate -e filename
to skip cache.