[debian-mysql] 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
Tue Jan 24 22:21:05 UTC 2017


Package: mariadb-server-10.1
Version: 10.1.21-1
Severity: normal

After upgrading to 10.1 from 10.0, I purged the old
mariadb-server-10.0 package, but this had two quite unpleasant
effects: it shut down the server and it removed the init.d links.
This is because:

(a) In the purge|remove|upgrade|... case, stop_server is executed
    unconditionally.  It is not obvious to me under what conditions
    the server should be stopped, but I would presume that at the very
    least, it should only be stopped if the running server is the same
    version as the package.  This could be tested (somewhat slowly but
    quite safely) by running:

    if [ -x /usr/sbin/mysqld ]
    then
        serverpackage=$(dpkg -S /usr/sbin/mysqld | cut -d: -f1)
        if [ $serverpackage = mariadb-server-core-$this_version ]
        then
            stop_server
            sleep 2
        fi
    fi

    The whole server-stopping is probably also in general somewhat
    unnecessary, as the server will have been stopped in the prerm
    anyway by the dh_installinit snippet.  And this may suffer from
    the same issue (though I am less convinced about this), and should
    probably be replaced by your stop_server script anyway.

    Oh, and for stretch, you don't need to test for the existence of
    invoke-rc.d, as it is now in the essential init-system-helpers
    package, so you can just do invoke-rc.d mysql stop
    unconditionally.

(b) The dh_installinit snippet unconditionally runs update-rc.d mysql
    remove.

    The only way I can think to fix this is to run dh_installinit with
    --no-scripts and then manually insert the necessary snippets into
    the postinst/postrm/prerm scripts.  In the postrm script, it
    should be protected by the same checks as in (a).

Best wishes,

   Julian



More information about the pkg-mysql-maint mailing list