# locate Command Not Working Properly



## Persephone (Aug 9, 2012)

At some point over the past few months my locate command stopped working correctly.

/etc/defaults/periodic.conf has the correct setting to update the database:

```
# 310.locate
weekly_locate_enable="YES"                              # Update locate weekly
```

/var/db/locate.database was updated a few days ago or least touched in some way.

locate -S looks reasonable:

Database: /var/db/locate.database

```
Compression: Front: 23.04%, Bigram: 57.05%, Total: 16.10%
Filenames: 9964, Characters: 359682, Database size: 58163
Bigram characters: 24979, Integers: 184, 8-Bit characters: 0
```

Some searches work:

```
$ locate root
/compat/linux/usr/sbin/chroot
/compat/linux/usr/share/man/man1/chroot.1.gz
/etc/mtree/BIND.chroot.dist
/etc/mtree/BSD.root.dist
/etc/rc.d/root
```

But almost all searches come up empty.

Any ideas what may have gone wrong?


----------



## fbsd1 (Aug 9, 2012)

The locate command does not locate system files by design.
Try this;

```
cd / 
/usr/libexec/locate.updatedb
```
Then the locate db will have info on complete system.


----------



## Persephone (Aug 9, 2012)

Thank you.

Ok, running

```
$ cd /
$ sudo /usr/libexec/locate.updatedb
```

and the locate can find everything on the drive now. Any idea why the weekly periodic isn't working? I don't believe I have ever manually updated the database myself and in the past it was properly indexing the entire drive.


----------

