executing "mariabackup --prepare --export" on a server with the original mariadb server process running fails if innodb_undo_directory is set (to an absolute path) as the newly started process cannot get the lock on the undo files.
How to reproduce:
- set innodb_undo_tablespaces to 3 (this is probably irrelevant)
- set innodb_undo_directory to an absolute path and restart mariadb
- create a backup with "mariabackup --backup --defaults-file=<path_to_original_my.cnf>"
- run "mariabackup --prepare --export"
In the log file (*.err) you will find some errors:
[ERROR] InnoDB: Unable to lock <innodb_undo_directory>/undo001 error: 11
The reason is that innodb_undo_directory is set in backup-my.cnf to the same path as for the original server.
If you comment out or delete innodb_undo_directory from backup-my.cnf, running mariabackup with export works fine.
So the fix would be not to include innodb_undo_directory in backup-my.cnf during backup.