[debian-mysql] Bug#852495: Bug#852495: Bug#852495: mariadb-server-10.[01]: purging old mariadb-server shuts down mariadb-server and removes init.d links

Julian Gilbey jdg at debian.org
Wed Jan 25 17:31:49 UTC 2017


On Wed, Jan 25, 2017 at 12:45:19PM +0200, Otto Kekäläinen wrote:
> I am happy to accept patches though for this issue if somebody else
> can better reproduce the problem and then verify that the patches work
> when written.

There is the major difficulty of fixing a broken package's postrm once
the package is no longer installed.

I think the only way to fix this retrospectively, then, is to edit the
other package's postrm script in the postinst.  This is generally bad
form, but this is the same package series maintained by the same
maintainers, so it is probably not a disaster.  (I couldn't find
anything about this in Debian Policy.)  It is certainly a really good
thing to fix it moving forwards.

Also, the same issue partly applies (I've just noticed) to some of the
mysql-server-* packages.  mysql-server-5.5 has it right: the
update-rc.d remove call is protected, but mysql-server-5.6 has it
wrong again, and also has other problematic parts.  The changes which
I suggest in my attached patch could presumably be applied there too,
but I haven't tested that.  (For the mysql-server-5.[67] packages,
debhelper would also have to be prevented from automatically including
most of the postrm snippets, and they would instead have to be
included manually, protected to only run when this was the last
instance of a mysql server.)

I have tested the attached patch on a machine which had the following
upgrade path:

mysql-server-5.5 -> mysql-server-5.6 -> mariadb-server-10.0 ->
mariadb-server-10.1 (10.1.20-3) -> mariadb-server-10.1 (10.1.21-1.1
with my patch installed)

then purging all of the old servers (the first three in the list
above) did not cause a problem.  (And wow, building mariadb-10.1 takes
ages!)

The attached patch is against 10.1.21-1.  The changes are as follows
(a couple of which are not necessary for this bug, but tidy up the
scripts or fix other small bugs); the ones with a double star are
essential for this bugfix:

debian/changelog
  * add new entry for this patch

debian/mariadb-server-10.1.lintian-overrides
  * update to match rest of patch

debian/mariadb-server-10.1.postinst
  * remove the invoke() function, just call invoke-rc.d directly
    (rather than "if [ -x ... ]", as invoke-rc.d is now in an essential
    package, and has been essential for a while)
  * move the code from after the "case "$1" in ... block to within the
    configure part of it, as it should have been anyway
 ** add code (somewhat tricky, modify with great care!) to mangle the
    postrm of any remaining old server packages; at present, it will
    touch any mysql-server-5.*.postrm, including any that aren't yet
    in Debian.  If mysql-server-5.8 is fixed, then this could be
    restricted to only touching mysql-server-5.[1-7].postrm and
    mariadb-server-10.0.postrm

debian/mariadb-server-10.1.postrm
 ** remove stop_server code completely; *our* server is not running by
    the time this script is called (our server was stopped in the
    prerm), and if a mysqld process is running, it belongs to a
    different mysql-server package (this partly prevents the bug from
    occurring in future packages)
  * fix a typo (sever -> server) ;-)
 ** include the relevant debhelper snippets manually where appropriate
    in the postrm (so the update-rc.d snippet is protected and only
    run if this is the final mysql server package to be purged)
 ** move the automatically installed #DEBHELPER# snippets after exit 0, 
    so that any future snippets added are obvious and can be manually
    copied into the earlier part of the postrm (alternatively, the
    #DEBHELPER# could just be removed, but this might lead to
    unexpected bugs in the future if changes in debhelper are not
    noticed)

debian/mariadb-server-10.1.preinst
  * call invoke-rc.d directly


I hope this is of significant benefit to all!

   Julian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mariadb-10.1_10.1.21-1.1.diff
Type: text/x-diff
Size: 8435 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-mysql-maint/attachments/20170125/88f1072c/attachment.diff>


More information about the pkg-mysql-maint mailing list