Hi Muhammad,
IMHO the problem is right at the start, one should not manually remove /ect/* files :-)
But ok, let us consider it happened somehow and you now need to resolve things.
If you look at this example you'll see that /etc/mysql belongs not to the package you purged
root@f:~# for i in $(find /etc/mysql); do dpkg -S $i; done
mysql-common, mysql-server-8.0: /etc/mysql
mysql-common: /etc/mysql/my.cnf.fallback
mysql-server-8.0: /etc/mysql/mysql.conf.d
mysql-server-8.0: /etc/mysql/mysql.conf.d/mysql.cnf
mysql-server-8.0: /etc/mysql/mysql.conf.d/mysqld.cnf
mysql-server-8.0: /etc/mysql/debian-start
mysql-common: /etc/mysql/conf.d
mysql-common: /etc/mysql/conf.d/mysql.cnf
mysql-common: /etc/mysql/conf.d/mysqldump.cnf
dpkg-query: no path found matching pattern /etc/mysql/my.cnf
dpkg-query: no path found matching pattern /etc/mysql/debian.cnf
mysql-server-8.0: /etc/mysql/mysql.cnf
And if you purge as you do, only the listed package will be purged
root@f:~# apt purge mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.1-7
libevent-pthreads-2.1-7 libfcgi-perl libhtml-parser-perl libhtml-tagset-perl
libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl
liblwp-mediatypes-perl libmecab2 libtimedate-perl liburi-perl mecab-ipadic
mecab-ipadic-utf8 mecab-utils mysql-client-8.0 mysql-client-core-8.0 mysql-common
mysql-server-8.0 mysql-server-core-8.0
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
mysql-server*
0 upgraded, 0 newly installed, 1 to remove and 36 not upgraded.
After this operation, 112 kB disk space will be freed.
Do you want to continue? [Y/n]
That means after your manual rm -rf /etc/mysql (again, one should not do this) muliple packages are in a bad state. E.g. mysql-common + mysql-server-8.0 can't differentiate your file removal from an intentional config by the admin. So they have to work with what they find and that is nothing.
Therefore follow on install/upgrades will break.
You manually fixed a little bit of it, but it is worse.
If you really want to purge and remove not only the named, but also the related packages then I'd recommend:
a) list all of them
apt purge mysql-server mysql-client-8.0 mysql-client-core-8.0 ...
# it is a bit of work to collect the list, but the ouput of the purge command will tell you
b) purge with autoremove
$ apt --purge autoremove
$ apt purge mysql-server
# for this you should be sure that formerly nothing was listed for autoremove or you rmight purge more than you wanted
Only now /etc/mysql is almost empty and no package relies on it anymore.
Installing mysql-server now works as there is no old misconfiguration (and rm configfiles is a misconfiguration, just as much as a bad value in a config file) works fine now.
Marking as invalid, as this seems to be a local config issue and not a bug in the package.
Hi Muhammad,
IMHO the problem is right at the start, one should not manually remove /ect/* files :-)
But ok, let us consider it happened somehow and you now need to resolve things.
If you look at this example you'll see that /etc/mysql belongs not to the package you purged
root@f:~# for i in $(find /etc/mysql); do dpkg -S $i; done my.cnf. fallback mysql.conf. d mysql.conf. d/mysql. cnf mysql.conf. d/mysqld. cnf debian- start conf.d/ mysql.cnf conf.d/ mysqldump. cnf debian. cnf mysql.cnf
mysql-common, mysql-server-8.0: /etc/mysql
mysql-common: /etc/mysql/
mysql-server-8.0: /etc/mysql/
mysql-server-8.0: /etc/mysql/
mysql-server-8.0: /etc/mysql/
mysql-server-8.0: /etc/mysql/
mysql-common: /etc/mysql/conf.d
mysql-common: /etc/mysql/
mysql-common: /etc/mysql/
dpkg-query: no path found matching pattern /etc/mysql/my.cnf
dpkg-query: no path found matching pattern /etc/mysql/
mysql-server-8.0: /etc/mysql/
And if you purge as you do, only the listed package will be purged
root@f:~# apt purge mysql-server locale- perl libevent-core-2.1-7 pthreads- 2.1-7 libfcgi-perl libhtml-parser-perl libhtml-tagset-perl template- perl libhttp-date-perl libhttp- message- perl libio-html-perl mediatypes- perl libmecab2 libtimedate-perl liburi-perl mecab-ipadic core-8. 0 mysql-common core-8. 0
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libcgi-fast-perl libcgi-pm-perl libencode-
libevent-
libhtml-
liblwp-
mecab-ipadic-utf8 mecab-utils mysql-client-8.0 mysql-client-
mysql-server-8.0 mysql-server-
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
mysql-server*
0 upgraded, 0 newly installed, 1 to remove and 36 not upgraded.
After this operation, 112 kB disk space will be freed.
Do you want to continue? [Y/n]
That means after your manual rm -rf /etc/mysql (again, one should not do this) muliple packages are in a bad state. E.g. mysql-common + mysql-server-8.0 can't differentiate your file removal from an intentional config by the admin. So they have to work with what they find and that is nothing.
Therefore follow on install/upgrades will break.
You manually fixed a little bit of it, but it is worse.
If you really want to purge and remove not only the named, but also the related packages then I'd recommend: core-8. 0 ...
a) list all of them
apt purge mysql-server mysql-client-8.0 mysql-client-
# it is a bit of work to collect the list, but the ouput of the purge command will tell you
b) purge with autoremove
$ apt --purge autoremove
$ apt purge mysql-server
# for this you should be sure that formerly nothing was listed for autoremove or you rmight purge more than you wanted
Only now /etc/mysql is almost empty and no package relies on it anymore.
Installing mysql-server now works as there is no old misconfiguration (and rm configfiles is a misconfiguration, just as much as a bad value in a config file) works fine now.
Marking as invalid, as this seems to be a local config issue and not a bug in the package.