Skip site navigation (1)Skip section navigation (2)

FreeBSD Man Pages

Man Page or Keyword Search:
Man Architecture
Apropos Keyword Search (all sections) Output format
home | help
PKGDB(1)                FreeBSD General Commands Manual               PKGDB(1)

NAME
     pkgdb, pkg_which - tools to manage and search the package database

SYNOPSIS
     pkgdb [-ahfFiLOQQquv] [-o pkgname] [-s /old/new/]
     pkg_which [-hQQq] [-c pkgname] [file] ...

DESCRIPTION
     The pkgdb command is a tool to create or update the system package
     database which is used by the portupgrade(1) tool suite.  It maintains a
     hash that maps an installed file to a package name, a hash that maps a
     package to an origin, and a list of installed packages.

     pkg_which looks in the package database to tell which package each
     specified file came from.  If the database is outdated but you do not
     have permission to update it, it delegates tasks to pkg_info(1).

     Actually, pkgdb and pkg_which are the same command, and are equivalent.

     The pkgdb command also works as an interactive tool for fixing the
     package registry database when -F is specified.  It helps you resolve
     stale dependencies, unlink cyclic dependencies, complete stale or missing
     origins and remove duplicates.  You should run this command periodically
     so portupgrade(1) and other pkg_* tools can work effectively and
     reliably.

OPTIONS
     The following command line arguments are supported:

     file          Inquire which package file came from.  If the file is not
                   present, pkg_which calls which(1) to search PATH for the
                   file.

     -h
     --help        Show help and exit.

     -a
     --auto        Turn on automatic mode when -F is also specified.  pkgdb
                   only fixes discrepancies that can be fixed securely and
                   leaves the others.

     --autofix     Shorthand of --auto --fix (-aF).

     -c PKGNAME
     --collate PKGNAME
                   Show files installed by the given package that have been
                   overwritten by other packages.

     -f
     --force       Force; Specified with -u, update database regardless of
                   timestamps.  Specified with -F, fix "held" packages too.

     -F
     --fix         Interactively fix the package registry database.

     -i
     --interactive
                   Turn on interactive mode.

     -L
     --fix-lost    Check and restore lost dependencies against the ports tree.

     -o PKGNAME
     --origin PKGNAME
                   Look up the origin of the given package in the package
                   database.

     -O
     --omit-check  Specified with -F, turn off check dependencies against the
                   ports tree.  Useful if you need a speed-up.

     -Q
     --quiet       Do not write anything to stdout.  Specified twice, do not
                   write anything to stderr either.  This is for internal use.

     -q
     --noconfig    Do not read the configuration file -
                   $PREFIX/etc/pkgtools.conf.

     -s /OLD/NEW/
     --substitute /OLD/NEW/
                   Substitute all the dependencies recorded as OLD with NEW
                   and exit.

     -u
     --update      Update or create the package database file pkgdb.db in
                   $PKG_DBDIR, which is /var/db/pkg by default.

                   Note: if the ports database files are stale, pkgdb will
                   automatically update them before proceeding, so manual
                   updating is not mandatory.

     -v
     --verbose     Turn on verbose output.

ENVIRONMENT
     PKG_DBDIR      Alternative location for the installed package database.
                    Default is ``/var/db/pkg''.

     PORTSDIR       Alternative location for the ports tree.  Default is
                    ``/usr/ports''.

     PORTS_INDEX    Alternative location for the ports INDEX file.  Default is
                    ``$PORTSDIR/INDEX''.

     PORTS_DBDIR    Alternative location for the ports database files.
                    Default is ``$PORTSDIR''.  The database files in the
                    directory are automatically created or updated as
                    necessary.  See portsdb(1) for details.

     PKGTOOLS_CONF  Configuration file for the pkgtools suite.  Default is
                    ``$PREFIX/etc/pkgtools.conf''.

FILES
     /var/db/pkg                Default location of the package database.

     $PREFIX/etc/pkgtools.conf  Default location of the pkgtools configuration
                                file.

EXAMPLES
     +o   Get a list of files under /usr/local and /usr/X11R6 that do not
         belong to any package:

               find /usr/local /usr/X11R6 -type f -print0 | xargs -0 pkg_which
               -v | fgrep '?'

SEE ALSO
     portsclean(1), portsdb(1), portupgrade(1), pkgtools.conf(5), ports(7)

HISTORY
     The idea of pkgdb.db was taken from NetBSD.

AUTHORS
     Akinori MUSHA <knu@iDaemons.org>
     Sergey Matveychuk <sem@FreeBSD.org>

BUGS
     Sometimes a database may get corrupt, and the pkgtools commands may abort
     with a segmentation fault.  In such cases, run ``pkgdb -fu'' to rebuild
     the database, and the problems should go away.

FreeBSD                        February 23, 2007                       FreeBSD

NAME | SYNOPSIS | DESCRIPTION | OPTIONS | ENVIRONMENT | FILES | EXAMPLES | SEE ALSO | HISTORY | AUTHORS | BUGS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=pkgdb&sektion=1&manpath=FreeBSD+10.3-RELEASE+and+Ports>

home | help