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

Lars Tangvald lars.tangvald at oracle.com
Mon Jan 30 09:45:44 UTC 2017



On 01/30/2017 10:28 AM, Robie Basak wrote:
> Hi Julian,
>
> Thank you for reporting this.
>
> On Mon, Jan 30, 2017 at 09:24:46AM +0100, Lars Tangvald wrote:
>> Anyone else have any good ideas on how to handle this?
> I think the root cause here is that both MySQL and MariaDB packaging
> "own" /var/lib/mysql. This causes confusion because even though the
> packages Conflict, one can still be purged while the other is installed.
>
> I think that sharing /var/lib/mysql in this way leads to a slew of bugs,
> and we should fix it in the long term so that the packaging doesn't do
> this.
>
> This is https://launchpad.net/bugs/1490071 and
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841345
>
> Unfortunately fixing this properly is quite involved. I've had time to
> think up a solution, but not had time to code it up yet, and I don't
> expect to have the necessary time in the next few months.
>
> Am I right in thinking that this could be triggered by installing MySQL
> in jessie, upgrading to stretch, installing MariaDB if it isn't already,
> and then purging MySQL? If so I agree with "serious" and so we should
> find some stop-gap solution in the short term until the full fix above
> can be implemented.
>
> Could we work on unifying MySQL and MariaDB's handling of this? Use the
> same debconf key and present the question for /var/lib/mysql in general,
> making it clear that it applies to both MySQL and MariaDB. Then on
> purge, if the answer was "yes, purge", then ask again to confirm that
> the user does actually want it deleted both for MySQL and MariaDB (not
> sure we can ask debconf questions in postrm though?). A goal should be
> that all the code handling creation and deletion of /var/lib/mysql
> should be common between MySQL and MariaDB. Either leave comments in the
> maintainer scripts, or put the code in mysql-common from
> src:mysql-defaults and Pre-Depend on it.
>
> Would this be acceptable, both from technical implementation and UX
> perspectives? Does Debian and/or stretch have string translation
> deadlines or freezes?
>
> Additionally we could have some hacks to try to determine if the
> counterpart variant is installed and not do anything if it is. I think
> hacks are fine in the short term because we have an open bug for a
> proper solution, and the seriousness of this issue (if as above)
> warrants it.
>
> Opinions appreciated.
>
> Robie
The trigger would basically just be to install and remove 
mysql-server-5.7 (which also happens when replacing it with a 
conflicting package), then install any other variant, then purge 
mysql-server-5.7.
I think an ok short-term solution is to make a .postrm script for 
mysql-server-core, and move the delete logic there with the check on 
/usr/sbin/mysqld restored, for both MariaDB and MySQL. Then we don't 
need to check on any specific packages, since we'd know any existing 
mysqld binary doesn't belong to the package being purged. If the user 
has installed a MariaDB, the deletion would be handled by 
mariadb-server-core being purged.

Looking at the debconf manual, only postinst is mentioned as a place not 
to use it (and it actually uses postrm and asking about deleting 
something as a usage example).

--
Lars



More information about the pkg-mysql-maint mailing list