Unable to install MariaDB 10.1 on Ubuntu 18.04 after apt remove --purge mysql*

There is something wrong with the install script for MariaDB 10.1 on Ubuntu 17.04 and 18.04 as it fails to install if MySQL was ever installed on the system even if MySQL has been removed and purged from the system. The peculiar error that is generated is:

dpkg: dependency problems prevent configuration of mariadb-server: mariadb-server depends on mariadb-server-10.1 (>= 1:10.1.29-6); however: Package mariadb-server-10.1 is not configured yet.

Why would the installation of mariadb-server-10.1 be dependent upon the successful completion of the installation of itself? What do I have to do to my system before installing maria-db-server so it will actually install the server?

jcobban@jcobban-lemur:~$ sudo apt-get remove --purge mysql*
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package mysql++-3.0.9
E: Couldn't find any package by glob 'mysql++-3.0.9'
E: Couldn't find any package by regex 'mysql++-3.0.9'
E: Unable to locate package mysql-connector-java-5.1.7
E: Couldn't find any package by glob 'mysql-connector-java-5.1.7'
E: Couldn't find any package by regex 'mysql-connector-java-5.1.7'
jcobban@jcobban-lemur:~$ sudo apt autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  galera-3 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libjemalloc1
  libmysqlclient20 libreadline5 libterm-readkey-perl socat
0 upgraded, 0 newly installed, 9 to remove and 0 not upgraded.
After this operation, 11.4 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 131850 files and directories currently installed.)
Removing galera-3 (25.3.20-1) ...
Removing libconfig-inifiles-perl (2.94-1) ...
Removing libdbd-mysql-perl (4.046-1) ...
Removing libdbi-perl (1.640-1) ...
Removing libjemalloc1 (3.6.0-11) ...
Removing libmysqlclient20:amd64 (5.7.22-0ubuntu18.04.1) ...
Removing libreadline5:amd64 (5.2+dfsg-3build1) ...
Removing libterm-readkey-perl (2.37-1build1) ...
Removing socat (1.7.3.2-2ubuntu2) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2) ...
jcobban@jcobban-lemur:~$ sudo apt-get install mariadb-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  galera-3 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libjemalloc1
  libmysqlclient20 libreadline5 libterm-readkey-perl mariadb-client-10.1
  mariadb-client-core-10.1 mariadb-common mariadb-server-10.1
  mariadb-server-core-10.1 socat
Suggested packages:
  libmldbm-perl libnet-daemon-perl libsql-statement-perl mailx tinyca
The following NEW packages will be installed:
  galera-3 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libjemalloc1
  libmysqlclient20 libreadline5 libterm-readkey-perl mariadb-client-10.1
  mariadb-client-core-10.1 mariadb-common mariadb-server mariadb-server-10.1
  mariadb-server-core-10.1 socat
0 upgraded, 15 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/23.6 MB of archives.
After this operation, 183 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Preconfiguring packages ...
Selecting previously unselected package mariadb-common.
(Reading database ... 131598 files and directories currently installed.)
Preparing to unpack .../0-mariadb-common_1%3a10.1.29-6_all.deb ...
Unpacking mariadb-common (1:10.1.29-6) ...
Selecting previously unselected package galera-3.
Preparing to unpack .../1-galera-3_25.3.20-1_amd64.deb ...
Unpacking galera-3 (25.3.20-1) ...
Selecting previously unselected package libdbi-perl.
Preparing to unpack .../2-libdbi-perl_1.640-1_amd64.deb ...
Unpacking libdbi-perl (1.640-1) ...
Selecting previously unselected package libreadline5:amd64.
Preparing to unpack .../3-libreadline5_5.2+dfsg-3build1_amd64.deb ...
Unpacking libreadline5:amd64 (5.2+dfsg-3build1) ...
Selecting previously unselected package mariadb-client-core-10.1.
Preparing to unpack .../4-mariadb-client-core-10.1_1%3a10.1.29-6_amd64.deb ...
Unpacking mariadb-client-core-10.1 (1:10.1.29-6) ...
Selecting previously unselected package libconfig-inifiles-perl.
Preparing to unpack .../5-libconfig-inifiles-perl_2.94-1_all.deb ...
Unpacking libconfig-inifiles-perl (2.94-1) ...
Selecting previously unselected package libjemalloc1.
Preparing to unpack .../6-libjemalloc1_3.6.0-11_amd64.deb ...
Unpacking libjemalloc1 (3.6.0-11) ...
Selecting previously unselected package mariadb-client-10.1.
Preparing to unpack .../7-mariadb-client-10.1_1%3a10.1.29-6_amd64.deb ...
Unpacking mariadb-client-10.1 (1:10.1.29-6) ...
Selecting previously unselected package mariadb-server-core-10.1.
Preparing to unpack .../8-mariadb-server-core-10.1_1%3a10.1.29-6_amd64.deb ...
Unpacking mariadb-server-core-10.1 (1:10.1.29-6) ...
Selecting previously unselected package socat.
Preparing to unpack .../9-socat_1.7.3.2-2ubuntu2_amd64.deb ...
Unpacking socat (1.7.3.2-2ubuntu2) ...
Setting up mariadb-common (1:10.1.29-6) ...
update-alternatives: using /etc/mysql/mariadb.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mariadb-server-10.1.
(Reading database ... 131969 files and directories currently installed.)
Preparing to unpack .../mariadb-server-10.1_1%3a10.1.29-6_amd64.deb ...
/var/lib/mysql: found previous version 10.1
Unpacking mariadb-server-10.1 (1:10.1.29-6) ...
Selecting previously unselected package libmysqlclient20:amd64.
Preparing to unpack .../libmysqlclient20_5.7.22-0ubuntu18.04.1_amd64.deb ...
Unpacking libmysqlclient20:amd64 (5.7.22-0ubuntu18.04.1) ...
Selecting previously unselected package libdbd-mysql-perl.
Preparing to unpack .../libdbd-mysql-perl_4.046-1_amd64.deb ...
Unpacking libdbd-mysql-perl (4.046-1) ...
Selecting previously unselected package libterm-readkey-perl.
Preparing to unpack .../libterm-readkey-perl_2.37-1build1_amd64.deb ...
Unpacking libterm-readkey-perl (2.37-1build1) ...
Selecting previously unselected package mariadb-server.
Preparing to unpack .../mariadb-server_1%3a10.1.29-6_all.deb ...
Unpacking mariadb-server (1:10.1.29-6) ...
Setting up libconfig-inifiles-perl (2.94-1) ...
Processing triggers for ureadahead (0.100.0-20) ...
Setting up libjemalloc1 (3.6.0-11) ...
Setting up socat (1.7.3.2-2ubuntu2) ...
Setting up libterm-readkey-perl (2.37-1build1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Setting up galera-3 (25.3.20-1) ...
Processing triggers for systemd (237-3ubuntu10) ...
Processing triggers for man-db (2.8.3-2) ...
Setting up libmysqlclient20:amd64 (5.7.22-0ubuntu18.04.1) ...
Setting up libreadline5:amd64 (5.2+dfsg-3build1) ...
Setting up libdbi-perl (1.640-1) ...
Setting up mariadb-server-core-10.1 (1:10.1.29-6) ...
Setting up mariadb-client-core-10.1 (1:10.1.29-6) ...
Setting up libdbd-mysql-perl (4.046-1) ...
Setting up mariadb-client-10.1 (1:10.1.29-6) ...
Setting up mariadb-server-10.1 (1:10.1.29-6) ...
dpkg: error processing package mariadb-server-10.1 (--configure):
 installed mariadb-server-10.1 package post-installation script subprocess returned error exit status 1
No apport report written because the error message indicates its a followup error from a previous failure.
                          dpkg: dependency problems prevent configuration of mariadb-server:
 mariadb-server depends on mariadb-server-10.1 (>= 1:10.1.29-6); however:
  Package mariadb-server-10.1 is not configured yet.

dpkg: error processing package mariadb-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for ureadahead (0.100.0-20) ...
Processing triggers for systemd (237-3ubuntu10) ...
Errors were encountered while processing:
 mariadb-server-10.1
 mariadb-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

Answer Answered by Gert Kruger in this comment.

I had similar issues on my Ubuntu 18.04 system. I had to remove all Mariadb related packages with Synaptic Manager and then I followed the instructions at https://mariadb.com/kb/en/library/installing-mariadb-deb-files/

Specifically, I used: 1. Adding the MariaDB APT repository 2. Importing the MariaDB GPG Public Key 3. Installing MariaDB with APT

Interesting on my system with Ubuntu 18.10, the same method did not work. I used the method described at https://downloads.mariadb.org/mariadb/repositories/#mirror=telkom&distro=Ubuntu&distro_release=bionic--ubuntu_bionic&version=10.3

Here you can choose the correct version. I used 10.3 stable version.

The other way round did not work for either Ubuntu version. Best wishes Gert Kruger

Comments

Comments loading...
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.