Skip to content

[2.2.1] Magento Database Backup Command Fails (Fix included) #12877

@azeemism

Description

@azeemism

The magento backup command fails under magento 2.2.1. There was no such issue under magento 2.1.8. They are no errors in the database log.

Preconditions

  1. Magento composer install
www-data@skynet:~/example.com/magento/2.x/2.x$ php bin/magento -V
Magento CLI version 2.2.1
  1. Using MariaDB
root@skynet:~/.admin/scripts# dpkg -l | grep mariadb
ii  libmariadbclient18                   10.1.30+maria-1~jessie               amd64        MariaDB database client library
ii  mariadb-client                       10.1.30+maria-1~jessie               all          MariaDB database client (metapackage depending on the latest version)
ii  mariadb-client-10.1                  10.1.30+maria-1~jessie               amd64        MariaDB database client binaries
ii  mariadb-client-core-10.1             10.1.30+maria-1~jessie               amd64        MariaDB database core client binaries
ii  mariadb-common                       10.1.30+maria-1~jessie               all          MariaDB database common files (e.g. /etc/mysql/conf.d/mariadb.cnf)
ii  mariadb-server                       10.1.30+maria-1~jessie               all          MariaDB database server (metapackage depending on the latest version)
ii  mariadb-server-10.1                  10.1.30+maria-1~jessie               amd64        MariaDB database server binaries
ii  mariadb-server-core-10.1             10.1.30+maria-1~jessie               amd64        MariaDB database core server files
root@skynet:~/.admin/scripts# dpkg -l | grep mysql
ii  dovecot-mysql                        1:2.2.13-12~deb8u3                   amd64        secure POP3/IMAP server - MySQL support
ii  libclass-dbi-mysql-perl              1.00-3                               all          extensions to Class::DBI for MySQL
ii  libdbd-mysql-perl                    4.028-2+deb8u2                       amd64        Perl5 database interface to the MySQL database
ii  libmysqlclient18                     10.1.30+maria-1~jessie               amd64        Virtual package to satisfy external depends
ii  libqt4-sql-mysql:amd64               4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1 amd64        Qt 4 MySQL database driver
ii  libtime-piece-mysql-perl             0.06-2                               all          module adding MySQL-specific methods to Time::Piece
ii  mariadb-common                       10.1.30+maria-1~jessie               all          MariaDB database common files (e.g. /etc/mysql/conf.d/mariadb.cnf)
ii  mysql-common                         10.1.30+maria-1~jessie               all          MariaDB database common files (e.g. /etc/mysql/my.cnf)
ii  php5-mysqlnd                         5.6.30+dfsg-0+deb8u1                 amd64        MySQL module for php5 (Native Driver)
ii  php7.0-mysql                         7.0.26-1~dotdeb+8.2                  amd64        MySQL module for PHP
ii  postfix-mysql                        2.11.3-1+deb8u2                      amd64        MySQL map support for Postfix
ii  roundcube-mysql                      1.2.3+dfsg.1-4+deb9u1                all          metapackage providing MySQL dependencies for RoundCube
  1. Using PHP7
root@skynet:~/.admin/scripts# dpkg -l | grep php7
rc  libapache2-mod-php7.0                7.0.14-1~dotdeb+8.1                  amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php7.0                               7.0.26-1~dotdeb+8.2                  all          server-side, HTML-embedded scripting language (metapackage)
ii  php7.0-bcmath                        7.0.26-1~dotdeb+8.2                  amd64        Bcmath module for PHP
ii  php7.0-cli                           7.0.26-1~dotdeb+8.2                  amd64        command-line interpreter for the PHP scripting language
ii  php7.0-common                        7.0.26-1~dotdeb+8.2                  amd64        documentation, examples and common module for PHP
ii  php7.0-curl                          7.0.26-1~dotdeb+8.2                  amd64        CURL module for PHP
ii  php7.0-dev                           7.0.26-1~dotdeb+8.2                  amd64        Files for PHP7.0 module development
ii  php7.0-fpm                           7.0.26-1~dotdeb+8.2                  amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php7.0-gd                            7.0.26-1~dotdeb+8.2                  amd64        GD module for PHP
ii  php7.0-igbinary                      2.0.1-1~dotdeb+8.1                   amd64        igbinary serializer for PHP
ii  php7.0-imagick                       3.4.3-1~dotdeb+8.1                   amd64        Provides a wrapper to the ImageMagick library
ii  php7.0-intl                          7.0.26-1~dotdeb+8.2                  amd64        Internationalisation module for PHP
ii  php7.0-json                          7.0.26-1~dotdeb+8.2                  amd64        JSON module for PHP
ii  php7.0-mbstring                      7.0.26-1~dotdeb+8.2                  amd64        MBSTRING module for PHP
ii  php7.0-mcrypt                        7.0.26-1~dotdeb+8.2                  amd64        libmcrypt module for PHP
ii  php7.0-mysql                         7.0.26-1~dotdeb+8.2                  amd64        MySQL module for PHP
ii  php7.0-opcache                       7.0.26-1~dotdeb+8.2                  amd64        Zend OpCache module for PHP
ii  php7.0-pspell                        7.0.26-1~dotdeb+8.2                  amd64        pspell module for PHP
ii  php7.0-readline                      7.0.26-1~dotdeb+8.2                  amd64        readline module for PHP
ii  php7.0-redis                         3.1.3-1~dotdeb+8.1                   amd64        PHP extension for interfacing with Redis
ii  php7.0-soap                          7.0.26-1~dotdeb+8.2                  amd64        SOAP module for PHP
ii  php7.0-xml                           7.0.26-1~dotdeb+8.2                  amd64        DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii  php7.0-xmlrpc                        7.0.26-1~dotdeb+8.2                  amd64        XMLRPC-EPI module for PHP
ii  php7.0-xsl                           7.0.26-1~dotdeb+8.2                  all          XSL module for PHP (dummy)
ii  php7.0-zip                           7.0.26-1~dotdeb+8.2                  amd64        Zip module for PHP

  1. OS
