LinuxCommandLibrary

dpkg-reconfigure

Reconfigure an already installed package

TLDR

Reconfigure one or more packages

$ dpkg-reconfigure [package1 package2 ...]
copy

SYNOPSIS

dpkg-reconfigure [option...] package...

Common options:
--frontend=frontend-name
--priority=priority
--no-defaults
--force

PARAMETERS

package...
    One or more names of installed packages to reconfigure. These are the packages whose configuration scripts will be re-executed.

--frontend=frontend-name
    Specifies the debconf frontend to use for presenting questions. Popular choices include dialog (default, curses-based), readline (command-line), noninteractive (uses defaults without interaction), editor (opens questions in an editor), and gnome/kde (graphical).

--priority=priority
    Specifies the minimum priority of questions to display. Valid priorities are low, medium, high, and critical. By default, only important questions (high priority) are shown, suppressing less critical or trivial prompts.

--no-defaults
    Causes debconf to not use the default answers for questions. This forces the user to explicitly answer every question, even if a sensible default exists.

--force
    Force reconfiguration even if debconf thinks the package is already configured, or if there are warnings during the process.

-p, --priority=priority
    Shorthand alias for --priority.

-f, --frontend=frontend-name
    Shorthand alias for --frontend.

--help
    Display a brief help message and exit.

--version
    Display the version information and exit.

DESCRIPTION

dpkg-reconfigure is a utility that allows system administrators to reconfigure an already installed Debian package. When a package is installed, its postinst script (post-installation script) often uses the debconf system to ask questions and configure various settings, such as network interfaces, service ports, or timezone information.

dpkg-reconfigure essentially re-runs this configuration step for the specified package(s), presenting the same questions as during the initial installation. This is useful for changing settings after installation, recovering from a corrupted debconf database, or automating configuration in scripts by combining it with debconf-set-selections. It provides a consistent interface for adjusting package-specific options without needing to reinstall the package or manually edit configuration files. It is an integral part of the dpkg suite of tools, deeply integrated with debconf.

CAVEATS

  • Requires root privileges (or sudo) to execute, as it modifies system-wide package configurations.
  • Only works for packages that are already installed on the system. It cannot install, upgrade, or remove packages.
  • Relies heavily on the debconf system. If a package's post-installation script does not utilize debconf for configuration, dpkg-reconfigure may have no effect or offer no interactive questions.
  • Some packages may not have any configurable options or may configure themselves automatically without user intervention, even if they use debconf.
  • It does not guarantee that all configuration files will be automatically updated; some manual intervention might still be required for complex changes not covered by debconf questions.

INTERACTION WITH DEBCONF

dpkg-reconfigure primarily acts as a wrapper around a package's configuration script, which is typically its postinst script. This script, when executed by dpkg-reconfigure, interacts with the debconf system. debconf is responsible for presenting questions to the user (via the chosen frontend), storing the answers, and providing them back to the configuration script. This separation allows for flexible configuration (interactive, non-interactive, pre-seeded) and ensures consistency.

COMMON USE CASES

This command is frequently used for:

  • Changing the timezone (e.g., sudo dpkg-reconfigure tzdata).
  • Reconfiguring locales (e.g., sudo dpkg-reconfigure locales).
  • Adjusting keyboard layouts (e.g., sudo dpkg-reconfigure keyboard-configuration).
  • Modifying critical server settings (e.g., for postfix, apache2, mysql-server) after initial setup.
  • Repairing a configuration where debconf state might be inconsistent or corrupted.

HISTORY

dpkg-reconfigure is an essential component of the Debian package management system, dpkg, which was first developed in the mid-1990s as the foundational tool for managing .deb packages. While dpkg itself handles the low-level package installation and removal, the need for a standardized, user-friendly way to configure packages post-installation led to the development of debconf in the early 2000s. dpkg-reconfigure was specifically designed to leverage debconf, providing a convenient interface to re-run the configuration scripts of installed packages. Its functionality has remained largely consistent since its introduction, serving as a critical utility for system administrators to adjust package settings without needing to reinstall or manually edit numerous configuration files, thereby standardizing the configuration process across the Debian ecosystem.

SEE ALSO

Copied to clipboard