3

All:

I'm trying to set up regularly-scheduled backups of our MariaDB cluster with mariabackup, and have set up an account for this purpose. The account is a member of group mysql. But when I run the backup as that user:

$ mariabackup --backup -u [myid] -p [password]
mariabackup: Generating a list of tablespaces
2017-12-08 17:49:07 140352620800128 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2017-12-08 17:49:07 140352620800128 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
mariabackup: error: xb_load_tablespaces() failed witherror code 11

If I run with sudo -u mysql, the exact same command works fine.

Is there a way to turn on extra debugging or verbosity so I can see WHICH file or directory it's having trouble accessing?

MariaDB v10.2.11, CentOS 7 (x86_64)

  • That's the problem. I don't know what the files/directories in question are, because it's not telling me what it's barfing on. As far as I can tell, all the relevant stuff has rw permissions for owner and group mysql, and the directories also have x for owner/group. But it's entirely possible I missed one. That's why it would be nice if there were a way to get it to tell me exactly where it's hitting the error 13. – Thomas J. Girsch Dec 10 '17 at 23:40
  • Disregard above comment, which was intended as a reply to the first answer given below. – Thomas J. Girsch Dec 11 '17 at 16:31

3 Answers3

2

I was able to use the strace command to figure out what was going on. There were two problems. The first is that there was no group write permission on the output directory, so it failed to create the xtrabackup_backupfiles directory. The second is that there were two database directories in /var/lib/mysql that lacked group r-x permission. By fixing these two issues, I was able to get it to work.

Still, it would be nice if the error message actually indicated what specifically it didn't have permission on, rather than simply reporting that it lacked permission for something.

1

13 is, as it indicates "Permission denied". What does ls -l (or ls -ld) say is the ownership and permissions for the files/directories in question?

11 probably means out of disk space, but it could be a fallout of the '13'. It means "Resource temporarily unavailable".

Rick James
  • 78,038
  • 5
  • 47
  • 113
  • 1
    That's the problem. I don't know what the files/directories in question are, because it's not telling me what it's barfing on. As far as I can tell, all the relevant stuff has rw permissions for owner and group mysql, and the directories also have x for owner/group. But it's entirely possible I missed one. That's why it would be nice if there were a way to get it to tell me exactly where it's hitting the error 13. – Thomas J. Girsch Dec 11 '17 at 16:30
-1

Fixing the MYSQL failed to start due to the 13 Permission Denied OS Error. How I solved it on the server

First, read the MSYQL error log located /var/log/mysql. You can do so by using cat error.log command. Run the following commands:

  1. chown mysql:adm /var/log/mysql/error.log
  2. chown mysql:adm /var/log/mysql
  3. chown root:syslog /var/log
  4. chown root:root /var
  5. chmod 0640 /var/log/mysql/error.log
  6. chmod 0750 /var/log/mysql
  7. chmod 0775 /var/log
  8. chmod 0755 /var
  9. chown mysql.mysql -R /var/lib/mysql
  10. systemctl start mysql.service
  11. systemctl status mysql.service

NOTE: The command on the 3rd last line of the snippet/commands sets the mysql user and group to mysql and after all that, your MySQL Server will start properly. Thank me later.