how can I upgrade or re-install a package if I have misconfigured it in the past

Asked by bandara on 2010-09-17

Original question: cant unstall mysql server after change config file i want to install mysql again help me

What this means, I believe, is that mysql on this particular system was misconfigured, and so when trying to restart mysql, dpkg failed. The original poster would like to know how to force dpkg to install the config files from the package instead of leaving the broken configs installed.

Question information

English Edit question
Ubuntu Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
bandara (nwadmin) said :
Revision history for this message
Clint Byrum (clint-fewbar) said :

Hello bandara,

This is really a question, not a bug, as dpkg is supposed to leave config files alone if you have changed them.

Revision history for this message
Clint Byrum (clint-fewbar) said :

If this occurs, there are two options.

You can either choose to purge the config files before re-installing the package. This is done by running

dpkg --purge packagename

Or you can force dpkg to ignore your existing config files with

dpkg --force-confnew --install /path/to/file.deb

This latter method will require that you know where your debs are, and both assume you know the exact package that contains the config file.

The packagename can be determined with

dpkg -S /path/to/configfile

And the .deb will be in /var/cache/apt/archives if you downloaded it using apt, synaptic package manager, or aptitude.

Can you help with this problem?

Provide an answer of your own, or ask bandara for more information if necessary.

To post a message you must log in.