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

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
2010-09-17
Last reply:
2010-09-18
bandara (nwadmin) said : #1
Clint Byrum (clint-fewbar) said : #2

Hello bandara,

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

Clint Byrum (clint-fewbar) said : #3

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.