How to fix: locate: can not open `/var/lib/mlocate/mlocate.db’: No such file or directory

February 14, 2009 - 2:29 pm 3 Comments

In the first of my “How to fix” posts where I detail how I fix various issues I run into, this is a simple one:

[root@vps etc]# locate courier
locate: can not open `/var/lib/mlocate/mlocate.db': No such file or directory

OK, so the mlocate.db file doesn’t exist, marvellous.  How do we either find it or create it?
Answer: simply run updatedb

[root@vps etc]# updatedb

Now we can do our search:

[root@vps etc]# locate courier
/etc/profile.d/courier-imap.csh
/etc/profile.d/courier-imap.sh
/etc/rc.d/init.d/courier-authlib
/etc/rc.d/init.d/courier-imap
/etc/rc.d/rc0.d/K30courier-imap
/etc/rc.d/rc0.d/K85courier-authlib
/etc/rc.d/rc1.d/K30courier-imap
...

3 Responses to “How to fix: locate: can not open `/var/lib/mlocate/mlocate.db’: No such file or directory”

  1. hello Says:

    Thanks , not sure why but i had to run it with root permissions

    sudo updatedb

  2. psynnott Says:

    I think it’s because of the location of the mlocate.db file? I could be wrong though.

  3. Rod Bianes Says:

    Thank you. I’m new to Linux OS and solution works!

Leave a Reply