By removing the datadir (/var/lib/mysql directory) itself, I lost the SELinux context on that directory when it gets re-generated. So the directory must not be deleted but emptied. The docs mention to make sure that the datadir is empty, so it is correct. My bad.

On Fri, Mar 29, 2019 at 8:17 AM Thomas Janssens <thojanssens1@gmail.com> wrote:
Hello,

This page contains instructions on how to restore a backup:

1. stop MariaDB:
    # systemctl stop mariadb.service

2. datadir must be empty:
    # rm -rf /var/lib/mysql/

3. run mariabackup:
    #mariabackup --copy-back --target-dir=/var/mariadb/backup/

4. fix permissions:
    # chown -R mysql:mysql /var/lib/mysql/

5. start MariaDB:
    # systemctl start mariadb.service

mariabackup said "completed OK!" and I see that datadir contains the restored data.

However, when following these instructions, I can't start MariaDB anymore. I have the following error:

mar 29 07:06:49 myhostname mysqld[11359]: 2019-03-29  7:06:49 0 [ERROR] Plugin 'InnoDB' init function returned error.
mar 29 07:06:49 myhostname mysqld[11359]: 2019-03-29  7:06:49 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
mar 29 07:06:49 myhostname mysqld[11359]: 2019-03-29  7:06:49 0 [Note] Plugin 'FEEDBACK' is disabled.
mar 29 07:06:49 myhostname mysqld[11359]: 2019-03-29  7:06:49 0 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
mar 29 07:06:49 myhostname mysqld[11359]: 2019-03-29  7:06:49 0 [ERROR] Unknown/unsupported storage engine: InnoDB
mar 29 07:06:49 myhostname mysqld[11359]: 2019-03-29  7:06:49 0 [ERROR] Aborting
mar 29 07:06:49 myhostname systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
mar 29 07:06:49 myhostname systemd[1]: Failed to start MariaDB 10.3.13 database server.
mar 29 07:06:49 myhostname systemd[1]: Unit mariadb.service entered failed state.
mar 29 07:06:49 myhostname systemd[1]: mariadb.service failed.

Is there something missing in the documentation?

Thomas