root@skynet:~/.admin/scripts# uname -a
Linux skynet 3.16.0-4-amd64 #1 SMP Debian 3.16.51-2 (2017-12-03) x86_64 GNU/Linux
  1. composer.json
{
    "name": "magento/project-community-edition",
    "description": "eCommerce Platform for Growth (Community Edition)",
    "type": "project",
    "version": "2.1.1",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "require": {
        "magento/product-community-edition": "2.2.1",
        "composer/composer": "@alpha",
        "magento/magento-composer-installer": "^0.1.12",
        "geoip2/geoip2": "^2.4",
        "webshopapps/module-matrixrate": "^20.1"
    },
    "require-dev": {
        "phpunit/phpunit": "4.1.0",
        "squizlabs/php_codesniffer": "1.5.3",
        "phpmd/phpmd": "@stable",
        "pdepend/pdepend": "2.2.2",
        "fabpot/php-cs-fixer": "~1.2",
        "lusitanian/oauth": "~0.3 <=0.7.0",
        "sebastian/phpcpd": "2.0.0"
    },
    "config": {
        "use-include-path": true
    },
    "autoload": {
        "psr-4": {
            "Magento\\Framework\\": "lib/internal/Magento/Framework/",
            "Magento\\Setup\\": "setup/src/Magento/Setup/",
            "Magento\\": "app/code/Magento/"
        },
        "psr-0": {
            "": "app/code/"
        },
        "files": [
            "app/etc/NonComposerComponentRegistration.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Magento\\Sniffs\\": "dev/tests/static/framework/Magento/Sniffs/",
            "Magento\\Tools\\": "dev/tools/Magento/Tools/",
            "Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/",
            "Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
            "Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/"
        }
    },
    "minimum-stability": "alpha",
    "prefer-stable": true,
    "repositories": [
        {
            "type": "composer",
            "url": "https://repo.magento.com/"
        }
    ],
    "extra": {
        "magento-force": "override"
    }
}

Steps to reproduce

  1. php bin/magento setup:backup --code --media --db
  2. php bin/magento setup:backup --db

Expected result

  1. [SUCCESS]: DB backup completed successfully.

Actual result

www-data@skynet:~/example.com/magento/2.x/2.x$ php bin/magento setup:backup --code --media --db

Enabling maintenance mode
Code backup is starting...
Code backup filename: 1514213089_filesystem_code.tgz (The archive can be uncompressed with 7-Zip on Windows systems)
Code backup path: /var/www/example.com/magento/2.x/2.x/var/backups/1514213089_filesystem_code.tgz
[SUCCESS]: Code backup completed successfully.
Media backup is starting...
Media backup filename: 1514213089_filesystem_media.tgz (The archive can be uncompressed with 7-Zip on Windows systems)
Media backup path: /var/www/example.com/magento/2.x/2.x/var/backups/1514213089_filesystem_media.tgz
[SUCCESS]: Media backup completed successfully.
DB backup is starting...
Warning: Division by zero in /var/www/example.com/magento/2.x/2.x/vendor/magento/module-backup/Model/Db.php on line 157
Disabling maintenance mode
PHP Fatal error:  Uncaught Exception: User Error: Some transactions have not been committed or rolled back in /var/www/example.com/magento/2.x/2.x/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 3864 in /var/www/example.com/magento/2.x/2.x/vendor/magento/framework/App/ErrorHandler.php:61
Stack trace:
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(256, 'Some transactio...', '/var/www/vitami...', 3864, Array)
#1 /var/www/example.com/magento/2.x/2.x/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(3864): trigger_error('Some transactio...', 256)
#2 [internal function]: Magento\Framework\DB\Adapter\Pdo\Mysql->__destruct()
#3 {main}
  thrown in /var/www/example.com/magento/2.x/2.x/vendor/magento/framework/App/ErrorHandler.php on line 61

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Format is validGate 1 Passed. Automatic verification of issue format passed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions