Quantcast Solved: Locate command not working in Linux SSH, "No such file or directory" - digitalFAQ Forum
Go Back    Forum > Digital Publishing / Web Sites > Web Hosting Tutorials > SSH for VPS/Dedicated (CLI)

Reply
 
LinkBack Thread Tools
  #1  
07-23-2011, 05:09 AM
kpmedia's Avatar
kpmedia kpmedia is offline
Site Staff | Web Hosting, Photo
 
Join Date: Feb 2004
Posts: 4,297
Thanked 360 Times in 334 Posts
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.


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!

- Did my advice help you? Then become a Premium Member and support this site.
- Please Like Us on Facebook | Follow Us on Twitter

- Need a good web host? Ask me for help! Get the shared, VPS, semi-dedicated, cloud, or reseller you need.
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
07-25-2011, 04:30 AM
kpmedia's Avatar
kpmedia kpmedia is offline
Site Staff | Web Hosting, Photo
 
Join Date: Feb 2004
Posts: 4,297
Thanked 360 Times in 334 Posts
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.

- Did my advice help you? Then become a Premium Member and support this site.
- Please Like Us on Facebook | Follow Us on Twitter

- Need a good web host? Ask me for help! Get the shared, VPS, semi-dedicated, cloud, or reseller you need.
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Recommendations to transfer video from capture PC to main PC? GroverXpup Project Planning, Workflows 3 11-24-2017 05:13 PM
How to find the full path to your server directory, using a PHP file admin Website and Server Troubleshooting 0 10-18-2010 02:34 AM
Add HTML option to vBulletin 3.x "Send Email to Users" admincp admin Website and Server Troubleshooting 0 04-28-2010 08:29 AM
Possible to make a "working" DVD Menu with DVD Menu Studio? admin Author, Make Menus, Slideshows, Burn 0 04-06-2010 01:08 AM

Thread Tools



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