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

mariabackup has wrong or missing plugin-dir default?

Details

    Description

      Preparing a backup taken on a server with data-at-rest encryption enabled fails with

      mariabackup: Can't open shared library '/file_key_management.so' (errno: 2, cannot open shared object file: No such file or directory)

      The prepare only succeeds after explicitly adding --plugin-dir=/usr/lib/mysql/plugins, which should not be necessary as it is the default path anyway.

      Full log output:

      # mariabackup --prepare
       
      mariabackup based on MariaDB server 10.5.16-MariaDB debian-linux-gnu (x86_64)
      [00] 2022-07-15 13:30:22 cd to /root/xtrabackup_backupfiles/
      [00] 2022-07-15 13:30:22 open files limit requested 0, set to 1024
      [00] 2022-07-15 13:30:22 Loading encryption plugin from file_key_management=file_key_management
      [00] 2022-07-15 13:30:22 Loading encryption plugin
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--socket=/run/mysqld/mysqld.sock'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--pid-file=/run/mysqld/mysqld.pid'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--basedir=/usr'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--bind-address=127.0.0.1'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--expire_logs_days=10'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--character-set-server=utf8mb4'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--collation-server=utf8mb4_general_ci'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--plugin_load_add=file_key_management'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--file_key_management_filename=/etc/mysql//keyfile.enc'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--file_key_management_filekey=FILE:/etc/mysql/keyfile.key'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--file_key_management_encryption_algorithm=AES_CTR'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--innodb_encrypt_tables=FORCE'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--innodb_encrypt_log=ON'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--innodb_encrypt_temporary_tables=ON'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--innodb_encryption_threads=4'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--innodb_encryption_rotate_key_age=1'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--innodb_default_encryption_key_id=1'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--aria_encrypt_tables=ON'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--encrypt_tmp_disk_tables=ON'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--encrypt_tmp_files=ON'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--encrypt_binlog=ON'
      [00] 2022-07-15 13:30:22 	 Encryption plugin parameter :  '--prepare'
      mariabackup: Can't open shared library '/file_key_management.so' (errno: 2, cannot open shared object file: No such file or directory)
      2022-07-15 13:30:22 0 [ERROR] Couldn't load plugin 'file_key_management' from 'file_key_management.so'.
      [00] 2022-07-15 13:30:22 This target seems to be not prepared yet.
      [00] 2022-07-15 13:30:22 mariabackup: using the following InnoDB configuration for recovery:
      [00] 2022-07-15 13:30:22 innodb_data_home_dir = .
      [00] 2022-07-15 13:30:22 innodb_data_file_path = ibdata1:10M:autoextend
      [00] 2022-07-15 13:30:22 innodb_log_group_home_dir = .
      [00] 2022-07-15 13:30:22 InnoDB: Using Linux native AIO
      [00] 2022-07-15 13:30:22 Starting InnoDB instance for recovery.
      [00] 2022-07-15 13:30:22 mariabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter)
      2022-07-15 13:30:22 0 [Note] InnoDB: Uses event mutexes
      2022-07-15 13:30:22 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
      2022-07-15 13:30:22 0 [Note] InnoDB: Number of pools: 1
      2022-07-15 13:30:22 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
      2022-07-15 13:30:22 0 [Note] InnoDB: Using Linux native AIO
      2022-07-15 13:30:22 0 [Note] InnoDB: Initializing buffer pool, total size = 104857600, chunk size = 104857600
      2022-07-15 13:30:22 0 [Note] InnoDB: Completed initialization of buffer pool
      2022-07-15 13:30:22 0 [ERROR] InnoDB: Obtaining redo log encryption key version 1 failed (4294967295). Maybe the key or the required encryption key management plugin was not found.
      2022-07-15 13:30:22 0 [ERROR] InnoDB: Reading checkpoint encryption info failed.
      2022-07-15 13:30:22 0 [ERROR] InnoDB: No valid checkpoint found (corrupted redo log). You can try --innodb-force-recovery=6 as a last resort.
      2022-07-15 13:30:22 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
      [00] FATAL ERROR: 2022-07-15 13:30:22 mariabackup: innodb_init() returned 11 (Generic error).
      

      Attachments

        Activity

          bar Alexander Barkov added a comment - - edited

          Hello hholzgra.

          I can see two ways:
          1. Close this issue as Won't fix. Any changes can fix the problem for some installations, but introduce incompatibilities for other inatallations.

          2. Try to identify the machine somehow and detect implicit plugin-dir differently:

          • If --backup and --prepare is done on the same machine, then plugin-dir can be taken from backup-my.cnf.
          • Otherwise, taking plugin-dir from backup-my.cnf is rather meaningless. We could use the compiled default PLUGINDIR in such case (like you proposed in your patch).

          Can you please comment?

          bar Alexander Barkov added a comment - - edited Hello hholzgra . I can see two ways: 1. Close this issue as Won't fix. Any changes can fix the problem for some installations, but introduce incompatibilities for other inatallations. 2. Try to identify the machine somehow and detect implicit plugin-dir differently: If --backup and --prepare is done on the same machine, then plugin-dir can be taken from backup-my.cnf. Otherwise, taking plugin-dir from backup-my.cnf is rather meaningless. We could use the compiled default PLUGINDIR in such case (like you proposed in your patch). Can you please comment?

          When I created the patch I was not aware of the backup-my.cnf logic, and how this makes things behave differently depending on whether --target-dir was given explicitly or not.

          I'm actually not sure whether backup-my.cnf or compile time plugin-dir, or target machine my.cnf setting if available, should take precedence ...

          hholzgra Hartmut Holzgraefe added a comment - When I created the patch I was not aware of the backup-my.cnf logic, and how this makes things behave differently depending on whether --target-dir was given explicitly or not. I'm actually not sure whether backup-my.cnf or compile time plugin-dir, or target machine my.cnf setting if available, should take precedence ...

          Maybe a different / additional approach:

          When loading a plugin, make sure plugin_dir is not empty or

          {/}

          , and produce a more meaningful error message than:

          mariabackup: Can't open shared library '/file_key_management.so' (errno: 2, cannot open shared object file: No such file or directory)
          

          Something more like:

          Can't open plugin library as plugin_dir is not configured, try to set it explicitly with --plugin-dir option
          

          hholzgra Hartmut Holzgraefe added a comment - Maybe a different / additional approach: When loading a plugin, make sure plugin_dir is not empty or {/} , and produce a more meaningful error message than: mariabackup: Can't open shared library '/file_key_management.so' (errno: 2, cannot open shared object file: No such file or directory) Something more like: Can't open plugin library as plugin_dir is not configured, try to set it explicitly with --plugin-dir option
          serg Sergei Golubchik added a comment - - edited

          As far as I understand, the first bug that the customer complained about was explained in this comment. It should be fixed first. Then, it seems, the next bug to fix will be MDEV-23116, but let's fix the first one and wait for the confirmation.

          serg Sergei Golubchik added a comment - - edited As far as I understand, the first bug that the customer complained about was explained in this comment . It should be fixed first. Then, it seems, the next bug to fix will be MDEV-23116 , but let's fix the first one and wait for the confirmation.

          0c27922db7f is ok to push, thanks!

          serg Sergei Golubchik added a comment - 0c27922db7f is ok to push, thanks!

          People

            bar Alexander Barkov
            hholzgra Hartmut Holzgraefe
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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