Skip to content

MySQL/MariaDB backup with DB0X_SPLIT_DB=FALSE produces empty dump (undefined $mysqldump_bin instead of $_mysqldump_bin) #496

Description

@futureman2007

Description

When DB0X_SPLIT_DB=FALSE (the default, used for combined "ALL databases" dumps),
the MySQL/MariaDB backup command silently produces an empty output file instead
of a real dump.

Root cause

In rootfs/container/functions/10-dbbackup, the dump command differs between
the two DB0X_SPLIT_DB code paths:

  • SPLIT_DB=TRUE (per-database dump, line ~620):
    ${_mysql_prefix}${_mysqldump_bin} ... — correct.
  • SPLIT_DB=FALSE (combined "ALL" dump, line ~641):
    ${_mysql_prefix}${mysqldump_bin} ... — missing the leading underscore.

_mysqldump_bin (with underscore) is the variable actually set earlier in the
client-selection block (mariadb-dump or mysqldump, depending on
DB0X_MYSQL_CLIENT). mysqldump_bin (without underscore) is never assigned
anywhere in the image. In the SPLIT_DB=FALSE branch it therefore expands to
an empty string, so the command that actually runs is just
${_mysql_prefix} (e.g. /usr/bin/ or /opt/mysql/bin/) with all the dump
flags as arguments - which fails immediately and produces zero stdout. That
gets piped into the compression step regardless, so the job "succeeds" and
writes a tiny (e.g. 13-byte) file that looks like a valid but empty backup -
no error is surfaced at the top level.

Steps to reproduce

  1. Run the container against any MySQL or MariaDB server with:
    • DB01_TYPE=mysql (or mariadb)
    • DB01_NAME=ALL
    • DB01_SPLIT_DB=FALSE (or unset, since FALSE is the default)
    • valid DB01_HOST/DB01_USER/DB01_PASS
  2. Let the backup job run (MODE=MANUAL, backup-now, or the scheduler).
  3. Inspect the resulting .sql.zst/.sql.gz file in the backup location.

Expected

A real SQL dump of all databases.

Actual

A near-empty file (just the compression format's empty-stream header, e.g.
13 bytes for zstd) - mysqldump/mariadb-dump was never actually invoked.

Suggested fix

In the SPLIT_DB=FALSE branch, change:

${_mysql_prefix}${mysqldump_bin}

to:

${_mysql_prefix}${_mysqldump_bin}

matching the SPLIT_DB=TRUE branch above it.

Environment

  • Image: docker.io/nfrastack/db-backup
  • Confirmed via source inspection against the current default branch.

Activity

  1. locked and limited conversation to collaborators on Sep 4, 2026
  2. converted this issue into a discussion #536 on Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions