Make initialize-database fails on Ubuntu 24 LTS with MariaDB 11.4.7

Hi.

Trying to install RT 5.0.8 (+RT::IR 5.0.8), the recommendation in the source distribution’s README.MariaDB says one should run configure with the explicit option --with-db-type=MariaDB (as of RT 5.0.6 onwards). Having that and running make initialize-database gives (an extract from the end):

/opt/perl5/perls/dev/bin/perl -I/opt/myrt508/local/lib -I/opt/myrt508/lib sbin/rt-setup-database --action init --prompt-for-dba-password
In order to create or update your RT database, this script needs to connect to your MariaDB instance on localhost (port ‘’) as root
Please specify that user’s database password below. If the user has no database
password, just press return.

Password:
Working with:
Type: MariaDB
Host: localhost
Port:
Name: myrtdb
User: rtir
DBA: root
Failed to connect to dbi:MariaDB:dbname=myrtdb;host=localhost as user ‘root’: Unknown database 'myrtdb’make: *** [Makefile:394: initialize-database] Error 255

Any ideas why it whines about the connection failure to myrtdb? According to specs, make initialize-database should be fully able to create the database if it does not exist and then populate it.

Br, Mika

PS: mariadb runs happily on port 3306 and answers to requests

Can you connect as root to mysql shell?

Yes, root has access to a local socket for accessing mysql, no password needed. Our mysql is in reality a mariadb under the hood. This change of db engine was due to mysql > v5.7 (if I remember correctly) being incompatible with RT 5.0.x series when we upgraded from a 4.2.x series RT.

Does the database exist? Does the rtir user have permissions on it?

I’ve always used the mysql/mariadb cmdline to create an empty database and grant access, and not had any issues. (Though mostly I’ve been importing an existing database and upgrading, not initializing.)

What does your configure line look like? I see some custom values in your output like the DB user, DB name, etc. Those should be fine, but even with --with-db-type=MariaDB, the config for $DatabaseType should still be mysql. So in the output above, “Type” should be mysql. Did you set that manually?

Right now, we only use the different DB type flag passed to configure to make sure you load the right version of DBD::mysql.

I have a semi-automated install+override+upgrade system for RT+RT::IR. The failure with the database happened already at the install stage when an empty database is created from scratch. In the override phase we drop the initial database and restore the older database. In the upgrade phase we upgrade this older database.

Our configure command looked like:

./configure --prefix=/opt/rt508 --enable-graphviz --enable-gd --enable-gpg --with-db-type=MariaDB --with-db-database=myrtdb --with-db-rt-user=rtir --with-db-rt-pass=(REMOVED) --with-web-user=www-data --with-web-group=www-data --with-web-handler=fastcgi

In the sources of rt-5.0.8.tar.gz there is the README.MariaDB that recommends setting --with-d-type=MariaDB explicitly from RT v5.0.6 onwards, so yes, I set it. However, this fails. Setting it explicitly to “mysql” allows the upgrade to finish (looks like successfully).

That documentation is correct. And in RT 5.0.8, setting --with-db-type=MariaDB is used to make sure the correct version of the DBD::mysql module is installed. In the RT_Config.pm file, the configuration option $DatabaseType will still be set to mysql. That’s the part that was somehow different in your configuration.

Well, it’s nice to get a confirmation that setting --with-db-type=MariaDB was correct. However, as said, in our case using this setting instead of --with-db-type=mysql, makes “make initialize-database” fail to create the initial empty database. I’d be really interested in knowing why. Is it possible there are no controls (or failing controls) of the actual DBD::mysql module version installed when using --with-db-type=MariaDB? IOW, is it possible to set the db type to MariaDB but the make machinery does not react correctly to a (possibly) too old version of DBD::mysql? If someone could retry this setup on a similar machine …

As noted above, the place to check after running with --with-db-type=MariaDB is etc/RT_Config.pm. $DatabaseType is set there based on what you passed to configure. In RT 5.0.8, that should be mysql, not MariaDB. If you are seeing that set to MariaDB, then there is a bug somewhere. We don’t see that in our testing, but I haven’t done a recent test on Ubuntu.

Ok, I’ll try to debug this in my setup with that in mind and see what happens. Anyway, isn’t the name of the option “–with-db-type” a bit misleading? If this is meant to be for forcing the install of an older DBD::mysql compatible with MariaDB, it should say so and not lead to the immediate but false assumption of “btw, this is the database type I want”, right? I’d rename it to --with-db-compatibility-type, --with-db-driver-compatibility or similar.

I think I found it.

It is due to our tailoured RT_SiteConfig.pm template that in itself is subject to an m4 macro substitution. In it, we define Set($DatabaseType, _OUR_DATABASE_TYPE); with the intent of being able to switch the underlying database implementation at will just by changing the value of _OUR_DATABASE_TYPE. Thus, as a result we get Set($DatabaseType, "MariaDB");.

What I didn’t notice is that in rt-5.0.8/configure.ac there’s a mapping:

dnl DATABASE_TYPE
if test “$DB_TYPE” = “mysql5” || test “$DB_TYPE” = “MariaDB”; then
DATABASE_TYPE=“mysql”
else
DATABASE_TYPE=“$DB_TYPE”
fi

that changes the database type back to mysql even if --with-db-type is set to MariaDB.
And as we ignore any generated RT_Config.pm in our semi-automated install system,
this mapping will never have any effect on our RT_SiteConfig.pm template either.

I guess this is the reason, and the out-of-the-box RT installation system works as expected.