[debian-mysql] Bug#853008: mysql-server-5.7: purge could delete mariadb-server files with inadequate warning

Julian Gilbey jdg at debian.org
Sat Jan 28 21:21:13 UTC 2017


Package: mysql-server-5.7
Version: 5.7.16-2
Severity: serious

Hello!

I'm really confused by the change in the postrm introduced in response
to LP: #1602945, and I simply do not understand the rationale of the
original bug report, and the comment there (and in the git commit log)
that "Remove the check on the server binary, since it shouldn't be
possible for another package to own that file anyway" is clearly
incorrect: during a postrm remove|purge run, if that file exists -
which it may well do, it will certainly belong to a different package,
such as mysql-server-5.8 or mariadb-server-10.1.

Regarding upgrading, I have upgraded from mysql-5.6 to mariadb-10.0
with no noticeable problems whatsoever.  I have done a file comparison
looking for differences between /var/lib/mysql following this
mysql->mariadb conversion and a clean mariadb installation, and the
only ones I could see are:

mysql/ndb_binlog_index.*
mysql/slave_master_info.*
mysql/slave_relay_log_info.*
mysql/slave_worker_info.*
auto.cnf

If it is really the case the mariadb needs a different set of files
from mysql because of incompatibilities, then they should not share
the same /var/lib/mysql or it should be addressed in some other way:
mariadb could use /var/lib/mariadb instead, for instance, or the
mariadb installation could run some "clean up old /var/lib/mysql
directory from mysql instance" (which I think it already does).

So by removing the check on the existence of /usr/sbin/mysqld, you
leave sysadmins with the potential to inadvertantly wipe their entire
running mysql instance's database, for example if they purge an old
mysql-server-5.7 after installing mysql-server-5.8 at some point in
the future!

So as long as the various mysql/mariadb servers share the
/var/lib/mysql directory, the check for /usr/sbin/mysqld must be
reinstated: I cannot think of any situation in which rm -rf
/var/lib/mysql would be desired if /usr/sbin/mysqld is present, as
this means that there is some other package with responsibility for
/var/lib/mysql installed, and therefore this would fail the Debian
policy directive of not interferiyng with other packages' data.  (And
that is why I have labelled this bug as severity "serious".)  If a
sysadmin really wants to delete the directory in this situation, they
are welcome to do so manually.

The patch for this is simple: simply revert commit
554ecf472109f2b2e2fdfa0aaa0302cf2247ac1e

This would reopen the LP bug report, and I would ask the original
reporter there to explain the circumstances in which there are
problems, so that those can be addressed appropriately.

In addition, the current postrm_remove_databases debconf
question should be enhanced to explicitly mention mariadb.  I would
also suggest being even more explicit: instead of "the data should be
kept", say "do NOT remove the databases, and say NO to this question."

Best wishes,

   Julian



More information about the pkg-mysql-maint mailing list