Installation of mariaDB lasted for a long time, ending the terminal process.

$ sudo apt-get install mariadb-server mariadb-client

Attempting to install MariaDB again caused the following problems:

Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 31891 (apt-get) - open (11: Resource temporarily unavailable)

So I found the following solution.

$ sudo rm /var/lib/apt/lists/lock
$ sudo rm /var/cache/apt/archives/lock
$ sudo rm /var/lib/dpkg/lock*

$ sudo dpkg --configure -a
$ sudo apt update

But this also occured some problem:

$ sudo dpkg --configure -a
Setting up mariadb-server-10.3 (1:10.3.22-0ubuntu0.19.10.1) ...
^Cdpkg: error processing package mariadb-server-10.3 (--configure):
 installed mariadb-server-10.3 package post-installation script subprocess was interrupted
dpkg: dependency problems prevent configuration of mariadb-server:
 mariadb-server depends on mariadb-server-10.3 (>= 1:10.3.22-0ubuntu0.19.10.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:

I deleted and reinstalled MariaDB, but the installation did not complete for a long time.

$ sudo apt-get install mariadb-server mariadb-client
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mariadb-server-10.3
Suggested packages:
  mailx mariadb-test tinyca
The following NEW packages will be installed:
  mariadb-client mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mariadb-server
  mariadb-server-10.3 mariadb-server-core-10.3
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/17.3 MB of archives.
After this operation, 158 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 ... 212987 files and directories currently installed.)
Preparing to unpack .../mariadb-common_1%3a10.3.22-0ubuntu0.19.10.1_all.deb ...
Unpacking mariadb-common (1:10.3.22-0ubuntu0.19.10.1) ...
Selecting previously unselected package mariadb-client-core-10.3.
Preparing to unpack .../mariadb-client-core-10.3_1%3a10.3.22-0ubuntu0.19.10.1_amd64.deb ...
Unpacking mariadb-client-core-10.3 (1:10.3.22-0ubuntu0.19.10.1) ...
Selecting previously unselected package mariadb-client-10.3.
Preparing to unpack .../mariadb-client-10.3_1%3a10.3.22-0ubuntu0.19.10.1_amd64.deb ...
Unpacking mariadb-client-10.3 (1:10.3.22-0ubuntu0.19.10.1) ...
Selecting previously unselected package mariadb-server-core-10.3.
Preparing to unpack .../mariadb-server-core-10.3_1%3a10.3.22-0ubuntu0.19.10.1_amd64.deb ...
Unpacking mariadb-server-core-10.3 (1:10.3.22-0ubuntu0.19.10.1) ...
Setting up mariadb-common (1:10.3.22-0ubuntu0.19.10.1) ...
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.3.
(Reading database ... 213145 files and directories currently installed.)
Preparing to unpack .../mariadb-server-10.3_1%3a10.3.22-0ubuntu0.19.10.1_amd64.deb ...
Unpacking mariadb-server-10.3 (1:10.3.22-0ubuntu0.19.10.1) ...
Selecting previously unselected package mariadb-client.
Preparing to unpack .../mariadb-client_1%3a10.3.22-0ubuntu0.19.10.1_all.deb ...
Unpacking mariadb-client (1:10.3.22-0ubuntu0.19.10.1) ...
Selecting previously unselected package mariadb-server.
Preparing to unpack .../mariadb-server_1%3a10.3.22-0ubuntu0.19.10.1_all.deb ...
Unpacking mariadb-server (1:10.3.22-0ubuntu0.19.10.1) ...
Setting up mariadb-server-core-10.3 (1:10.3.22-0ubuntu0.19.10.1) ...
Setting up mariadb-client-core-10.3 (1:10.3.22-0ubuntu0.19.10.1) ...
Setting up mariadb-client-10.3 (1:10.3.22-0ubuntu0.19.10.1) ...
Setting up mariadb-server-10.3 (1:10.3.22-0ubuntu0.19.10.1) ...
Created symlink /etc/systemd/system/mysql.service → /lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /lib/systemd/system/mariadb.service.
  • 1
    Im also waiting already 20 min same last line untill you stopped it :) Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /lib/systemd/system/mariadb.service.
    – Kangarooo
    Mar 13, 2020 at 20:05
  • It finished with Job for mariadb.service failed because a timeout was exceeded. See "systemctl status mariadb.service" and "journalctl -xe" for details. Setting up mariadb-server (1:10.1.44-0ubuntu0.18.04.1) ... Processing triggers for libc-bin (2.27-3ubuntu1) ... Processing triggers for systemd (237-3ubuntu10.39) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... Processing triggers for ureadahead (0.100.0-21) ...
    – Kangarooo
    Mar 13, 2020 at 20:10
  • Enter current password for root (enter for none): ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
    – Kangarooo
    Mar 13, 2020 at 20:12
  • I followed this tutorial for 16.04 but did on 18.04 vpsfix.com/4937/install-virtualmin-nginx-php-mysql-ubuntu/… Error reported on forum.virtualmin.com/t/…
    – Kangarooo
    Mar 16, 2020 at 7:33
  • 1
    I just ran into this. I ended up gently terminating an obviously hung process (0% CPU utilization) from a separate terminal session (/bin/bash /var/lib/dpkg/info/mariadb-server-10.3.postinst configure). apt continued and finished with a warning about early termination. However, the MariaDB service is started and appears to be fully functional. There's obviously a bug somewhere in the postinit configure script for this package. Dec 17, 2020 at 14:15

2 Answers 2


If you had mySQL installed before, and your syslog shows

AVC apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld"

no purging, reinstalling or the like will help when using the stock Ubuntu/Debian repo.

A lingering AppArmor profile will prevent mariaDB from successfully starting.

So effectively anyone who wants to switch from mySQL to mariaDB on Debian or Ubuntu will fail miserably (could it be there is some Oracle maintainer involved in the package creation ? ;-) )

This is known since 18.04, including a fix, and not fixed until now.


echo "/usr/sbin/mysqld { }" > /etc/apparmor.d/usr.sbin.mysqld
apparmor_parser -v -R /etc/apparmor.d/usr.sbin.mysqld

will fix it. Afterwards, mariaDB can be installed and/or the service can be started.

  • This is what I needed, thanks for this...
    – PanDe
    Jan 19, 2022 at 5:11

I'm using ubuntu 20.04 and have same experience.(mariadb-server-10.3)
After all, I update mariadb repository on https://downloads.mariadb.org/mariadb/repositories and install mariadb-server-10.5

[install progress]

  1. Choose a Distro: Ubuntu
  2. Choose a Release: 20.04 "focal" -- in my case
  3. Choose a Version: 10.5 [Stable]
  4. Choose a Mirror: press 'Show All Mirros' button and click 'DigitalOcean - New York, US'
    -- some mirrors does not work, because fetch keys does not valid
  5. Needed progress will be shown below.

    sudo apt-get install software-properties-common
    sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
    sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main'

    sudo apt update
    sudo apt install mariadb-server
  • 1
    Please add excerpts of the steps and commands that worked for you from that link into your answer; While keeping the link as a source/reference for your answer.
    – Dan
    Jul 16, 2020 at 7:22
  • Very annoying - multiple reboots and uninstalls before things run again. Oct 11, 2020 at 12:47
  • I get "The following packages have unmet dependencies: mariadb-server : Depends: mariadb-server-10.5 (>= 1:10.5.10+maria~focal) but it is not going to be installed" when I try this. May 29, 2021 at 19:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .