Where does rt-setup-database get it's configuration?

Trying to use rt-setup-database from request-tracker 5.0.1 on Ubuntu 21.10. I do not understand where rt-setup-database gets the database configuration information.

The rt-setup-database script is defaulting to SQLite on the localhost

Working with:
Type:	SQLite
Host:	localhost
Port:
Name:	/var/lib/request-tracker5/rt5
User:	rt_user
DBA:	root
Failed to connect to dbi:SQLite:dbname=/var/lib/request-tracker5/rt5;host=localhost as user 'root': unable to open database filetanner@rt5:/usr/share/request-tracker5

I have the rt5 configuration in /etc/request-tracker5/RT_SiteConfig.d and Request Tracker itself is working as expected. It’s only the rt-setup-database script that isn’t working.

It looks like rt-setup-database can pull stuff from the environement

# set options from environment
foreach my $key(qw(Type Host Name User Password)) {
    next unless exists $ENV{ 'RT_DB_'. uc $key };
    print "Using Database$key from RT_DB_". uc($key) ." environment variable.\n";
    RT->Config->Set( "Database$key", $ENV{ 'RT_DB_'. uc $key });
}

But it also looks like the code is there for getting the configuration from where? I assumed it was the ubuntu package configured location of /etc/request-tracker5/RT_SiteConfig.d?

my $db_type = RT->Config->Get('DatabaseType') || '';
my $db_host = RT->Config->Get('DatabaseHost') || '';
my $db_port = RT->Config->Get('DatabasePort') || '';
my $db_name = RT->Config->Get('DatabaseName') || '';
my $db_user = RT->Config->Get('DatabaseUser') || '';
my $db_pass = RT->Config->Get('DatabasePassword') || '';

Any help would be appreciated.

I solved my own problem(?), under Ubuntu 21.10 (impish) there are files in /etc/request-tracker5/RT_SiteConfig.d/ that are not readable by a normal user. To protect the database password. Once I ran the script as root (via sudo) the database configuration was read and used as expected.

Shouldn’t the rt-setup-database script throw a permission error if it cannot read configuration files?

I’ll open an issue at https://rt.bestpractical.com/ and see what the developers tell me.
Login

Hi @Bob_Tanner, glad you found a fix. Based on the config file location, it looks like you installed from the request-tracker5 package, is that correct? If so, this might be a question for the Debian packagers.

There is an update in RT 5.0.2 that adds some logging when local configuration can’t be read and that might catch this. Were you running rt-setup-database directly as part of setting up a new RT?