我在 Ubuntu 20.10 中清除 mariadb 时遇到问题。我相信我不小心删除了 mariadb.service 文件,现在我既无法从计算机中清除 mariadb,也无法重新安装它。这是命令和错误消息。
sudo apt-get --purge remove "mariadb*"
The following packages were automatically installed and are no longer required:
galera-3 libconfig-inifiles-perl libdbd-mariadb-perl libdbi-perl libhtml-template-perl libterm-readkey-perl
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
mariadb-client-10.3* mariadb-client-core-10.3* mariadb-common* mariadb-server* mariadb-server-10.3* mariadb-server-core-10.3*
0 upgraded, 0 newly installed, 6 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 156 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 559633 files and directories currently installed.)
Removing mariadb-server (1:10.3.25-0ubuntu1) ...
Removing mariadb-server-10.3 (1:10.3.25-0ubuntu0.20.04.1) ...
Failed to stop mariadb.service: Unit mariadb.service not loaded.
dpkg: error processing package mariadb-server-10.3 (--remove):
installed mariadb-server-10.3 package pre-removal script subprocess returned error exit status 5
dpkg: too many errors, stopping
/usr/bin/deb-systemd-helper: error: unable to read mariadb.service
/usr/bin/deb-systemd-helper: error: unable to read mariadb.service
Failed to get unit file state for mariadb.service: No such file or directory
mariadb.service is a disabled or a static unit, not starting it.
Errors were encountered while processing:
mariadb-server-10.3
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
任何帮助将不胜感激。谢谢!