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

MariaDB 10.4 install fails on Ubuntu 18.04 if Prometheus mysqld_exporter is running

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 10.4.6
    • Fix Version/s: 10.4.7
    • Component/s: Platform Debian
    • Labels:
      None
    • Environment:
      Ubuntu 18.04, Docker, Prometheus mysqld_exporter

      Description

      While attempting to upgrade an Ubuntu 18.04 LTS server from MariaDB 10.3 to MariaDB 10.4 I ran into an issue where the Debian installation script failed with an error.

      Example:

      # apt-get dist-upgrade
      Reading package lists... Done
      Building dependency tree       
      Reading state information... Done
      Calculating upgrade... Done
      The following packages will be REMOVED:
        galera-3 mariadb-client-10.3 mariadb-client-core-10.3 mariadb-server-10.3 mariadb-server-core-10.3
      The following NEW packages will be installed:
        galera-4 mariadb-client-10.4 mariadb-client-core-10.4 mariadb-server-10.4 mariadb-server-core-10.4
      The following packages will be upgraded:
        mariadb-client mariadb-common mariadb-server mysql-common
      4 upgraded, 5 newly installed, 5 to remove and 0 not upgraded.
      Need to get 22.1 MB of archives.
      After this operation, 9,398 kB of additional disk space will be used.
      Do you want to continue? [Y/n] 
      Get:1 https://mirror.one.com/mariadb/repo/10.4/ubuntu bionic/main amd64 mysql-common all 1:10.4.6+maria~bionic [5,596 B]
      Get:2 https://mirror.one.com/mariadb/repo/10.4/ubuntu bionic/main amd64 mariadb-common all 1:10.4.6+maria~bionic [3,524 B]
      Get:3 https://mirror.one.com/mariadb/repo/10.4/ubuntu bionic/main amd64 mariadb-server all 1:10.4.6+maria~bionic [3,180 B]
      Get:4 https://mirror.one.com/mariadb/repo/10.4/ubuntu bionic/main amd64 galera-4 amd64 26.4.2-bionic [9,378 kB]
      Get:5 https://mirror.one.com/mariadb/repo/10.4/ubuntu bionic/main amd64 mariadb-client all 1:10.4.6+maria~bionic [3,052 B]
      Get:6 https://mirror.one.com/mariadb/repo/10.4/ubuntu bionic/main amd64 mariadb-client-10.4 amd64 1:10.4.6+maria~bionic [1,167 kB]
      Get:7 https://mirror.one.com/mariadb/repo/10.4/ubuntu bionic/main amd64 mariadb-client-core-10.4 amd64 1:10.4.6+maria~bionic [777 kB]
      Get:8 https://mirror.one.com/mariadb/repo/10.4/ubuntu bionic/main amd64 mariadb-server-core-10.4 amd64 1:10.4.6+maria~bionic [6,276 kB]
      Get:9 https://mirror.one.com/mariadb/repo/10.4/ubuntu bionic/main amd64 mariadb-server-10.4 amd64 1:10.4.6+maria~bionic [4,487 kB]
      Fetched 22.1 MB in 1s (43.5 MB/s)          
      Preconfiguring packages ...
      (Reading database ... 105503 files and directories currently installed.)
      Preparing to unpack .../mysql-common_1%3a10.4.6+maria~bionic_all.deb ...
      Unpacking mysql-common (1:10.4.6+maria~bionic) over (1:10.3.16+maria~bionic) ...
      Preparing to unpack .../mariadb-common_1%3a10.4.6+maria~bionic_all.deb ...
      Unpacking mariadb-common (1:10.4.6+maria~bionic) over (1:10.3.16+maria~bionic) ...
      Preparing to unpack .../mariadb-server_1%3a10.4.6+maria~bionic_all.deb ...
      Unpacking mariadb-server (1:10.4.6+maria~bionic) over (1:10.3.16+maria~bionic) ...
      (Reading database ... 105503 files and directories currently installed.)
      Removing mariadb-server-10.3 (1:10.3.16+maria~bionic) ...
      Removing galera-3 (25.3.26-bionic) ...
      Selecting previously unselected package galera-4.
      (Reading database ... 105387 files and directories currently installed.)
      Preparing to unpack .../galera-4_26.4.2-bionic_amd64.deb ...
      Unpacking galera-4 (26.4.2-bionic) ...
      Preparing to unpack .../mariadb-client_1%3a10.4.6+maria~bionic_all.deb ...
      Unpacking mariadb-client (1:10.4.6+maria~bionic) over (1:10.3.16+maria~bionic) ...
      dpkg: mariadb-client-10.3: dependency problems, but removing anyway as you requested:
       mysql-client depends on mysql-client-5.7; however:
        Package mysql-client-5.7 is not installed.
        Package mariadb-client-10.2 which provides mysql-client-5.7 is not installed.
        Package mariadb-client-10.3 which provides mysql-client-5.7 is to be removed.
       
      (Reading database ... 105395 files and directories currently installed.)
      Removing mariadb-client-10.3 (1:10.3.16+maria~bionic) ...
      Selecting previously unselected package mariadb-client-10.4.
      (Reading database ... 105358 files and directories currently installed.)
      Preparing to unpack .../mariadb-client-10.4_1%3a10.4.6+maria~bionic_amd64.deb ...
      Unpacking mariadb-client-10.4 (1:10.4.6+maria~bionic) ...
      (Reading database ... 105425 files and directories currently installed.)
      Removing mariadb-client-core-10.3 (1:10.3.16+maria~bionic) ...
      Selecting previously unselected package mariadb-client-core-10.4.
      (Reading database ... 105418 files and directories currently installed.)
      Preparing to unpack .../mariadb-client-core-10.4_1%3a10.4.6+maria~bionic_amd64.deb ...
      Unpacking mariadb-client-core-10.4 (1:10.4.6+maria~bionic) ...
      (Reading database ... 105429 files and directories currently installed.)
      Removing mariadb-server-core-10.3 (1:10.3.16+maria~bionic) ...
      dpkg: warning: while removing mariadb-server-core-10.3, directory '/usr/share/mysql' not empty so not removed
      Selecting previously unselected package mariadb-server-core-10.4.
      (Reading database ... 105342 files and directories currently installed.)
      Preparing to unpack .../mariadb-server-core-10.4_1%3a10.4.6+maria~bionic_amd64.deb ...
      Unpacking mariadb-server-core-10.4 (1:10.4.6+maria~bionic) ...
      Setting up mysql-common (1:10.4.6+maria~bionic) ...
      Setting up mariadb-common (1:10.4.6+maria~bionic) ...
      Selecting previously unselected package mariadb-server-10.4.
      (Reading database ... 105435 files and directories currently installed.)
      Preparing to unpack .../mariadb-server-10.4_1%3a10.4.6+maria~bionic_amd64.deb ...
      /var/lib/mysql: found previous version 10.3
      Failed to stop mysql.service: Unit mysql.service not loaded.
      'systemctl stop mysql' returned 5
      There is a MySQL server running, but we failed in our attempts to stop it.
      Stop it yourself and try again!
      dpkg: error processing archive /var/cache/apt/archives/mariadb-server-10.4_1%3a10.4.6+maria~bionic_amd64.deb (--unpack):
       new mariadb-server-10.4 package pre-installation script subprocess returned error exit status 1
      Errors were encountered while processing:
       /var/cache/apt/archives/mariadb-server-10.4_1%3a10.4.6+maria~bionic_amd64.deb
      E: Sub-process /usr/bin/dpkg returned an error code (1)
      

      We use https://github.com/prometheus/mysqld_exporter to export Prometheus style metrics from MariaDB. See the Docker hub page for example of how to run it:

      Example `ps auxwf` output:

      # ps auxw|grep mysql
      root      16873  2.3  0.0  14336  6984 ?        Ssl  13:21   0:00 /bin/mysqld_exporter
      root      17035  0.0  0.0  14428  1016 pts/2    S+   13:21   0:00 grep --color=auto mysql
      

      Example `docker ps` output:

      # docker ps 
      CONTAINER ID        IMAGE                                      COMMAND                  CREATED             STATUS                             PORTS                      NAMES
      0ba8afb6ac7d        quay.io/prometheus/node-exporter:v0.18.0   "/bin/node_exporter"     3 weeks ago         Up 12 seconds                                                 node-exporter
      4874ce0ab75f        google/cadvisor:v0.33.0                    "/usr/bin/cadvisor -..."   2 months ago        Up 11 seconds (health: starting)   127.0.0.1:9101->8080/tcp   cadvisor
      865c83fea800        prom/mysqld-exporter                       "/bin/mysqld_exporter"   4 months ago        Up 11 seconds                      127.0.0.1:9104->9104/tcp   mysqld-exporter
      

      I could workaround this issue by temporarily stopping Docker and getting rid of the `/bin/mysqld_exporter` process.

      I would like you guys to improve the detection of running `mysqld` processes to prevent the installation script from failing if `/bin/mysqld_exporter` is running.

        Attachments

          Activity

            People

            • Assignee:
              serg Sergei Golubchik
              Reporter:
              ZPtbrdqkIEdBg Throw Away
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: