Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-30137

Selinux context have to be manually fixed for 10.4 after backup restore (was: SeLinux prevents backup restore)

    XMLWordPrintable

Details

    Description

      1. make a backup

      sudo mariadb-backup --backup -utest_user -p*****--target-dir b01
      
      

      2. stop server

      sudo systemctl stop mariadb.service
      
      

      3. Remove data dir as instructed in the doc

       sudo rm -rf /var/lib/mysql
      
      

      4. prepare and copy back backup

      sudo mariadb-backup --prepare --target-dir b01
      sudo mariadb-backup --copy-back --target-dir b01
      

      5. Set owner for data dir

       sudo chown mysql:mysql -R /var/lib/mysql
      

      6. Start server

       sudo systemctl start mariadb.service
      

      Result:

      [vagrant@build ~]$ sudo systemctl restart mariadb.service
      Job for mariadb.service failed because the control process exited with error code.
      See "systemctl status mariadb.service" and "journalctl -xe" for details.
      [vagrant@build ~]$ systemctl status mariadb.service
      ● mariadb.service - MariaDB 10.4.27-18 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 Wed 2022-11-30 15:01:44 CET; 1s ago
           Docs: man:mysqld(8)
                 https://mariadb.com/kb/en/library/systemd/
        Process: 20670 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
        Process: 21116 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
        Process: 21016 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
        Process: 21014 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
       Main PID: 21116 (code=exited, status=1/FAILURE)
         Status: "MariaDB server is down"
      
      

      setting Selinux to permissive mode fixes the problem:

      [vagrant@build ~]$ sudo setenforce 0
      [vagrant@build ~]$ sudo systemctl restart mariadb.service
      [vagrant@build ~]$ systemctl status mariadb.service
      ● mariadb.service - MariaDB 10.4.27-18 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: active (running) since Wed 2022-11-30 15:04:03 CET; 4s ago
           Docs: man:mysqld(8)
                 https://mariadb.com/kb/en/library/systemd/
        Process: 21487 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
        Process: 21318 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
        Process: 21316 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
       Main PID: 21418 (mysqld)
         Status: "Taking your SQL requests now..."
          Tasks: 38 (limit: 49492)
         Memory: 74.2M
         CGroup: /system.slice/mariadb.service
                 └─21418 /usr/sbin/mysqld
      
      

      tested with RHEL8

      Attachments

        Activity

          People

            greenman Ian Gilfillan
            tturenko Timofey Turenko
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.