Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-37580

mariadb server 10.11 - wrong debhelper init / systemd order in postinst script for debian 11 / ubuntu 2204

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.11.14
    • None
    • Packaging
    • None

    Description

      Background:

      MariaDB Server 10.11 packages are built with debian/compat == 11: https://github.com/MariaDB/server/commit/bccdc72536707480e04b2c5b069eaff873aca80e

      Other server versions e.g. 11.4, 11.8, ... are built with debian/compat == 10. Was changed back to 10 by this merge commit: https://github.com/MariaDB/server/commit/80abd847daf736cf8e57e83241c2e6fed74b4ed3

      Debian does not recommend using 11: https://manpages.debian.org/testing/debhelper/debhelper-compat-upgrade-checklist.7.en.html
      "The compat 11 is discouraged for new packages as it suffers from feature interaction between dh_installinit and dh_installsystemd causing services to not run correctly in some cases."

      Issue:

      See MDBF investigation: > MDBF-1112
      See for example debian 11 mariadb upgrade from distro version: https://buildbot.mariadb.org/#/builders/1061/builds/1

      After analyzing why the server has not been restarted post upgrading the packages I noticed that:

      • the service unmask and enable (dh_systemd_enable/13.3.4) are added AFTER the restart (dh_installinit/13.3.4) in the postinst script.

      A simple test will reveal that:

      invoke-rc.d mariadb start
      

      returns exit code 0 if the service is masked or disabled and this is why I guess the install scripts don't fail.

      I was checking the past releases and discovered this has happened between:

      • 14 MAY 2024 (MariaDB 10.11.8 deb 11 amd64) - order is unmask, enable, restart
      • 07 AUG 2024 (MariaDB 10.11.9 deb 11 amd64) - order is restart, unmask, enable

      Which corresponds to the commit date when debian/compat was changed to 11.

      Zulip discussions for more details: https://mariadb.zulipchat.com/#narrow/channel/236699-Buildbot/topic/MDBF-1112/with/538137826

      Steps to reproduce:

      1. With debian/compat == 11 (as in 10.11 branch)
          $ git checkout 10.11
          $ debian/autobake-deb.sh
          $ dpkg-deb -e mariadb-server_10.11.15+maria~deb11_amd64.deb pkg-control
          $ cat pkg-control/postinst
      

      2. With debian/compat == 10 (as in 11.4, 11.8, ...)
          $ git checkout 10.11
       
          diff --git a/debian/compat b/debian/compat
          index b4de3947675..f599e28b8ab 100644
          --- a/debian/compat
          +++ b/debian/compat
          @@ -1 +1 @@
          -11
          +10
       
          $ debian/autobake-deb.sh
          $ dpkg-deb -e mariadb-server_10.11.15+maria~deb11_amd64.deb pkg-control
          $ cat pkg-control/postinst
      

      Diff shows the reversed order:

      $ diff postinst postinst_1
      297c297,310
      < # Automatically added by dh_systemd_enable/13.3.4
      ---
      > # Automatically added by dh_installinit/13.3.4
      > if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
      > 	if [ -x "/etc/init.d/mariadb" ]; then
      > 		update-rc.d mariadb defaults 19 21 >/dev/null
      > 		if [ -n "$2" ]; then
      > 			_dh_action=restart
      > 		else
      > 			_dh_action=start
      > 		fi
      > 		invoke-rc.d mariadb $_dh_action || exit 1
      > 	fi
      > fi
      > # End automatically added section
      > # Automatically added by dh_installsystemd/13.3.4
      311,323d323
      < 	fi
      < fi
      < # End automatically added section
      < # Automatically added by dh_installinit/13.3.4
      < if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
      < 	if [ -x "/etc/init.d/mariadb" ]; then
      < 		update-rc.d mariadb defaults 19 21 >/dev/null
      < 		if [ -n "$2" ]; then
      < 			_dh_action=restart
      < 		else
      < 			_dh_action=start
      < 		fi
      < 		invoke-rc.d mariadb $_dh_action || exit 1
      

      Attachments

        Issue Links

          Activity

            People

              otto Otto Kekäläinen
              rvarzaru Varzaru Razvan-Liviu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.