Announcement Module
No announcement yet.

Error trying to run backup

Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error trying to run backup


    I am trying to use Xtrabackup for the first time on Ubuntu Server 12.10.

    I run into the following issue when trying to run a backup:

    tim@hostname:~$ innobackupex --user=root --password=password ~/InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oyand Percona Inc 2009-2012. All Rights Reserved.This software is published underthe GNU GENERAL PUBLIC LICENSE Version 2, June 1991.121205 23:08:28 innobackupex: Starting mysql with options: --password=xxxxxxxx --user='root' --unbuffered --121205 23:08:28 innobackupex: Connected to database with mysql child process (pid=8316)121205 23:08:34 innobackupex: Connection to database server closedIMPORTANT: Please check that the backup run completes successfully. At the end of a successful backup run innobackupex prints "completed OK!".innobackupex: Using mysql Ver 14.14 Distrib 5.5.28, for debian-linux-gnu (x86_64) using readline 6.2innobackupex: Using mysql server version Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.innobackupex: Created backup directory /home/tim/2012-12-05_23-08-34121205 23:08:34 innobackupex: Starting mysql with options: --password=xxxxxxxx --user='root' --unbuffered --121205 23:08:34 innobackupex: Connected to database with mysql child process (pid=8345)121205 23:08:36 innobackupex: Connection to database server closed121205 23:08:36 innobackupex: Starting ibbackup with command: xtrabackup_55 --defaults-group="mysqld" --backup --suspend-at-end --target-dir=/home/tim/2012-12-05_23-08-34innobackupex: Waiting for ibbackup (pid=8352) to suspendinnobackupex: Suspend file '/home/tim/2012-12-05_23-08-34/xtrabackup_suspended'xtrabackup_55 version 2.0.4 for Percona Server 5.5.16 Linux (x86_64) (revision id: undefined)xtrabackup: uses posix_fadvise().xtrabackup_55: Can't change dir to '/var/lib/mysql' (Errcode: 13)xtrabackup: cannot my_setwd /var/lib/mysqlinnobackupex: Error: ibbackup child process has died at /usr/bin/innobackupex line 378.

    The permissions on the /var/lib/mysql is set to mysql only:

    tim@hostname:~$ sudo ls -l /var/lib/mysql/total 5812244-rw-r--r-- 1 root root 0 Nov 28 12:40 debian-5.5.flag-rw-rw---- 1 mysql mysql 5941231616 Dec 5 23:08 ibdata1-rw-rw---- 1 mysql mysql 5242880 Dec 5 23:08 ib_logfile0-rw-rw---- 1 mysql mysql 5242880 Dec 5 23:07 ib_logfile1drwx------ 2 mysql root 4096 Nov 28 12:40 mysql-rw-rw---- 1 root root 6 Nov 28 12:40 mysql_upgrade_infodrwx------ 2 mysql mysql 4096 Nov 28 12:40 performance_schemadrwx------ 2 mysql mysql 4096 Dec 5 14:13 databasename

    If I change the permissions of this folder to allow 'other' to read the files then the backup works as expected.
    However, I have seen no mention elsewhere of having to do this so I think I'm doing something wrong?

    Any help is appreciated.

  • #2

    Error 13 means permission denied, so the user that you are using to run the backup (tim) can't access to /var/lib/mysql.

    This is the permissions by default on a Debian server:

    drwxr-xr-x 4 mysql mysql 4.0K Dec 5 14:41 mysql

    so I can access the directory with a normal user:

    test@debian:~$ whoami
    test@debian:~$ cd /var/lib/mysql/
    test@debian:/var/lib/mysql$ ls -lah
    total 29M
    drwxr-xr-x 4 mysql mysql 4.0K Dec 5 14:41 .
    drwxr-xr-x 31 root root 4.0K Dec 4 11:01 ..
    -rw-rw---- 1 mysql root 5.9K Dec 5 14:41 debian.err
    -rw-rw---- 1 mysql mysql 4.4K Dec 5 14:41 debian.log
    -rw-rw---- 1 mysql mysql 1.3K Dec 5 14:41 debian-slow.log
    -rw-rw---- 1 mysql mysql 18M Dec 5 14:40 ibdata1
    -rw-rw---- 1 mysql mysql 5.0M Dec 5 14:41 ib_logfile0
    -rw-rw---- 1 mysql mysql 5.0M Dec 4 11:04 ib_logfile1
    drwx------ 2 mysql root 4.0K Dec 4 11:04 mysql
    drwx------ 2 mysql mysql 4.0K Dec 4 11:04 performance_schema

    But I can't read the files inside:

    test@debian:/var/lib/mysql$ tail debian.log
    tail: cannot open `debian.log' for reading: Permission denied

    The recommendation is to not change the permissions of the files inside /var/lib/mysql because you are allowing non-root users to copy full tables (like mysql.users) or read password that are stored in clear text (for replication).

    Innobackupex should be run as root.