[MDEV-21331] installation fails in an server with containers Created: 2019-12-17  Updated: 2022-05-04  Resolved: 2020-04-29

Status: Closed
Project: MariaDB Server
Component/s: Packaging, Platform Debian
Affects Version/s: 10.2, 10.3, 10.4
Fix Version/s: 10.2.32, 10.3.23, 10.4.13

Type: Bug Priority: Critical
Reporter: Philip orleans Assignee: Sergei Golubchik
Resolution: Fixed Votes: 1
Labels: None
Environment:

Debian Buster


Issue Links:
Duplicate
duplicates MDEV-21849 installation fails on Ubuntu 19.10 Closed
Relates
relates to MDEV-28468 Ubuntu distro didn't raise the error ... Closed

 Description   

The installation script has to realize that in a machine with containers, there are several processes called mysqld, but they don't belong to the central session, are isolated in containers. A workaround is to stop all containers, but in busy server that is not simply possible.

Preparing to unpack .../0-mariadb-server-10.4_1%3a10.4.11+maria~buster_amd64.deb ...
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 /tmp/apt-dpkg-install-XZL55Z/0-mariadb-server-10.4_1%3a10.4.11+maria~buster_amd64.deb (--unpack):
new mariadb-server-10.4 package pre-installation script subprocess returned error exit status 1



 Comments   
Comment by Elena Stepanova [ 2019-12-18 ]

serg, what do you think about this one? Maybe just add the error 5 to

    if [ "$errno" != 0 -a "$errno" != 100 ]; then

would it be enough?

Comment by Sergei Golubchik [ 2020-03-01 ]

100 looks like an obsolete check, from pre-systemctl days.

https://freedesktop.org/software/systemd/man/systemd.exec.html#Process%20exit%20codes

Comment by Sergei Golubchik [ 2020-04-22 ]

we cannot just start ignoring 5, it's a valid error, meaning a mysqld process is running and we cannot shut it down.

philip_38, could you try the following command, whether it works with your containters? Just a plain

pgrep mysqld

shows all mysqld processes, also in containers.
But if you run

pgrep --ns $$ mysqld

this should not show containerized mysqld processes, it should only show the one on the host. At least it does for me and docker containers. Does that work for you too?

Comment by Anel Husakovic [ 2022-03-30 ]

I tested one more time with faust this bug and I can confirm that the bug occurs for Debian buster, but is not reproducible for Ubuntu bionic and I don't know why otto FYI

Comment by Otto Kekäläinen [ 2022-03-30 ]

This issue status is closed - why are you still investigating it?

If you were able to reproduce the issue, what are the exact steps? Do you want me to run them and debug what Debian Buster does?

Comment by Anel Husakovic [ 2022-03-31 ]

Hi Otto,
I wanted to learn about pid namespaces and this MDEV was a perfect playground (resulted with PR #2076).
This MDEV stated that you have a mysqld|mariadbd process from container you should get the error when installing the server:

# Start container (no mariadb server installed)
$ docker container run --rm --name mysql-cont -e MYSQL_ROOT_PASSWORD=secret -d mysql
# Install mariadb
$ sudo apt install mariadb-server-10.2 # version 10.2.31 (use archive.mariadb.org)

I would like you to run on any version prior the patch fb7c1b9415c9a8 like <=10.2.31, <=10.3.22, <=10.4.12, etc but on Ubuntu bionic (since I noted on this distro).
What was noted is that
1. Debian buster raised the error (as in description of current MDEV)
2. Ubuntu bionic didn't catch the error (host process mysqld is installed over the containerized mysqld).
And I don't know why.
Do you want me to create new MDEV for this?
Thanks

Generated at Thu Feb 08 09:06:19 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.