4

I am attempting to update a single directory I created. I'm using updatedb so it will be found by the locate command.

Command used:
updatedb --localpaths='/frodo/lib/modules/3.12.3-031203-generic/kernel'

Output:
updatedb: unrecognized option '--localpaths=/frodo/lib/modules/3.12.3-031203-generic/kernel'

Same result with:

updatedb --localpaths=  
updatedb: unrecognized option '--localpaths='

From man updatedb:

   --localpaths='path1 path2...'
          Non-network directories to put in the database.  Default is /.

Why does it give this error when --localpaths is clearly stated as an option?


Sytem info:

updatedb --version
updatedb (mlocate) 0.26
Copyright (C) 2007 Red Hat, Inc. All rights reserved.
This software is distributed under the GPL v.2.

This program is provided with NO WARRANTY, to the extent permitted by law.

lsb_release -a
LSB Version:  core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:
core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-
noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID:   Ubuntu
Description:  Ubuntu 13.10
Release:  13.10
Codename: saucy

uname -r
3.12.3-031203-generic

Edit: I have had success with updatedb -U /frodo/lib/modules/3.12.3-031203-generic/kernel, but I would still like to know why the --localpaths from the manual is not recognized.

This alternative option is not in the manual, but found with updatedb -h.

   -U, --database-root PATH       the subtree to store in database 
(default "/")
3
  • I think it would be better if you share your OS name and updatedb version. ( updatedb --version )
    – Esref
    Commented Apr 18, 2015 at 14:02
  • This user has the same version of updatedb, yet the selected answer seems to have worked: unix.stackexchange.com/questions/151700/…
    – iyrin
    Commented Apr 18, 2015 at 14:12
  • 1
    If there's some discrepancy with the same application version between distributions, I'd suggest filing a bug by the distribution that exhibits the odd behaviour so the package maintainer is aware of the issue, Ubuntu in this case. Might be a mistake in packaging man pages with the wrong binaries. Just a guess.
    – user86969
    Commented Apr 18, 2015 at 18:34

1 Answer 1

5

There are two popular implementations of updatedb. One of them is from GNU findutils. Another is mlocate. They support different command line options and configuration files, especially for the updatedb program.

It appears that the updatedb command on your system is the one from mlocate but the man page is the one from findutils. Normally, Ubuntu has a system (inherited from Debian) called alternatives which ensures that when there are multiple implementations of a program, the choice of program and the choice of man page are consistent. However, in this case, the updatedb man page isn't recorded in the list of alternatives, only the locate executable, the locate man page and the updatedb executable are. This is because the updatedb man pages are in a different section: findutils puts it in section 1 but mlocate puts it in section 8. Thus man 1 updatedb shows the updatedb(1) man page, because it's the only updatedb man page in section 1. And man updatedb shows the man page in section 1 because that's the first section with a match. Arguably, that's a packaging bug in mlocate: the findutils and mlocate package maintainers should agree to put the man pages for updatedb in the same section, and mlocate should declare an alternative for its man page; since mlocate puts updatedb in /usr/bin, its man page should be in section 1. As things stand, you can see the man page for the mlocate updatedb with man 8 updatedb.

The mlocate implementation of updatedb doesn't have an option that's exactly equivalent to findutils's --localpaths. You can create a separate database and specify what subtree it contains with the --database-root option, or run updatedb --database-root / --database-root /frodo/lib/modules/3.12.3-031203-generic/kernel.

4
  • Well done! It is indeed using the mlocate version whose documentation is at updatedb(8).
    – iyrin
    Commented Apr 18, 2015 at 23:15
  • If you want to change from an implementation to another one, you must to execute (in Debian and derivatives) update-alternatives --config locate, and select the desired alternative to locate. Commented Mar 19, 2018 at 17:58
  • @AndrésMorales You can do that, but you don't have to. You can call e.g. mlocate explicitly if you want. This lets you choose your locate implementation even if you don't have root access which is required to run update-alternatives. Commented Mar 19, 2018 at 21:57
  • @Gilles Yes, it's correct, but if your default alternative is mlocate you must to type locate.findutils to use the another one. Commented Mar 19, 2018 at 22:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .