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

FreeBSD Manual Pages


home | help
PKGDB(1)		FreeBSD	General	Commands Manual		      PKGDB(1)

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

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

     The pkgdb command is a tool to create or update the system	package	data-
     base 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	speci-
     fied 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	pack-
     age registry database when	-F is specified.  It helps you resolve stale
     dependencies, unlink cyclic dependencies, complete	stale or missing ori-
     gins and remove duplicates.  You should run this command periodically so
     portupgrade(1) and	other pkg_* tools can work effectively and reliably.

     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

     --help	   Show	help and exit.

     --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.

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

     --fix	   Interactively fix the package registry database.

		   Turn	on interactive mode.

     --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

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

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

     --noconfig	   Do not read the configuration file -

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

     --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 au-
		   tomatically update them before proceeding, so manual	updat-
		   ing is not mandatory.

     --verbose	   Turn	on verbose output.

     PKG_DBDIR	    Alternative	location for the installed package database.
		    Default is "/var/db/pkg".

     PORTSDIR	    Alternative	location for the ports tree.  Default is

     PORTS_INDEX    Alternative	location for the ports INDEX file.  Default is

     PORTS_DBDIR    Alternative	location for the ports database	files.	De-
		    fault 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

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

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

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

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

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

     The idea of pkgdb.db was taken from NetBSD.

     Akinori MUSHA <>
     Sergey Matveychuk <>

     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


Want to link to this manual page? Use this URL:

home | help