digitalFAQ.com Forum

digitalFAQ.com Forum (https://www.digitalfaq.com/forum/)
-   Web Hosting (https://www.digitalfaq.com/forum/web-hosting/)
-   -   Solved: Locate command not working in Linux SSH, "No such file or directory" (https://www.digitalfaq.com/forum/web-hosting/3310-solved-locate-command.html)

kpmedia 07-23-2011 05:09 AM

Solved: Locate command not working in Linux SSH, "No such file or directory"
 
If you run into this error when using the locate command:
Code:

root@server6:~# locate index.html
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory

Here's the easy fix:
Code:

root@server6:~# updatedb
Just run updatedb and it will repair the problem.

What is updatedb? Updatedb updates file name databases used by GNU locate.
What is locate? Locate searches through a prebuilt database of files, and is significantly faster than find. However, it requires the database to be updated regularly.

My specific problem did not start until I stopped using root SSH logins, opting to instead "su -" to the root user after logging in from an alternate account. (This is done for safety, of course. Disallowing root SSH access prevents brute force hacking attempts on common defaults usernames -- i.e., "root".) This happened on an Ubuntu 10.10 server running ISPConfig 3.

Easy fix, simple issue. :thumb:


Need a good VPS host? See our non-spammy List of top quality VPS web hosting providers.
Servers always have problems. Having a good hosts helps prevent/avoid them!

kpmedia 07-25-2011 04:30 AM

Here's another example, from a CentOS 5 x86_64 server running Plesk 9 in a Virtuozzo VPS container.

I was trying to locate any file/folder with the name "bind", by typing in locate bind

Code:

[root@server ~]# locate bind
locate: can not open `/var/lib/mlocate/mlocate.db': No such file or directory

The fix from the first post also does not work: updatedb will hang.
In this scenario, a required package is not installed.

Type rpm -q mlocate vixie-cron anacron to see what's installed vs what's missing.

Code:

[root@server mlocate]# rpm -q mlocate vixie-cron anacron
mlocate-0.15-1.el5.2
vixie-cron-4.1-77.el5_4.1
package anacron is not installed

Anacron needs to be installed. That's best done with yum.
Note that by default Plesk disables yum, so the host will have to enable it manually.

Anacron RPM can be located here: http://rpm.pbone.net/index.php3/stat...86_64.rpm.html
Among other places.


All times are GMT -5. The time now is 04:04 AM

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.