automysqlbackup is not backing up

Discussion in 'Installation/Configuration' started by intellivision, Nov 16, 2020.

  1. intellivision

    intellivision New Member

    I installed it a week-ish ago, and it make daily backups then of my various databases. But since, the daily still shows that single file from Nov 6:

    $ sudo ls -alsh /var/lib/automysqlbackup/daily/[database name]

    output:

    [database name]_2020-11-06_18h06m.Friday.sql.gz

    $ tail -f -n 330 /var/log/syslog shows nothing about automysqlbackup.

    Running it $ sudo automysqlbackup takes a minute, so it's doing something, but nothing is returned when it's done. No error reports etc. When I run it, it should create a daily(ies), correct?

    Where do I go from here? It's a recent Debian VM.
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    What version of debian? Do you have automysql starting from cron?
    Code:
    lsb_release -a
    ls -lh /etc/cron.daily/auto*
    cat  /etc/cron.daily/auto*
    ls -lhR /var/lib/automysqlbackup/
    
    If still problems, configure automysqlbackup to e-mail you the results of the run. See man page.
     
    intellivision likes this.
  3. intellivision

    intellivision New Member

    Thanks Taleman.

    Debian GNU/Linux 10 (buster)

    It's not configured to send email... I had trouble with mail components and so I shut them down. Is there a log in the filesystem for automysqlbackup? I looked but didn't find one.

    Code:
     ls -lh /etc/cron.daily/auto*
    -rwxr-xr-x 1 root root 80 Jul 23  2014 /etc/cron.daily/automysqlbackup
    Code:
    $ cat  /etc/cron.daily/auto*
    #!/bin/sh
    test -x /usr/sbin/automysqlbackup || exit 0
    /usr/sbin/automysqlbackup
    Code:
    $ sudo ls -lhR /var/lib/automysqlbackup/
    /var/lib/automysqlbackup/:
    total 12K
    drwxr-xr-x 11 root root 4.0K Nov  6 18:07 daily
    drwxr-xr-x  2 root root 4.0K Nov  6 18:06 monthly
    drwxr-xr-x 11 root root 4.0K Nov  6 18:07 weekly
    
    /var/lib/automysqlbackup/daily:
    total 36K
    drwxr-xr-x 2 root root 4.0K Nov  6 18:06 BAK
    drwxr-xr-x 2 root root 4.0K Nov  6 18:06 [database1]
    drwxr-xr-x 2 root root 4.0K Nov  6 18:06 [database2]
    drwxr-xr-x 2 root root 4.0K Nov  6 18:06 [database3]
    drwxr-xr-x 2 root root 4.0K Nov  6 18:06 [database4]
    drwxr-xr-x 2 root root 4.0K Nov  6 18:06 [database5]
    drwxr-xr-x 2 root root 4.0K Nov  6 18:07 [database6]
    drwxr-xr-x 2 root root 4.0K Nov  6 18:07 phpmyadmin
    drwxr-xr-x 2 root root 4.0K Nov  6 18:07 sys
    
    /var/lib/automysqlbackup/daily/BAK:
    total 4.0K
    -rw------- 1 root root 612 Nov  6 18:06 BAK_2020-11-06_18h06m.Friday.sql.gz
    
    /var/lib/automysqlbackup/daily/[database1]:
    total 120M
    -rw------- 1 root root 120M Nov  6 18:06 [database1]_2020-11-06_18h06m.Friday.sql.gz
    
    /var/lib/automysqlbackup/daily/[database2]:
    total 32K
    -rw------- 1 root root 32K Nov  6 18:06 [database2]_2020-11-06_18h06m.Friday.sql.gz
    
    /var/lib/automysqlbackup/daily/[database3]:
    total 4.0K
    -rw------- 1 root root 483 Nov  6 18:06 [database3]_2020-11-06_18h06m.Friday.sql.gz
    
    /var/lib/automysqlbackup/daily/[database4]:
    total 4.0K
    -rw------- 1 root root 609 Nov  6 18:06 [database4]_2020-11-06_18h06m.Friday.sql.gz
    
    /var/lib/automysqlbackup/daily/[database5]:
    total 640K
    -rw------- 1 root root 640K Nov  6 18:06 [database5]_2020-11-06_18h06m.Friday.sql.gz
    
    /var/lib/automysqlbackup/daily/[database6]:
    total 233M
    -rw------- 1 root root 233M Nov  6 18:06 [database6]_2020-11-06_18h06m.Friday.sql.gz
    
    /var/lib/automysqlbackup/daily/phpmyadmin:
    total 4.0K
    -rw------- 1 root root 493 Nov  6 18:07 phpmyadmin_2020-11-06_18h06m.Friday.sql.gz
    
    /var/lib/automysqlbackup/daily/sys:
    total 4.0K
    -rw------- 1 root root 481 Nov  6 18:07 sys_2020-11-06_18h06m.Friday.sql.gz
    
    /var/lib/automysqlbackup/monthly:
    total 0
    
    /var/lib/automysqlbackup/weekly:
    total 36K
    drwxr-xr-x 2 root root 4.0K Nov  6 18:06 BAK
    drwxr-xr-x 2 root root 4.0K Nov  6 18:06 [database1]
    drwxr-xr-x 2 root root 4.0K Nov  6 18:06 [database2]
    drwxr-xr-x 2 root root 4.0K Nov  6 18:06 [database3]
    drwxr-xr-x 2 root root 4.0K Nov  6 18:06 [database4]
    drwxr-xr-x 2 root root 4.0K Nov  6 18:06 [database5]
    drwxr-xr-x 2 root root 4.0K Nov  6 18:06 [database6]
    drwxr-xr-x 2 root root 4.0K Nov  6 18:07 phpmyadmin
    drwxr-xr-x 2 root root 4.0K Nov  6 18:07 sys
    
    /var/lib/automysqlbackup/weekly/BAK:
    total 0
    
    /var/lib/automysqlbackup/weekly/[database1]:
    total 0
    
    /var/lib/automysqlbackup/weekly/[database2]:
    total 0
    
    /var/lib/automysqlbackup/weekly/[database3]:
    total 0
    
    /var/lib/automysqlbackup/weekly/[database4]:
    total 0
    
    /var/lib/automysqlbackup/weekly/[database5]:
    total 0
    
    /var/lib/automysqlbackup/weekly/[database6]:
    total 0
    
    /var/lib/automysqlbackup/weekly/phpmyadmin:
    total 0
    
    /var/lib/automysqlbackup/weekly/sys:
    total 0
    
     
  4. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    What show
    Code:
    systemctl --state=failed
    systemctl status mariadb.service
    apt policy mariadb-server
    apt policy automysqlbackup
     
    intellivision likes this.
  5. intellivision

    intellivision New Member

    Code:
    $ systemctl --state=failed
    0 loaded units listed. Pass --all to see loaded but inactive units, too.
    To show all installed unit files use 'systemctl list-unit-files'.
    Code:
    $ systemctl status mariadb.service
    ● mariadb.service - MariaDB 10.3.25 database server
       Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
      Drop-In: /etc/systemd/system/mysql.service.d
               └─limits.conf
       Active: active (running) since Tue 2020-11-10 15:44:47 MST; 6 days ago
         Docs: man:mysqld(8)
               https://mariadb.com/kb/en/library/systemd/
      Process: 9976 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status
      Process: 9977 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, statu
      Process: 9981 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /
      Process: 10164 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, sta
      Process: 10167 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
     Main PID: 10121 (mysqld)
       Status: "Taking your SQL requests now..."
        Tasks: 49 (limit: 4915)
       Memory: 2.5G
       CGroup: /system.slice/mariadb.service
               └─10121 /usr/sbin/mysqld
    
    Nov 10 15:44:47 lamp-3-vm mysqld[10121]: 2020-11-10 15:44:47 0 [Note] /usr/sbin/mysqld (mysqld 10.3.25-MariaD
    Nov 10 15:44:47 lamp-3-vm mysqld[10121]: 2020-11-10 15:44:47 0 [Warning] Could not increase number of max_ope
    Nov 10 15:44:47 lamp-3-vm systemd[1]: Started MariaDB 10.3.25 database server.
    Nov 10 15:44:47 lamp-3-vm /etc/mysql/debian-start[10169]: Upgrading MySQL tables if necessary.
    Nov 10 15:44:47 lamp-3-vm /etc/mysql/debian-start[10172]: /usr/bin/mysql_upgrade: the '--basedir' option is a
    Nov 10 15:44:47 lamp-3-vm /etc/mysql/debian-start[10172]: Looking for 'mysql' as: /usr/bin/mysql
    Nov 10 15:44:47 lamp-3-vm /etc/mysql/debian-start[10172]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
    Nov 10 15:44:47 lamp-3-vm /etc/mysql/debian-start[10172]: This installation of MySQL is already upgraded to 1
    Nov 10 15:44:47 lamp-3-vm /etc/mysql/debian-start[10180]: Checking for insecure root accounts.
    Nov 10 15:44:48 lamp-3-vm /etc/mysql/debian-start[10190]: Triggering myisam-recover for all MyISAM tables and
    lines 1-29/29 (END)
    Code:
    $ apt policy mariadb-server
    mariadb-server:
      Installed: 1:10.3.25-0+deb10u1
      Candidate: 1:10.3.25-0+deb10u1
      Version table:
     *** 1:10.3.25-0+deb10u1 500
            500 http://security.debian.org/debian-security buster/updates/main amd64 Packages
            100 /var/lib/dpkg/status
         1:10.3.23-0+deb10u1 500
            500 http://deb.debian.org/debian buster/main amd64 Packages
    Code:
    $ apt policy automysqlbackup
    automysqlbackup:
      Installed: 2.6+debian.4-2
      Candidate: 2.6+debian.4-2
      Version table:
     *** 2.6+debian.4-2 500
            500 http://deb.debian.org/debian buster/main amd64 Packages
            100 /var/lib/dpkg/status
     
  6. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    I'm starting to run out of ideas. Things are installed and should be running daily but automysqlbackup made backups once on friday and not after that.
    What changes have you made to /etc/default/automysqlbackup ? Have you modified the automysqlbackup script file itself?
    Do you not see any error or warning messages when starting automysqlbackup from the command line?
    It is unfortunate you disabled e-mail. Looks like there is no other way to get log of what happens. Even local e-mail would be enough, so log could be sent to root account, for example.
     
    intellivision likes this.
  7. nhybgtvfr

    nhybgtvfr Active Member

    the cron job settings should be fine, so it should at least be trying to run.

    you could try adding something like
    Code:
    LOGFILE="/var/backup/db/data.log"
    
    to /etc/default/automysqlbackup, changing the log path to something suitable for you. should at least get a log then even without configuring mail,
    or if you want to run in manually, try something like the script here: https://serverfault.com/questions/4...-have-separate-databases-in-one-folder-with-g
    it'll send output to the screen, so you can see what it's doing.
     
    intellivision likes this.
  8. intellivision

    intellivision New Member

    Thanks Taleman and nhybgtvfr.

    Code:
    CONFIG_mysql_dump_username='xxx'
    CONFIG_mysql_dump_password='xxx'
    CONFIG_mysql_dump_host='localhost'
    CONFIG_backup_dir='/var/lib/automysqlbackup'
    CONFIG_do_monthly="01"
    CONFIG_do_weekly="5"
    CONFIG_rotation_daily=6
    CONFIG_rotation_weekly=35
    CONFIG_rotation_monthly=150
    CONFIG_mysql_dump_port=3306
    CONFIG_mysql_dump_compression='gzip'
    CONFIG_db_names=('xxx')
    CONFIG_mail_address='xxx'
    LOGFILE='/var/log/automysqlbackup.log'
    That's what I have in /etc/automysqlbackup/automysqlbackup.conf now. The xxx are of course sensitive data that I changed for this post.

    It just occurred to me this info might help.

    I get the same behavior on issuing $ sudo automysqlbackup ... nothing.

    Still the same:

    $ sudo ls -alsh /var/lib/automysqlbackup/daily/[database_name]
    total 233M
    4.0K drwxr-xr-x 2 root root 4.0K Nov 6 18:07 .
    4.0K drwxr-xr-x 11 root root 4.0K Nov 6 18:07 ..
    233M -rw------- 1 root root 233M Nov 6 18:06 [database_name]_2020-11-06_18h06m.Friday.sql.gz

    It's not writing a /var/log/automysqlbackup.log, but I didn't create the file. I don't know if Linux log system should create one on its own?

    Since it's running as root, I'd expect it would be able to create this file.

    To ensure /etc/automysqlbackup/automysqlbackup.conf is the only conf file:
    Code:
    $ locate automysqlbackup.conf
    /etc/automysqlbackup/automysqlbackup.conf
    /var/lib/dpkg/info/automysqlbackup.conffiles
    Do you think it could be reading /var/lib/dpkg/info/automysqlbackup.conffiles?
     
  9. intellivision

    intellivision New Member

    Oh my. I just re-read this and did a $ sudo ls -alsh /mnt/disks/attachments_storage/mysqlbackups/daily/[database_name] because that is the path in that file.

    BACKUPDIR="/mnt/disks/attachments_storage/mysqlbackups"

    and...

    Code:
    233M -rw-------  1 root root 233M Nov 12 06:25 [database_name]_2020-11-12_06h25m.Thursday.sql.gz
    233M -rw-------  1 root root 233M Nov 13 18:03 [database_name]_2020-11-13_16h24m.Friday.sql.gz
    232M -rw-------  1 root root 232M Nov 15 06:25 [database_name]_2020-11-15_06h25m.Sunday.sql.gz
    232M -rw-------  1 root root 232M Nov 16 11:38 [database_name]_2020-11-16_11h38m.Monday.sql.gz
    233M -rw-------  1 root root 233M Nov 17 09:29 [database_name]_2020-11-17_09h29m.Tuesday.sql.gz
    233M -rw-------  1 root root 233M Nov 18 14:18 [database_name]_2020-11-18_14h17m.Wednesday.sql.gz
    I configured it that way, and forgot. Then I went looking in the stock automysqlbackup location.

    I'm embarrassed. I was confused about the difference between /etc/default/automysqlbackup and the .conf file I mentioned. I suppose the .conf file is ignored, and /etc/default/automysqlbackup is the real configuration file.

    Thanks very much to both of you. My problem is solved. If you write anything more, I'll certainly read it.
     
    ahrasis likes this.

Share This Page