Issue
I don't understand if it's a bug or I don't know something.
I installed, for example mysql-server
package with:
apt-get install mysql-server
It installs and works well. Then I try to delete it and it's configs:
apt-get purge mysql-server
As I understand from the manuals, purge delete all package's configs,
but directory /etc/mysql
is still there. I then deleted it
manually:
rm -r /etc/mysql
But when I tried to install the package again, it doesn't create dir in /etc
and of course the package doesn't work. It happens not only with MySQL, but with
numerous other packages, including Apache vim.
What should I do?
This is on Debian 7 "wheezy".
Solution
You need to make sure that you are purging the package which actually contains the config files. For example, /etc/mysql/my.cnf is not owned by the mysql-server package, but is owned by the mysql-common package. You can see this by running dpkg -S /etc/mysql
or dpkg -S /etc/mysql/my.cnf
. For apache2, its the apache2.2-common package which owns most of the config.
apt-file
is a handy utility you can install to search for this kind of thing as well. After apt-file update
, apt-file search /etc/mysql
should help figure out what package you need to reinstall.
Also note that you don't necessarily have to purge a package to replace missing config, there is a dpkg options --force-confmiss
to replace missing config and --force-confnew
to replace existing config, so you could probably fox your mysql problem with apt-get -o DPkg::options::=--force-confmiss install --reinstall mysql-common
Answered By - stew Answer Checked By - Cary Denson (WPSolving Admin)