Tuesday 28 February 2023

dbconfig-common and local databases


Today, installs like below fail in Ubuntu because dbconfig-common is
configured before a database is installed and configured:

apt install rsyslog-mysql
apt install rsyslog-pgsql
apt install phpmyadmin #1438706 #1649265
apt install bacula-director-mysql bacula #1116634
apt install redmine-mysql

There may be others.

The dbconfig-common (or dbconfig-mysql, ...) package cannot declare a
Depends or Recommends on the database server, because it could be
remote. It does declare a Suggests on the db server, though
(dbconfig-mysql suggests default-mysql-server, dbconfig-pgsql suggests
postgresql, and so on).

But this also doesn't work:

apt install mysql-server rsyslog-mysql

or this:

apt install postgresql-server rsyslog-pgsql

dbconfig-common is still configured before the DB server.

In the other cases I listed above, actually including the database
server in the same apt transaction works, but I'm inclined to believe
it's pure luck, as those are packages with more complex dependencies
and I think it's just chance that the DB server is installed first.
But I could be wrong, and that's why I'm sending this email:

is there something special that packages depending on dbconfig-common
should do, either in d/control, or in maintainer scripts, to avoid the
problem? Or is it just a "known issue", i.e., "you shall install and
configure the DB server first"?

But then, how to handle the case where the DB is remote? The only
chance one gets to input the remote system's details (ip and port), in
an interactive install, is after the postinst first fails: then you
get a menu with the options "abort, retry, retry (skip questions),
ignore", and if you "retry", then it actually asks you more detailed
questions about the database (is it remote, etc). Is this also the
expected workflow? Let it fail, then retry, and then provide the

And what about unattended installs? "apt install -y rsyslog-mysql
mysql-server" will fail, but "apt install -y mysql-server; apt install
-y rsyslog-mysql" will work. Or resort to debconf-set-selections?

I first encountered this when writing DEP8 tests for rsyslog-pgsql and
rsyslog-mysql: if I declared just the "rsyslog-pgsql" (or mysql)
dependency in the autopkgtest control file, the installation would
fail. I had to install the DB server via d/t/control dependencies, and
then inside the test itself install rsyslog-{pgsql,mysql}.

ubuntu-devel mailing list
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel