dpkg package pre-removal script returned error
On a Plesk server, MySQL somehow went missing. When I tried to remove a package, I get error
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
root@82-165-118-245:~# dpkg --remove plesk-config-troubleshooter (Reading database ... 168528 files and directories currently installed.) Removing plesk-config-troubleshooter (18.0-v.ubuntu.18.04+p18.0.39.2+t211117.1817) ... dpkg action: ERROR while trying to detect MySQL service name Check the error reason (see log file: /var/log/plesk/install/plesk_18.0.39_installation.log), fix and try again dpkg action: ERROR while trying to detect MySQL service name Package script failed ***** installing problem report ***** ERROR while trying to detect MySQL service name Package script failed dpkg: error processing package plesk-config-troubleshooter (--remove): installed plesk-config-troubleshooter package pre-removal script subprocess returned error exit status 1 Errors were encountered while processing: plesk-config-troubleshooter root@82-165-118-245:~# |
To fix this, i removed the prerm and postrm scripts. These scripts execute before and after a package is removed. It is not recommended to remove it, but if these scripts prevent you from uninstalling a package, you can remove them as last option.
1 2 |
mv /var/lib/dpkg/info/plesk-config-troubleshooter.prerm ~/ mv /var/lib/dpkg/info/plesk-config-troubleshooter.postrm ~/ |
Or you can just edit the file, put
1 |
exit 0 |
somewhere before the error happens.