0

I literally tried everything.

Almost every answer in stackoverflow, I still can't remove MySQL

The following packages were automatically installed and are no longer required:libdbi-perl libterm-readkey-perl Use 'apt-get autoremove' to remove them. The following packages will be REMOVED: mysql-server-5.5* 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. 1 not fully installed or removed. After this operation, 32.5 MB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 25587 files and directories currently installed.) Removing mysql-server-5.5 (5.5.47-0+deb8u1) ... Failed to stop mysql.service: Unit mysql.service not loaded. invoke-rc.d: initscript mysql, action "stop" failed. dpkg: error processing package mysql-server-5.5 (--purge): subprocess installed pre-removal script returned error exit status 5 Failed to stop mysql.service: Unit mysql.service not loaded. invoke-rc.d: initscript mysql, action "stop" failed. Failed to start mysql.service: Unit mysql.service failed to load: No such >file or directory. invoke-rc.d: initscript mysql, action "start" failed. dpkg: error while cleaning up: subprocess installed post-installation script returned error exit status 6 Errors were encountered while processing: mysql-server-5.5 E: Sub-process /usr/bin/dpkg returned an error code (1)

This is becoming a nightmare. I googled hell and back, I tried everything I found, from purging packages, autoclean, autoremove, removing directories, shutting down services, etc.

I still get errors.

I'm seriously thinking on a clean install.

nukahourai
  • 23
  • 4

1 Answers1

0

Basically it means that something messed up one of the installation / removal scripts.

Check in /var/lib/dpkg/info/ for scripts named mysql-server

I have:

mysql-server-5.5.conffiles mysql-server-5.5.config mysql-server-5.5.list mysql-server-5.5.md5sums mysql-server-5.5.postinst mysql-server-5.5.postrm mysql-server-5.5.preinst mysql-server-5.5.prerm mysql-server-5.5.templates mysql-server-core-5.5.list mysql-server-core-5.5.md5sums mysql-server.list mysql-server.md5sums

Add exit 0 to the top of the scripts .prerm and .postrm after the first line #!/bin/bash

Then you should be able to do an apt-get purge mysql-server

This will likely leave some dangling files on your system so try and run through the package install process again and then purge them properly which should remove everything.

the1dv
  • 893
  • 7
  • 14
  • Doesn't work. Thanks for the help, but I'm doing a clean install. I'm sick of this, I'm sick of not making this damn service to work. – nukahourai Feb 12 '16 at 15:48
  • A clean install is overkill, I have had this problem before and it is basically just because at some point these scripts have got messed up, if you post the errors you get after doing the steps I said above we can help you with next steps. – the1dv Feb 14 '16 at 01:17