dpkg-preconfigure
Preconfigure packages before installation
SYNOPSIS
dpkg-preconfigure [option] package-file ...
PARAMETERS
--help, -h
Display usage summary and exit
--version
Output version information and exit
DESCRIPTION
The dpkg-preconfigure command prepares Debian packages for installation by executing their configuration scripts ahead of time. It extracts the control archive from a .deb file, runs the package's config script using the debconf system, and populates the debconf database with default or preseed values. This enables non-interactive setups, essential for automated environments like server provisioning, chroot jails (e.g., debootstrap), or preseeded installations.
Typically invoked by dpkg during package installation when DEBCONF_FRONTEND=noninteractive, it can also be called manually on individual .deb files. The command unpacks files temporarily to /var/lib/dpkg/info/, executes the script, then cleans up. It supports preseeding via /preseed.cfg or environment variables, allowing silent configuration without user prompts.
This tool integrates tightly with debconf(7), handling templates and questions defined in the package. It's lightweight but requires the debconf package and sufficient disk space for temporary extraction.
CAVEATS
Requires debconf installed; uses temporary disk space for unpacking; only runs config scripts, not postinst or dependencies; best in non-interactive mode with preseeding.
TYPICAL USAGE
For chroot: dpkg-preconfigure /path/to/package.deb
With preseeding: DEBCONF_DB_OVERRIDE=/path/to/databases dpkg-preconfigure foo.deb
EXIT STATUS
0 on success; non-zero if config script fails or invalid package.
HISTORY
Developed as part of dpkg suite with debconf integration around Debian 3.0 (woody, 2002); evolved for better automation in unattended upgrades and containerization.
SEE ALSO
dpkg(1), dpkg-deb(1), debconf(7), debootstrap(8)


