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.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1914636

Title:
  package mysql-server-8.0 8.0.23-0ubuntu0.20.04.1 failed to
  install/upgrade: installed mysql-server-8.0 package post-installation
  script subprocess returned error exit status 1

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mysql-8.0/+bug/1914636/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to