This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-16. For the latest, interactive version please visit https://mariadb.com/kb/.

Maria Installation Problem - Failed to stop mysql.service

I have been trying to remove and reinstall mariadb on my system however I keep running into issues when trying to purge the previous install.

root@Server:/home/nicholas# sudo apt-get --purge autoremove mariadb-client-10.2
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 mariadb-server-10.2 : PreDepends: mariadb-common (>= 1:10.2.26+maria~bionic) but it is not going to be installed
                       Depends: galera-3 (>= 25.3)
                       Depends: mariadb-client-10.2 (>= 1:10.2.26+maria~bionic) but it is not going to be installed
                       Depends: mariadb-server-core-10.2 (>= 1:10.2.26+maria~bionic) but it is not going to be installed
                       Depends: socat but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

When I attempt to fix the broken install. It works fine up until right after I have to enter a root password. I get this message following that.

Failed to start mysql.service: Unit mysql.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status mysql.service' for details.
invoke-rc.d: initscript mysql, action "start" failed.
● mysql.service
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead)

Aug 22 15:27:24 Server systemd[1]: /etc/systemd/system/mysql.service:32: Assignment outside of section. Ignoring.
Aug 22 15:27:24 Server systemd[1]: /etc/systemd/system/mysql.service:33: Assignment outside of section. Ignoring.
Aug 22 15:27:24 Server systemd[1]: /etc/systemd/system/mysql.service:34: Assignment outside of section. Ignoring.
Aug 22 15:27:24 Server systemd[1]: /etc/systemd/system/mysql.service:35: Assignment outside of section. Ignoring.
Aug 22 15:27:24 Server systemd[1]: /etc/systemd/system/mysql.service:36: Assignment outside of section. Ignoring.
Aug 22 15:27:24 Server systemd[1]: /etc/systemd/system/mysql.service:37: Assignment outside of section. Ignoring.
Aug 22 15:27:24 Server systemd[1]: /etc/systemd/system/mysql.service:38: Assignment outside of section. Ignoring.
Aug 22 15:27:24 Server systemd[1]: /etc/systemd/system/mysql.service:39: Assignment outside of section. Ignoring.
Aug 22 15:27:24 Server systemd[1]: /etc/systemd/system/mysql.service:40: Assignment outside of section. Ignoring.
Aug 22 15:27:24 Server systemd[1]: mysql.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
dpkg: error processing package mariadb-server-10.2 (--configure):
 installed mariadb-server-10.2 package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Errors were encountered while processing:
 mariadb-server-10.2
E: Sub-process /usr/bin/dpkg returned an error code (1)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.