Symptoms
-
Plesk update failed with following error:
# cat /var/log/plesk/panel.log
[…]
Preparing to unpack …/mariadb-server-10.0_10.0.32-0+deb8u1_amd64.deb …
47146
There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead …
47146
There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!
dpkg: error processing archive /var/cache/apt/archives/mariadb-server-10.0_10.0.32-0+deb8u1_amd64.deb (–unpack):
subprocess new pre-removal script returned error exit status 1
insserv: warning: script ‘apf’ missing LSB tags and overrides
Errors were encountered while processing:
/var/cache/apt/archives/mariadb-server-10.0_10.0.32-0+deb8u1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
[…] -
Same issue happens trying to install MariaDB-Server-10.0 from
apt-get
CLI utility.
install
Cause
MariaDB Server pre-removal script fails to stop the current MySQL process. For more information about this issue, check Official Debian bug notes.
Resolution
-
Connect to the server using SSH.
-
Perform a full database backup:
# mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` -f –all-databases > /root/all_databases_backup`date +%F-%s`.sql
-
Stop MySQL service manually:
# service mysql stop
-
Check if mysql still is running:
# pidof -c /usr/sbin/mysqld
7327# ps awufx | grep mysql | grep -v grep
root 7187 0.0 0.0 21820 3504 ? S 21:32 0:00 /bin/bash /usr/bin/mysqld_safe
mysql 7327 0.1 2.0 624472 81944 ? Sl 21:32 0:00 _ /usr/sbin/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib/mysql/plugin –user=mysql –skip-log-error –pid-file=/var/run/mysqld/mysqld.pid –socket=/var/run/mysqld/mysqld.sock –port=3306
root 7328 0.0 0.0 23684 2476 ? S 21:32 0:00 _ logger -t mysqld -p daemon.error -
Kill mysql processes manually (PIDs coming from the above example):
# kill -9Â 7187 7327 7328
-
Check that there aren’t mysql processes running:
# pidof -c /usr/sbin/mysqld
(Empty Output) -
Install/update MariaDB-Server manually:
# apt-get install mariadb-server-10.0
[…]
Preparing to unpack …/mariadb-server-10.0_10.0.32-0+deb8u1_amd64.deb …
Unpacking mariadb-server-10.0 (10.0.32-0+deb8u1) over (10.0.30-0+deb8u2) …
Processing triggers for systemd (215-17+deb8u7) …
Processing triggers for man-db (2.7.0.2-5) …
Setting up mariadb-server-10.0 (10.0.32-0+deb8u1) …
insserv: warning: script ‘apf’ missing LSB tags and overrides