Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
How to Reconfigure Installed Package in Ubuntu and Debian?
Ubuntu and Debian users can easily modify or restore the configuration settings of an installed package with the dpkg-reconfigure command. This command works in tandem with debconf, the configuration system for Debian packages, and allows users to retrieve settings, modify configurations, and troubleshoot issues. By answering a series of configuration questions similar to those presented during installation, users can change the settings of a package without uninstalling and reinstalling it.
Viewing Current Package Configuration
The debconf-show command allows you to view the current configuration settings of any installed package. This is useful for troubleshooting or understanding how a package is currently configured before making changes.
$ sudo debconf-show phpmyadmin
* phpmyadmin/dbconfig-install: boolean true * phpmyadmin/reconfigure-webserver: boolean true * phpmyadmin/dbconfig-upgrade: boolean true * phpmyadmin/mysql/admin-pass: password [hidden] * phpmyadmin/mysql/app-pass: password [hidden] * phpmyadmin/app-password-confirm: password [hidden] * phpmyadmin/password-confirm: password [hidden] * phpmyadmin/db/app-user: string phpmyadmin * phpmyadmin/db/dbname: string phpmyadmin * phpmyadmin/dbconfig-remove: boolean false * phpmyadmin/remote/host: string * phpmyadmin/upgrade-backup: boolean true * phpmyadmin/db/basepath: string * phpmyadmin/internal/skip-preseed: boolean false * phpmyadmin/install-error: select * phpmyadmin/dbconfig-common: boolean true * phpmyadmin/missing-db-package-error: select
Reconfiguring Installed Packages
The dpkg-reconfigure command allows you to modify package configuration settings through an interactive interface. This saves time and effort while minimizing the risk of data loss compared to uninstalling and reinstalling packages.
$ sudo dpkg-reconfigure phpmyadmin
The command will present an interactive dialog where you can modify various settings
Please select the web server that should be automatically configured to run phpMyAdmin:
1. Apache2
2. Nginx
3. Lighttpd
4. None
Select the web server to reconfigure: 1
Configuring phpMyAdmin for Apache2...
Please enter the MySQL application password for phpmyadmin:
Configure database for phpmyadmin with dbconfig-common? Yes / No: Yes
Please enter the password that will be used for the phpmyadmin database:
Creating a phpmyadmin database...
Configuring database...
Setting up phpmyadmin...
phpMyAdmin has been installed and configured successfully.
Customizing Reconfiguration Behavior
Using Different Frontend Interfaces
You can specify which frontend interface to use during reconfiguration with the -f flag. Available options include dialog, readline, and noninteractive.
$ sudo dpkg-reconfigure -f readline phpmyadmin
Creating config file /etc/phpmyadmin/config-db.php with new version chown: changing ownership of '/var/lib/phpmyadmin/tmp': Operation not permitted chown: changing ownership of '/var/lib/phpmyadmin/session': Operation not permitted Reloading web server config: apache2.
Setting Question Priority Levels
Use the -p option to set a minimum priority level for configuration questions. Only questions at or above the specified priority will be asked. Priority levels include low, medium, high, and critical.
$ sudo dpkg-reconfigure -p critical phpmyadmin
Configuring phpmyadmin package with critical priority... debconf: unable to initialize frontend: Dialog debconf: (Dialog frontend requires a screen at least 13 lines tall and 31 columns wide.) debconf: falling back to frontend: Readline
Configuring Debconf Defaults
To permanently change the default frontend or priority settings for all package configurations, reconfigure the debconf package itself
$ sudo dpkg-reconfigure debconf
Common Use Cases
| Scenario | Command | Purpose |
|---|---|---|
| View current settings | debconf-show package |
Check configuration before changes |
| Standard reconfiguration | dpkg-reconfigure package |
Modify package settings interactively |
| Non-interactive mode | dpkg-reconfigure -f noninteractive package |
Automated scripts and batch operations |
| Critical questions only | dpkg-reconfigure -p critical package |
Minimal configuration changes |
Accessing Manual Documentation
For comprehensive information about all available options and examples, consult the manual page
$ man dpkg-reconfigure
The manual page provides detailed documentation on command usage, available frontends, priority levels, and practical examples for system administrators.
Conclusion
The dpkg-reconfigure command is an essential tool for Ubuntu and Debian system administration, allowing efficient modification of package configurations without reinstallation. Combined with debconf-show for viewing current settings and various customization options, it provides flexible package management capabilities for both interactive and automated environments.
