Can't install mariadb-server - unmet dependancy mariadb-server

us flag

I was following a setup process of the ERPNext from here in a fresh Ubuntu 20.04 server but I'm stuck at command sudo apt -y install mariadb-server libmysqlclient-dev as I can't install mariadb in it.

The issue is

The following packages have unmet dependencies:
 mariadb-server : Depends: mariadb-server-10.6 (>= 1:10.6.4+maria~hirsute) but it is not going to be installed

It was initially showing mariadb-server : Depends: mariadb-server only, then I followed some answers available on this website so it was changed to mariadb-server : Depends: mariadb-server-10.3 and after following the official site's instructions, it is now at ...10.6.

I've searched and looked on almost all questions and answers available on this website as well as on other websites, none helped. Also, I've tried installing the mariadb-server-client as suggested by the CLI but it didn't work either, I've tried installing the mariadb-server-core again as suggested by the CLI and it installed successfully but didn't help in installation of mariadb-server.

user535733 avatar
cn flag
Hmmm. The ERPNext instructions are ancient (17.04! Last updated in 2018!) and seem likely to have led you badly astray. Undo everything that those instructions told you to do. Most 20.04 users can install MariaDB Server 10.3 from the Ubuntu repositories with a single command: `sudo apt install mariadb-server` *and nothing else*. No other sources, no keys, no haywiring, nothing. If you need a specific version of MariaDB, you should say so in your Question above. If you need the newest version of all software, then you shouldn't be using an LTS release.
Lalit Fauzdar avatar
us flag
@user535733 Thanks for the tip, I removed the repositories instead of undoing everything and it worked. See my answer.
us flag

Why it happened? The old versions of Ubuntu required the repository of mariadb to be added first before installing it. Now in 20.04, it's not required and the installation works directly, but as I followed an old tutorial, I added the repositories which caused the issue, so, the solution is to remove the repositories added.

The solution: So, as @user535733 suggested to undo everything, I looked at the instructions and found one repository of mariadb that I had added (using add-apt-repository command) but I had also added another one from mariadb's official site to install it.

So, the easy way was to remove these added repositories and for that I found this answer and typed a command sudo nano /etc/apt/sources.list and removed all the repositories containing mariadb and the installation of mariadb worked.


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.