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 "/")
Best Answer
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, theupdatedb
man page isn't recorded in the list of alternatives, only thelocate
executable, thelocate
man page and theupdatedb
executable are. This is because theupdatedb
man pages are in a different section: findutils puts it in section 1 but mlocate puts it in section 8. Thusman 1 updatedb
shows theupdatedb(1)
man page, because it's the onlyupdatedb
man page in section 1. Andman 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 forupdatedb
in the same section, and mlocate should declare an alternative for its man page; since mlocate putsupdatedb
in/usr/bin
, its man page should be in section 1. As things stand, you can see the man page for the mlocateupdatedb
withman 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 runupdatedb --database-root / --database-root /frodo/lib/modules/3.12.3-031203-generic/kernel
.