How to Reconfigure Installed Packages on Debian 11

How to Reconfigure Installed Packages on Debian 11

Are you looking for a tutorial on how to reconfigure installed packages on Debian 11? Then this guide is for you.

We can reconfigure installed packages using a tool called dpkg-reconfigure on Debian-based systems. It’s an excellent way to tweak and customize packages to suit your needs better. 

Default settings may not always be the best fit for your workflow. Working with subpar package configurations can be frustrating. And by reconfiguring your setting, you can have a more efficient and personalized experience.

So let’s get started!

How to Reconfigure Installed Packages on Debian 11

We’ve divided this tutorial into a few sections so you can navigate through the process and understand how it goes. Let’s walk you through each step.

Check Current Configurations of a Package

First, let’s check out the current configuration of a package. We will do that by querying the debconf database. And to do so, you have to run this command:

$ sudo debconf-show [package name]

For this tutorial, we will reconfigure phpmyadmin. So the command will look like this:

$ sudo debconf-show phpmyadmin

Output:

check current configuration

What you can see above are the current configurations of the phpmyadmin package. And referring to this screenshot, you can see the current values of all the items. The star marks mean those queries that are already asked.

If you don’t see any output after running the command, it means the package is not installed on your device. So install it before running debconf-show.

Reconfigure Installed Package

After seeing the present configuration, let’s start reconfiguring it. To do that, run this command:

$ sudo dpkg-reconfigure [package name]

And in this conjunction with this tutorial, our command should look like this:

$ sudo dpkg-reconfigure phpmyadmin

Output:

How to Reconfigure Installed Packages on Debian 11

This will start the reconfiguration process, as shown in the screenshot above. We are being asked to configure phpmyadmin, which was our target package. Let’s go through the whole process and reconfigure it.

We will press ‘OK’ and go to the next screen. Don’t forget to read the text and understand the warnings.

In the next screen, you’re asked whether you want to reinstall the database for phpmyadmin. Since we’ll be reconfiguring it, choose ‘Yes’.

reconfigure phpmyadmin

To show you that we are tweaking the old configurations and making new ones, we will choose different settings from the previous examples. As you can see below, we are choosing TCP/IP as the connection method instead of Unix Socket.

reconfigure phpmyadmin

After that, we will create a new host for the database server.

reconfigure phpmyadmin

As an example, we’ll name it Distroid.

reconfigure phpmyadmin

Then, we set the port number. You may leave this to use the default port.

reconfigure phpmyadmin

The next step is to set the authentication method. In this case, we will go with Default.

reconfiguring phpmyadmin

After that, we need to give a name for the database. We will set it to phpmyadmin.

reconfiguring phpmyadmin

Next, we set a username for phpmyadmin.

reconfiguring phpmyadmin

Once you’ve typed in the username, we will create the password for our MySQL database. After that, you need to confirm it.

reconfiguring phpmyadmin

When that’s done, we need to provide an account for performing administrative actions on the package. We name it ‘root’.

reconfiguring phpmyadmin

In this step, we choose a web server that is already configured to run phpmyadmin There are two options—Apache2 and Lighttpd

reconfiguring phpmyadmin

After the reconfiguration, we get the below output:

How to Reconfigure Installed Packages on Debian 11

Check Package After Reconfiguration

After finishing the process, let’s check if we changed its configurations or not. To determine that, run this command:

$ sudo debconf-show [package name]
$ sudo debconf-show phpmyadmin

Output:

check current configuration

If you match this photo with the earlier one in this post, you will be able to notice the differences. The latest one contains the configurations we set now. That means we’ve reconfigured this package on our Debian 11 system.

Useful Options for Customized Reconfiguration

Till now, we’ve shown you the most obvious way to reconfigure a package on Debian. But by adding different flags to the commands, you can have more control over the process. Let us show you some examples.

-ftype, –frontend=type

This flag determines which front end you want to use. Some examples are Dialog, Readline, Gnome, KDE, Editor, and non-interactive. You can change the default front end with this command:

$ sudo dpkg-reconfigure debconf

To change the front end, you add the argument after the flag, like this:

$ sudo dpkg-reconfigure -f readline phpmyadmin

-pvalue, –priority=value

This flag will help you decide which questions to answer to which ones to ignore by setting a priority. You can set it to critical, high, medium, or low. The lesser priority questions than the option you choose will get ignored. You use this flag in this format:

$ sudo dpkg-reconfigure -p critical phpmyadmin

You can also use –default-priority to set the default priority instead of using low as the value.

–force

This forces the dpkg-reconfigure command to complete the reconfiguration even if the package in question is in a broken state or is inconsistent. The syntax is as follows:

$ sudo dpkg-reconfigure -f [package name]

However, remember to use this flag sparingly and with caution.

-a, –all

This option will reconfigure all installed packages that use debconf. It may take a long time to finish though.

-u, –unseen-only

This parameter makes sure that only questions not seen are asked instead of showing everything.

After reconfiguring, you can also display the new configuration in different ways by adding parameters to debconf-show.

–db=dbname

The default option is to query the main database. This flag specifies which database to query. The command looks like this:

$ sudo debconf-show [package name] [...] [--db=dbname]

–listowners

This is used to list the owners of configuration files and templates that use debconf. Use the flag like this:

$ sudo debconf-show --listowners [--db=dbname]

–listdbs

This option’s used to list the available debconf databases. It’s run in the following way:

$ sudo debconf-show --listdbs

Final Thoughts

This guide covers how to reconfigure installed packages on Debian 11. We hope you were able to follow through with all the steps we laid out earlier. Although we used a specific example package to show how it’s done, you can apply what we’ve talked about to any package. And last but not least, we showed other useful options to use with the flag.

And that’s it for this tutorial. If you’re still facing some problems, feel free to let us know in the comments below.

If this guide helped you, please share it.

Related Posts