Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

On a new Ubuntu 10.4 instance, I tried to use the locate command only to receive the error

locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory

from using this command on other systems I'm guessing that this means the database has not yet been built (it is a fresh install). I believe it is supposed to run daily, but how would I queue it up to run immediately?

Also, how is "run daily" determined? If I have a box that I only turn on for an hour at a time will the database ever be built on it's own?

share|improve this question

1 Answer 1

up vote 15 down vote accepted

The cron job is defined in /etc/cron.daily/mlocate.

To run it immediately:

sudo updatedb

or better

sudo ionice -c3 updatedb

This is better because updatedb is set in the Idle I/O scheduling class, so that it do not disturb (from the I/O point of view) other applications. From ionice man page:

  -c class
          The scheduling class. 0 for none, 1 for real time, 2 for 
          best-effort, 3 for idle.

  ........................

  Idle   A program running with idle io priority will only get disk time
         when no other  program  has  asked  for disk io for a defined 
         grace period. The impact of idle io processes on normal system 
         activity should be zero. This scheduling class does not take a 
         priority argument. Presently, this scheduling class is permitted 
         for an ordinary user (since kernel 2.6.25).
share|improve this answer
    
Thanks. Why is the second one better? –  cwd Dec 6 '11 at 17:24
    
@cwd: see updated answer. –  enzotib Dec 6 '11 at 17:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.