Articles in this section

MariaDB service status failed after upgrade while Plesk and all databases are available: Could not get an exclusive lock

Plesk for Linux kb: technical

Applicable to:

  • Plesk for Linux

Symptoms

  • MariaDB service status is failed:

    # systemctl status mariadb.service
    ● mariadb.service - MariaDB 10.2.31 database server
    Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
    └─migrated-from-my.cnf-settings.conf
    Active: failed (Result: exit-code) since 二 2020-04-28 16:45:15 CST; 3h 44min ago

  • There was an attempt to upgrade MariaDB from MariaDB 5.5 to MariaDB 10.2 and the current binary shows MariaDB 10.2:

    # mysql -V
    mysql Ver 15.1 Distrib 10.2.31-MariaDB, for Linux (x86_64) using readline 5.1

  • The MariaDB log file /var/log/mariadb/mariadb.log contains the following errors:

    [ERROR] mysqld: Can't lock aria control file '/var/lib/mysql/aria_log_control' for exclusive use, error: 11. Will retry for 30 seconds
    [ERROR] mysqld: Got error 'Could not get an exclusive lock; file is probably in use by another process' when trying to use aria control file '/var/lib/mysql/aria_log_control'
    [ERROR] Plugin 'Aria' init function returned error.
    [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
    [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
    [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.

  • There is an existing MariaDB process running in the background:

    # ps awufx | grep mysql | grep -v grep
    root 1598 0.0 0.0 115540 1380 ? S 16:43 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/plesk.example.com.pid
    mysql 2028 6.4 19.8 7873140 1589396 ? Sl 16:43 14:48 \_ /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/lib/mysql/plesk.example.com.pid --socket=/var/lib/mysql/mysql.sock

Cause

The MariaDB upgrade process is not complete or was performed incorrectly.

Resolution

  1. Connect to the server via SSH

  2. Kill the MariaDB processes running in the background:

    # ps awufx | grep mysql | grep -v grep | awk '{print $2}' | while read i; do kill -9 $i; done

  3. Start MariaDB service:

    # systemctl start mariadb

    Note: If MariaDB service fails to start, run again the previous command a couple of times or restart the server

  4. Complete the remaining upgrade guide steps to stop and remove the incorrect service while ensuring the latest is started and enabled:

    Note: Run each line command separately.

    # systemctl restart mariadb
    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql_upgrade -uadmin
    # systemctl restart mariadb
    # plesk sbin packagemng -sdf
    # systemctl stop mysql; killall mysqld
    # rm /etc/init.d/mysql && systemctl daemon-reload
    # systemctl start mariadb
    # systemctl enable mariadb

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.