Ubuntu 20.04 weird problems on mariadb-server-10.3 upgrade
I have just performed a dist-upgrade on ubuntu 20.04 server and got stuck on mariadb-server-10.3
The apt process hung on this package and after 20 minutes waiting I have killed the process. After that, I checked mariadb and it was running with v. 10.3 but apt is still claiming for configuration:
dpkg --configure -a
Setting up mariadb-server-10.3 (1:10.3.29-0ubuntu0.20.04.1)
Hanging forever. But if I check installed packages, I get this:
dpkg -l | grep maria*
ii mariadb-client-10.3 1:10.3.29-0ubuntu0.20.04.1 amd64 MariaDB database client binaries
ii mariadb-client-core-10.3 1:10.3.29-0ubuntu0.20.04.1 amd64 MariaDB database core client binaries
ii mariadb-common 1:10.3.29-0ubuntu0.20.04.1 all MariaDB common metapackage
iU mariadb-server 1:10.3.29-0ubuntu0.20.04.1 all MariaDB database server (metapackage depending on the latest version)
iF mariadb-server-10.3 1:10.3.29-0ubuntu0.20.04.1 amd64 MariaDB database server binaries
ii mariadb-server-core-10.3 1:10.3.29-0ubuntu0.20.04.1 amd64 MariaDB database core server files
It won't be a problem, except that from now on, every time I need to update a package/system I going through this hanging problem:
dpkg: dependency problems prevent configuration of mariadb-server:
mariadb-server depends on mariadb-server-10.3 (>= 1:10.3.29-0ubuntu0.20.04.1); however:
Package mariadb-server-10.3 is not configured yet.
dpkg: error processing package mariadb-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mariadb-server-10.3
mariadb-server
How to fix?
I had to the existing mysql-server on the server. This is because I have no need for MySQL on the server
sudo systemctl stop mysql
sudo apt purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
sudo rm -rf /etc/mysql /var/lib/mysql /var/log/mysql
sudo apt autoremove
sudo apt autoclean
Then I re-installed MariaDB Server
To install
sudo apt update
sudo apt install mariadb-server
To setup
sudo mysql_secure_installation
I had to reinstall to fix. Obviously if you can do a backup first, do one!
sudo apt remove mariadb-server mariadb-server-10.3 mariadb-server-core-10.3 mariadb-client mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common
Note: I didn't have to restore any of my databases. I saw the following message while running the command above:dpkg: warning: while removing mariadb-server-core-10.3, directory '/usr/share/mysql' not empty so not removed
So if you want to do a backup, which you should there are no excuses, you can do so from ('/var/lib/mysql') the your databases should be stored.
Reinstall/restore MariaDB:sudo apt install mariadb-server mariadb-client