Skip to content

mariadb reads and get confused by /etc/mysql/ config files #2904

Description

@jefft

What happened?

Mariadb 11.4 (mariadb@latest) always seems to read /etc/mysql/mariadb.cnf, unless --no-defaults is specified. This causes mariadbd to fail to start if one has another version of MariaDB installed via system packages, with more extensive plugins. E.g. with debian mariadb-server-10.5 installed:

$ devbox run mariadbd --verbose 
Info: Running script "mariadbd" on /tmp/mariadbtest
2026-07-06 18:52:55 0 [Note] Starting MariaDB 11.0.4-MariaDB-log source revision 48af85db217a88409e6aac51bf86e3bf525d8f07 as process 938257
2026-07-06 18:52:55 0 [ERROR] mariadbd: Can't open shared library '/nix/store/23nb6k2y7cp4g46gbhpkq6pcc8l61y35-nix-shell-env/lib/mysql/plugin/provider_bzip2.so' (errno: 20, cannot open shared object file: Not a directory)
2026-07-06 18:52:55 0 [ERROR] Couldn't load plugins from 'provider_bzip2.so'.
2026-07-06 18:52:55 0 [ERROR] mariadbd: Can't open shared library '/nix/store/23nb6k2y7cp4g46gbhpkq6pcc8l61y35-nix-shell-env/lib/mysql/plugin/provider_lz4.so' (errno: 20, cannot open shared object file: Not a directory)
2026-07-06 18:52:55 0 [ERROR] Couldn't load plugins from 'provider_lz4.so'.
2026-07-06 18:52:55 0 [ERROR] mariadbd: Can't open shared library '/nix/store/23nb6k2y7cp4g46gbhpkq6pcc8l61y35-nix-shell-env/lib/mysql/plugin/provider_lzma.so' (errno: 20, cannot open shared object file: Not a directory)
2026-07-06 18:52:55 0 [ERROR] Couldn't load plugins from 'provider_lzma.so'.
2026-07-06 18:52:55 0 [ERROR] mariadbd: Can't open shared library '/nix/store/23nb6k2y7cp4g46gbhpkq6pcc8l61y35-nix-shell-env/lib/mysql/plugin/provider_lzo.so' (errno: 20, cannot open shared object file: Not a directory)
2026-07-06 18:52:55 0 [ERROR] Couldn't load plugins from 'provider_lzo.so'.
2026-07-06 18:52:55 0 [ERROR] mariadbd: Can't open shared library '/nix/store/23nb6k2y7cp4g46gbhpkq6pcc8l61y35-nix-shell-env/lib/mysql/plugin/provider_snappy.so' (errno: 20, cannot open shared object file: Not a directory)

The the goal of Devbox is "portable, isolated dev environments" then I suggest the devbox mariadbd wrapper should specify --no-defaults, so that stuff in /etc cannot interfere.

Steps to reproduce

mariadbd replication

# First let's create a setting in /etc that will trip up mariadbd:
echo -e "[server]\nunknown_param_to_break_mariadbd_devbox_testing=true" | sudo tee -a /etc/mysql/mariadb.cnf

# Create a devbox loaded with mariadb
mkdir /tmp/mariadbtest
cd /tmp/mariadbtest
devbox init
devbox add mariadb

devbox run mariadbd --verbose

On my PC, this command prints:

jturner@jturner-desktop:/tmp/mariadbtest$ devbox run mariadbd --verbose
Info: Running script "mariadbd" on /tmp/mariadbtest
Info: Ensuring packages are installed.
✓ Computed the Devbox environment.
Installing MariaDB/MySQL system tables in '/tmp/mariadbtest/.devbox/virtenv/mariadb/data' ...
2026-07-06 19:32:28 0 [ERROR] /tmp/mariadbtest/.devbox/nix/profile/default/bin/mariadbd: unknown variable 'unknown_param_to_break_mariadbd_devbox_testing=true'
2026-07-06 19:32:28 0 [ERROR] Aborting

Installation of system tables failed!  Examine the logs in
/tmp/mariadbtest/.devbox/virtenv/mariadb/data for more information.

The problem could be conflicting information in an external
my.cnf files. You can ignore these by doing:

    shell> /nix/store/91qvw7g5q01wrwmg10k6fp32336ymsk2-mariadb-wrapped/bin/.mysql_install_db-wrapped --defaults-file=~/.my.cnf

You can also try to start the mariadbd daemon with:

    shell> /tmp/mariadbtest/.devbox/nix/profile/default/bin/mariadbd --skip-grant-tables --general-log &

and use the command line tool /tmp/mariadbtest/.devbox/nix/profile/default/bin/mariadb
to connect to the mysql database and look at the grant tables:

    shell> /tmp/mariadbtest/.devbox/nix/profile/default/bin/mariadb -u root mysql
    MariaDB> show tables;

Try '/tmp/mariadbtest/.devbox/nix/profile/default/bin/mariadbd --help' if you have problems with paths.  Using
--general-log gives you a log in /tmp/mariadbtest/.devbox/virtenv/mariadb/data that may be helpful.

The latest information about mariadb-install-db is available at
https://mariadb.com/kb/en/installing-system-tables-mysql_install_db
You can find the latest source at https://downloads.mariadb.org and
the MariaDB discuss email list at https://lists.mariadb.org/postorius/lists/discuss.lists.mariadb.org/

Please check all of the above before submitting a bug report
at https://mariadb.org/jira

Error: error running script "mariadbd" in Devbox: exit status 7

(remember to remove the lines from /etc/mysql/mariadb.cnf afterwards)

mysqld replication

Surprisingly (to me) mysql@latest is the same thing as mariadb@latest:

mkdir /tmp/mysqltest
cd /tmp/mysqltest
devbox init
devbox add mysql
devbox run mysqld -V
Info: Running script "mysqld" on /tmp/mysqltest
/nix/store/73k5sh1dzmj77k9v6jpfxrjswixzw6s1-mariadb-wrapped/bin/.mysqld-wrapped  Ver 10.6.12-MariaDB-log for Linux on x86_64 (MariaDB Server)

Command

No response

devbox.json

Devbox version

0.17.5

Nix version

nix (Nix) 2.28.3

What system does this bug occur on?

Linux (x86-64)

Debug logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssue needs triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions