Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-06-11 Thread Otto Kekäläinen
Hi!

I did a bunch of reproducible experiments using Salsa-CI in
https://salsa.debian.org/mariadb-team/mariadb-server/-/pipelines/536587
testing:

## upgrade to Bookworm

* cacti and Bullseye upgrade
- apt install -qq --yes cacti
   ->  - apt full-upgrade -qq --yes
* default-mysql-server and Bullseye upgrade
- apt install -qq --yes default-mysql-server
   ->  - apt full-upgrade -qq --yes
* mariadb-server and Bullseye upgrade
- apt install -qq --yes mariadb-server
* zoph and Bullseye upgrade
- apt install -qq --yes zoph
   ->  - apt full-upgrade -qq --yes
* zoph and Bullseye upgrade with mariadb-server explicitly
- apt install -qq --yes zoph mariadb-server
   ->  - apt install -qq --yes mariadb-server + apt full-upgrade -qq --yes
* zoph with mariadb-server and Bullseye upgrade
- apt install -qq --yes zoph mariadb-server
   ->  - apt full-upgrade -qq --yes

Only the last scenario failed.

This suggests that perhaps users hit this issue only when having
indirect dependency on default-mysql-server (via e.g. zoph), and
upgrading only it or doing a full-upgrade.


## Recommendation how to avoid this issue

I would recommend this as the best way as of today to update MariaDB
10.5.19/20 in Buster to 10.11.3 in Debian 12 "Bookworm":

# Ensure Bullseye was running latest of everything, makes upgrade smoother
$ sudo apt upgrade --yes
# Ensure clean and safe shutdown before doing major version upgrade -
this may take several minutes on large and busy database
$ sudo systemctl stop mariadb || sudo /etc/init.d/mariadb stop
# Enable new release
$ sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
$ sudo apt update
# Just upgrade MariaDB first so it can be brought back online as fast
as possible
$ sudo apt install mariadb-server
# Then upgrade everything else
$ sudo apt full-upgrade


## Recommendation how to recover if suffered this issue


If you did not prepare along the lines of above and just upgraded, and
if failed with error message:

dpkg: mariadb-server-10.5: dependency problems, but removing anyway as
you requested:
 zoph depends on default-mysql-server | virtual-mysql-server; however:
  Package default-mysql-server is not configured yet.
  Package virtual-mysql-server is not installed.
  Package mariadb-server-10.5 which provides virtual-mysql-server is
to be removed.

(Reading database ... 16559 files and directories currently installed.)
Removing mariadb-server-10.5 (1:10.5.19-0+deb11u2) ...
Stopping MariaDB database server: mariadbd failed!
invoke-rc.d: initscript mariadb, action "stop" failed.
dpkg: error processing package mariadb-server-10.5 (--remove):
 installed mariadb-server-10.5 package pre-removal script subprocess
returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 mariadb-server-10.5
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

..in that case the easiest way to recover is simply to manually stop
the server and continue upgrade:

$ sudo pkill -ef mariadbd || sudo pkill -ef mysqld
$ sudo apt --fix-broken install
$ sudo apt full-upgrade


Workaround suggested to be included in Bookworm release notes at
https://salsa.debian.org/ddp-team/release-notes/-/merge_requests/197



Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-06-09 Thread Frédéric Loyer
Yes, systemd was installed. It was a Debian installed from scratch in 
version 11 from the available Linux templates of my cloud provider.


I have installed Apache, MariaDB, PHP which is required for vBulletin 
(installed manually, no package). And some other tools which should not 
have an impact on MariaDB. I guess the system is quite standard.


Le 09/06/2023 à 17:37, Otto Kekäläinen a écrit :

Is your system running systemd? What can you tell about the environment?




Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-06-09 Thread Otto Kekäläinen
Can you attach the full log as an attachment?

The current short log does not show what apt told you in the beginning
about what it plans to do, nor can I see if mariadb-client-10.5 was
uninstalled or what happened.

But it did at least hit a bug where the uninstall fails on
`invoke-rd.c stop mariadb` failing.

Is your system running systemd? What can you tell about the environment?



Bug#1035949: Fwd: Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-06-09 Thread Frédéric Loyer

Le 09/06/2023 à 16:17, Otto Kekäläinen a écrit :


Thanks Frederick for the report!

Do you still have the output of apt? Can you copy-paste here or attach 
log to show exactly what happened?


It is likely that you hit this bug, but exact details would help 
confirm, and also help build CI test/scenario to ensure we have 
realistic upgrade testing.


Note that verifying the log, I had only typed "apt --fix-broken install" 
not "apt --fix-broken install mysql-client"



Here an extract of the log:

With "apt full-upgrade"

[...]
dpkg: mariadb-server-10.5 : problèmes de dépendance, mais suppression 
comme demandé :

 mariadb-server dépend de mariadb-server-10.5 (>= 1:10.5.19-0+deb11u2).
Suppression de mariadb-server-10.5 (1:10.5.19-0+deb11u2) ...
Paramétrage de mysql-common (5.8+1.1.0) ...
Paramétrage de mariadb-common (1:10.11.3-1) ...
Préparation du dépaquetage de .../mariadb-server_1%3a10.11.3-1_amd64.deb ...
/var/lib/mysql: found previous version 10.5
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
Attempt to stop MariaDB/MySQL server returned exitcode 5
There is a MariaDB/MySQL server running, but we failed in our attempts 
to stop it.

Stop it yourself and try again!
dpkg: erreur de traitement de l'archive 
/var/cache/apt/archives/mariadb-server_1%3a10.11.3-1_amd64.deb (--unpack) :
 le sous-processus nouveau mariadb-server paquet pre-installation 
script a renvoyé un état de sortie d'erreur 1

Des erreurs ont été rencontrées pendant l'exécution :
 /var/cache/apt/archives/mariadb-server_1%3a10.11.3-1_amd64.deb
Log ended: 2023-06-09  11:49:32


Then with apt --fix-broken install

Log started: 2023-06-09  11:50:47
Suppression de mariadb-client-10.5 (1:10.5.19-0+deb11u2) ...
Suppression de mariadb-server-core-10.5 (1:10.5.19-0+deb11u2) ...
Préparation du dépaquetage de .../mariadb-backup_1%3a10.11.3-1_amd64.deb ...
Dépaquetage de mariadb-backup (1:10.11.3-1) sur (1:10.5.19-0+deb11u2) ...
Suppression de mariadb-client-core-10.5 (1:10.5.19-0+deb11u2) ...
Sélection du paquet mariadb-client-core précédemment désélectionné.
Préparation du dépaquetage de 
.../0-mariadb-client-core_1%3a10.11.3-1_amd64.deb ...

Dépaquetage de mariadb-client-core (1:10.11.3-1) ...

[... multiple packages without link to Mariadb ...]

Préparation du dépaquetage de 
.../0-mariadb-server_1%3a10.11.3-1_amd64.deb ...

/var/lib/mysql: found previous version 10.5
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
Attempt to stop MariaDB/MySQL server returned exitcode 5
There is a MariaDB/MySQL server running, but we failed in our attempts 
to stop it.

Stop it yourself and try again!
dpkg: erreur de traitement de l'archive 
/tmp/apt-dpkg-install-ycPrRR/0-mariadb-server_1%3a10.11.3-1_amd64.deb 
(--unpack) :
 le sous-processus nouveau mariadb-server paquet pre-installation 
script a renvoyé un état de sortie d'erreur 1

Sélection du paquet mariadb-client précédemment désélectionné.
dpkg: tentative de déconfiguration de mariadb-server, qui serait cassé 
par l'installation de mariadb-client ...

dpkg: oui, déconfiguration de mariadb-server (cassé par mariadb-client).
Préparation du dépaquetage de 
.../1-mariadb-client_1%3a10.11.3-1_amd64.deb ...
Déconfiguration de mariadb-server (1:10.5.19-0+deb11u2), pour permettre 
l'installation de mariadb-client (1:10.11.3-1) ...

Dépaquetage de mariadb-client (1:10.11.3-1) ...
Sélection du paquet mariadb-server-core précédemment désélectionné.
Préparation du dépaquetage de 
.../2-mariadb-server-core_1%3a10.11.3-1_amd64.deb ...

Dépaquetage de mariadb-server-core (1:10.11.3-1) ...
Préparation du dépaquetage de .../3-libsnappy1v5_1.1.9-3_amd64.deb ...
Dépaquetage de libsnappy1v5:amd64 (1.1.9-3) sur (1.1.8-1) ...
Sélection du paquet mariadb-plugin-provider-bzip2 précédemment 
désélectionné.
Préparation du dépaquetage de 
.../4-mariadb-plugin-provider-bzip2_1%3a10.11.3-1_amd64.deb ...

Dépaquetage de mariadb-plugin-provider-bzip2 (1:10.11.3-1) ...
Sélection du paquet mariadb-plugin-provider-lz4 précédemment désélectionné.
Préparation du dépaquetage de 
.../5-mariadb-plugin-provider-lz4_1%3a10.11.3-1_amd64.deb ...

Dépaquetage de mariadb-plugin-provider-lz4 (1:10.11.3-1) ...
Sélection du paquet mariadb-plugin-provider-lzma précédemment désélectionné.
Préparation du dépaquetage de 
.../6-mariadb-plugin-provider-lzma_1%3a10.11.3-1_amd64.deb ...

Dépaquetage de mariadb-plugin-provider-lzma (1:10.11.3-1) ...
Sélection du paquet mariadb-plugin-provider-lzo précédemment désélectionné.
Préparation du dépaquetage de 
.../7-mariadb-plugin-provider-lzo_1%3a10.11.3-1_amd64.deb ...

Dépaquetage de mariadb-plugin-provider-lzo (1:10.11.3-1) ...
Sélection du paquet mariadb-plugin-provider-snappy précédemment 
désélectionné.
Préparation du dépaquetage de 
.../8-mariadb-plugin-provider-snappy_1%3a10.11.3-1_amd64.deb ...

Dépaquetage de mariadb-plugin-provider-snappy (1:10.11.3-1) ...
Des erreurs 

Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-06-09 Thread Otto Kekäläinen
Thanks Frederick for the report!

Do you still have the output of apt? Can you copy-paste here or attach log
to show exactly what happened?

It is likely that you hit this bug, but exact details would help confirm,
and also help build CI test/scenario to ensure we have realistic upgrade
testing.


Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed,Date: Thu, 11 May 2023 16:46:43 +0200

2023-06-09 Thread Frédéric Loyer

Hi,

I have just upgraded Debian from 11 to 12, and its mariadb-server. The 
command was simply "apt full-upgrade".


I have get the #1035949 bug even if I havn't the zoph package, nor 
default-mysql-server.


I didn't manage to make it works with:

# apt --fix-broken install mariadb-client


However, I could continue the installation by killing the mariadb-server 
process, then the "apt install mariadb-server" didn't have to stop the 
server and can install successfully the mariadb-server.




Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-06-04 Thread Otto Kekäläinen
Forwarded: https://jira.mariadb.org/browse/MDEV-28640

For reference:

* The upgrade scenario this MR fixed:
https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/15cbf6e691827608636e6ff7f0a50432f50d0c4f
* Release notes mention:
https://salsa.debian.org/ddp-team/release-notes/-/merge_requests/187
* Upload to experimental pending in NEW queue:
https://ftp-master.debian.org/new/mariadb_1:10.11.3-2~exp1.html
* Release team consultation:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1037107



Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-06-04 Thread Andreas Beckmann

On 04/06/2023 07.03, Otto Kekäläinen wrote:

What do you Andreas suggest we do now?


I'd suggest uploading it to experimental immediately (for NEW 
processing) and filing a pre-approval bug and let the release team 
decide what to do. This fix will probably be delayed to the first point 
release.

Should there be something about this issue in the release notes?


Andreas



Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-06-03 Thread Otto Kekäläinen
Indeed the transitional mariadb-server-10.5 fixes the issue.

What do you Andreas suggest we do now?

It is already past freeze for Bookworm, and this is not just a small
fix but also introduces a new package (albeit transitional). Let me
know how you want to proceed and I can immediately tomorrow push this
to experimental or unstable if that is aligned with your plan.
Alternatively we can ask for pre-approval from the release team.



Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-06-03 Thread Otto Kekäläinen
I adjusted your patch a bit as it didn't apply cleanly and pushed it
to https://salsa.debian.org/mariadb-team/mariadb-server/-/merge_requests/47
to replace the transitional mariadb-client-10.5 I had earlier.

Thanks for diving deep in piuparts testing for MariaDB 10.11 and for the patch!

Ideally the CI itself had all the install/upgrade scenarios that are
relevant. Contributions to the debian/salsa-ci.yml file are also very
welcome!



Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-06-01 Thread Andreas Beckmann

Control: tag -1 patch

On 01/06/2023 12.31, Andreas Beckmann wrote:

That worked for me for zoph, but a new failure occurred in tt-rss.
I'm now trying a transitional mariadb-server-10.5 package which seems to 
work for both these cases. Will do a complete set of piuparts upgrade 
tests for all upgrade paths involving mariadb-server-10.5


First round of tests was successful, i.e. no new regressions so far.
(tests with apt-get upgrade && apt-get full-upgrade or 
--install-recommends are still running)
I attach the mariadb-server-10.5 package I tested with, it is missing 
adjustments of the description and a useful commit message.

Can you try that in your salsa setup?


AndreasFrom dab6d5731b4ca771f45852e825c906330417a97c Mon Sep 17 00:00:00 2001
From: Andreas Beckmann 
Date: Thu, 1 Jun 2023 11:39:59 +0200
Subject: [PATCH] add transitional mariadb-server-10.5 package

---
 debian/control | 24 ++--
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/debian/control b/debian/control
index 6a35515d970..48328809812 100644
--- a/debian/control
+++ b/debian/control
@@ -293,7 +293,7 @@ Breaks: mariadb-client-10.0,
 mariadb-server-10.2,
 mariadb-server-10.3,
 mariadb-server-10.4,
-mariadb-server-10.5,
+mariadb-server-10.5 (<< 1:10.11),
 mariadb-server-10.6,
 mysql-client-5.5,
 mysql-client-5.6,
@@ -327,7 +327,7 @@ Replaces: mariadb-client-10.0,
   mariadb-server-10.2,
   mariadb-server-10.3,
   mariadb-server-10.4,
-  mariadb-server-10.5,
+  mariadb-server-10.5 (<< 1:10.11),
   mariadb-server-10.6,
   mysql-client-5.5,
   mysql-client-5.6,
@@ -372,7 +372,7 @@ Breaks: mariadb-client-10.1,
 mariadb-server-10.2,
 mariadb-server-10.3,
 mariadb-server-10.4,
-mariadb-server-10.5,
+mariadb-server-10.5 (<< 1:10.11),
 mariadb-server-10.6,
 mariadb-server-core-10.0,
 mariadb-server-core-10.1,
@@ -400,7 +400,7 @@ Replaces: mariadb-client-10.1,
   mariadb-server-10.2,
   mariadb-server-10.3,
   mariadb-server-10.4,
-  mariadb-server-10.5,
+  mariadb-server-10.5 (<< 1:10.11),
   mariadb-server-10.6,
   mariadb-server-core-10.0,
   mariadb-server-core-10.1,
@@ -484,7 +484,7 @@ Breaks: cqrlog (<< 1.9.0-5~),
 mariadb-server-10.2,
 mariadb-server-10.3,
 mariadb-server-10.4,
-mariadb-server-10.5,
+mariadb-server-10.5 (<< 1:10.11),
 mariadb-server-10.6,
 mariadb-server-5.5,
 mariadb-tokudb-engine-10.0,
@@ -506,7 +506,7 @@ Replaces: handlersocket-mysql-5.5,
   mariadb-server-10.2,
   mariadb-server-10.3,
   mariadb-server-10.4,
-  mariadb-server-10.5,
+  mariadb-server-10.5 (<< 1:10.11),
   mariadb-server-10.6,
   mariadb-server-5.5,
   mariadb-tokudb-engine-10.0,
@@ -532,6 +532,18 @@ Description: MariaDB database server binaries
  .
  This package includes the server binaries.
 
+Package: mariadb-server-10.5
+Architecture: any
+Depends: mariadb-server (>= 1:10.11),
+ ${shlibs:Depends}
+Description: MariaDB database server binaries
+ MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
+ server. SQL (Structured Query Language) is the most popular database query
+ language in the world. The main goals of MariaDB are speed, robustness and
+ ease of use.
+ .
+ This package includes the server binaries.
+
 Package: mariadb-backup
 Architecture: any
 Breaks: mariadb-backup-10.1,
-- 
2.20.1



Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-06-01 Thread Andreas Beckmann

On 26/05/2023 19.16, Otto Kekäläinen wrote:

I filed now 
https://salsa.debian.org/mariadb-team/mariadb-server/-/merge_requests/47
as an exploration to fix this issue.


That worked for me for zoph, but a new failure occurred in tt-rss.
I'm now trying a transitional mariadb-server-10.5 package which seems to 
work for both these cases. Will do a complete set of piuparts upgrade 
tests for all upgrade paths involving mariadb-server-10.5



If we don't fix this in 10.11 the alternative would be to patch 10.5
and 10.3 to simply never fail on missing mariadb-client-10.3/5
package. I already did
https://salsa.debian.org/mariadb-team/mariadb-10.5/-/merge_requests/14
to make the problem have a proper error message users.


Proper error message is good. ;-)
Ignoring the failure not. :-(

While creating the transitional package I came across some 
inconsistencies between Conflicts/Breaks/Replaces. I'm not sure whether 
they are intentional, but I'm doing my tests with the three attached 
patches applied. They didn't make a difference on their own.




AndreasFrom 9c7c48a0d6428535596665590c2e87b4a477abd4 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann 
Date: Thu, 1 Jun 2023 09:53:25 +0200
Subject: [PATCH 1/3] drop redundant Breaks+Conflicts

---
 debian/control | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/debian/control b/debian/control
index d8b99443551..6f3aff563e3 100644
--- a/debian/control
+++ b/debian/control
@@ -88,10 +88,7 @@ Conflicts: libmariadb-client-lgpl-dev-compat,
libmysqlclient-dev
 Provides: libmariadb-client-lgpl-dev-compat,
   libmariadbclient-dev-compat
-Breaks: libmariadb-client-lgpl-dev-compat,
-libmariadbclient-dev (<< 1:10.3),
-libmariadbclient-dev-compat,
-libmysqlclient-dev
+Breaks: libmariadbclient-dev (<< 1:10.3)
 Replaces: libmariadb-client-lgpl-dev-compat,
   libmariadbclient-dev (<< 1:10.3),
   libmariadbclient-dev-compat,
-- 
2.20.1

From c8fd52f3bbe17d888981652823a3e0ac19c9a657 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann 
Date: Thu, 1 Jun 2023 09:54:46 +0200
Subject: [PATCH 2/3] tighten server plugin dependencies

---
 debian/control | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/debian/control b/debian/control
index 6f3aff563e3..ade3b98e256 100644
--- a/debian/control
+++ b/debian/control
@@ -652,7 +652,7 @@ Description: Spider storage engine for MariaDB
 Package: mariadb-plugin-gssapi-server
 Architecture: any
 Depends: libgssapi-krb5-2,
- mariadb-server,
+ mariadb-server (= ${server:Version}),
  ${misc:Depends},
  ${shlibs:Depends}
 Breaks: mariadb-gssapi-server-10.1,
@@ -696,7 +696,7 @@ Description: CrackLib Password Validation Plugin for MariaDB
 Package: mariadb-plugin-hashicorp-key-management
 Architecture: any
 Depends: libcurl4,
- mariadb-server,
+ mariadb-server (= ${server:Version}),
  ${misc:Depends},
  ${shlibs:Depends}
 Description: Hashicorp Key Management plugin for MariaDB
@@ -705,7 +705,7 @@ Description: Hashicorp Key Management plugin for MariaDB
 
 Package: mariadb-plugin-provider-bzip2
 Architecture: any
-Depends: mariadb-server (>= 1:10.11.1-1),
+Depends: mariadb-server (= ${server:Version}),
  ${misc:Depends},
  ${shlibs:Depends}
 Description: BZip2 compression support in the server and storage engines
@@ -719,7 +719,7 @@ Description: BZip2 compression support in the server and storage engines
 
 Package: mariadb-plugin-provider-lz4
 Architecture: any
-Depends: mariadb-server (>= 1:10.11.1-1),
+Depends: mariadb-server (= ${server:Version}),
  ${misc:Depends},
  ${shlibs:Depends}
 Description: LZ4 compression support in the server and storage engines
@@ -733,7 +733,7 @@ Description: LZ4 compression support in the server and storage engines
 
 Package: mariadb-plugin-provider-lzma
 Architecture: any
-Depends: mariadb-server (>= 1:10.11.1-1),
+Depends: mariadb-server (= ${server:Version}),
  ${misc:Depends},
  ${shlibs:Depends}
 Description: LZMA compression support in the server and storage engines
@@ -747,7 +747,7 @@ Description: LZMA compression support in the server and storage engines
 
 Package: mariadb-plugin-provider-lzo
 Architecture: any
-Depends: mariadb-server (>= 1:10.11.1-1),
+Depends: mariadb-server (= ${server:Version}),
  ${misc:Depends},
  ${shlibs:Depends}
 Description: LZO compression support in the server and storage engines
@@ -761,7 +761,7 @@ Description: LZO compression support in the server and storage engines
 
 Package: mariadb-plugin-provider-snappy
 Architecture: any
-Depends: mariadb-server (>= 1:10.11.1-1),
+Depends: mariadb-server (= ${server:Version}),
  ${misc:Depends},
  ${shlibs:Depends}
 Description: Snappy compression support in the server and storage engines
-- 
2.20.1

From 07f654ffce74f75380065d447f76766d36cd06ea Mon Sep 17 00:00:00 2001
From: Andreas 

Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-05-26 Thread Otto Kekäläinen
I filed now 
https://salsa.debian.org/mariadb-team/mariadb-server/-/merge_requests/47
as an exploration to fix this issue.

If we don't fix this in 10.11 the alternative would be to patch 10.5
and 10.3 to simply never fail on missing mariadb-client-10.3/5
package. I already did
https://salsa.debian.org/mariadb-team/mariadb-10.5/-/merge_requests/14
to make the problem have a proper error message users.



Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-05-22 Thread Otto Kekäläinen
I am experimenting the suggestion in
https://salsa.debian.org/otto/mariadb-server/-/commits/bugfix/1035949-upgrade-removes-client



Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-05-22 Thread Andreas Beckmann

On 18/05/2023 05.17, Otto Kekäläinen wrote:

I am not sure what to debug next.


You could try to reintroduce mariadb-client-10.5 as a transitional 
package depending on mariadb-client (>= 1:10.11) (and make existing 
Conflicts/Breaks/Replaces against mariadb-client-10.5 versioned as (<< 
1:10.11))


Andreas



Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-05-17 Thread Otto Kekäläinen
Here is the apt resolver output for debugging:

# apt install default-mysql-server -o Debug::pkgDepCache::Marker=1 -o
Debug::pkgDepCache::AutoInstall=1 -o Debug::pkgProblemResolver=1
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
  MarkInstall default-mysql-server:amd64 < 1.0.7 -> 1.1.0 @ii pumU Ib > FU=1
  Installing mariadb-server:amd64 as Depends of default-mysql-server:amd64
 Removing: mariadb-server-10.5:amd64 as upgrade is not an option
for mariadb-server:amd64 (1:10.11.2-1)
  MarkDelete mariadb-server-10.5:amd64 < 1:10.5.19-0+deb11u2 @ii
mK Ib > FU=0
MarkInstall mariadb-server:amd64 < none -> 1:10.11.2-1 @un puN Ib > FU=0
Installing mariadb-common:amd64 as PreDepends of mariadb-server:amd64
  MarkInstall mariadb-common:amd64 < 1:10.5.19-0+deb11u2 ->
1:10.11.2-1 @ii pumU > FU=0
Installing mariadb-client:amd64 as Depends of mariadb-server:amd64
   Removing: mariadb-client-10.5:amd64 as upgrade is not an option
for mariadb-client:amd64 (1:10.11.2-1)
MarkDelete mariadb-client-10.5:amd64 < 1:10.5.19-0+deb11u2 @ii
mK Ib > FU=0
   Removing: mariadb-client-core-10.5:amd64 as upgrade is not an
option for mariadb-client:amd64 (1:10.11.2-1)
MarkDelete mariadb-client-core-10.5:amd64 <
1:10.5.19-0+deb11u2 @ii mK > FU=0
  MarkInstall mariadb-client:amd64 < none -> 1:10.11.2-1 @un puN Ib > FU=0
  Installing mariadb-client-core:amd64 as Depends of mariadb-client:amd64
 Removing: mariadb-server-core-10.5:amd64 as upgrade is not an
option for mariadb-client-core:amd64 (1:10.11.2-1)
  MarkDelete mariadb-server-core-10.5:amd64 <
1:10.5.19-0+deb11u2 @ii mK > FU=0
MarkInstall mariadb-client-core:amd64 < none -> 1:10.11.2-1
@un puN Ib > FU=0
Installing libc6:amd64 as Depends of mariadb-client-core:amd64
  MarkInstall libc6:amd64 < 2.31-13+deb11u5 -> 2.36-9 @ii pumU
NPb > FU=0
Installing libssl3:amd64 as Depends of mariadb-client-core:amd64
  MarkInstall libssl3:amd64 < none -> 3.0.8-1 @un puN > FU=0
Installing mariadb-server-core:amd64 as Depends of mariadb-server:amd64
  MarkInstall mariadb-server-core:amd64 < none -> 1:10.11.2-1 @un
puN Ib > FU=0
  Installing libpmem1:amd64 as Depends of mariadb-server-core:amd64
MarkInstall libpmem1:amd64 < none -> 1.12.1-2 @un puN Ib > FU=0
Installing libdaxctl1:amd64 as Depends of libpmem1:amd64
  MarkInstall libdaxctl1:amd64 < none -> 76.1-1 @un puN Ib > FU=0
  Installing libkmod2:amd64 as Depends of libdaxctl1:amd64
MarkInstall libkmod2:amd64 < none -> 30+20221128-1 @un puN Ib > FU=0
Installing libzstd1:amd64 as Depends of libkmod2:amd64
  MarkInstall libzstd1:amd64 < 1.4.8+dfsg-2.1 ->
1.5.4+dfsg2-5 @ii pumU > FU=0
Installing libndctl6:amd64 as Depends of libpmem1:amd64
  MarkInstall libndctl6:amd64 < none -> 76.1-1 @un puN > FU=0
  Installing libstdc++6:amd64 as Depends of mariadb-server-core:amd64
MarkInstall libstdc++6:amd64 < 10.2.1-6 -> 12.2.0-14 @ii pumU Ib > FU=0
Installing gcc-12-base:amd64 as Depends of libstdc++6:amd64
  MarkInstall gcc-12-base:amd64 < none -> 12.2.0-14 @un puN > FU=0
  Installing liburing2:amd64 as Depends of mariadb-server-core:amd64
MarkInstall liburing2:amd64 < none -> 2.3-3 @un puN > FU=0
Installing mariadb-plugin-provider-bzip2:amd64 as Recommends of
mariadb-server:amd64
  MarkInstall mariadb-plugin-provider-bzip2:amd64 < none ->
1:10.11.2-1 @un uN > FU=0
Installing mariadb-plugin-provider-lz4:amd64 as Recommends of
mariadb-server:amd64
  MarkInstall mariadb-plugin-provider-lz4:amd64 < none ->
1:10.11.2-1 @un uN > FU=0
Installing mariadb-plugin-provider-lzma:amd64 as Recommends of
mariadb-server:amd64
  MarkInstall mariadb-plugin-provider-lzma:amd64 < none ->
1:10.11.2-1 @un uN > FU=0
Installing mariadb-plugin-provider-lzo:amd64 as Recommends of
mariadb-server:amd64
  MarkInstall mariadb-plugin-provider-lzo:amd64 < none ->
1:10.11.2-1 @un uN Ib > FU=0
  Installing liblzo2-2:amd64 as Depends of mariadb-plugin-provider-lzo:amd64
MarkInstall liblzo2-2:amd64 < none -> 2.10-2 @un uN > FU=0
Installing mariadb-plugin-provider-snappy:amd64 as Recommends of
mariadb-server:amd64
  MarkInstall mariadb-plugin-provider-snappy:amd64 < none ->
1:10.11.2-1 @un uN Ib > FU=0
  Installing libsnappy1v5:amd64 as Depends of
mariadb-plugin-provider-snappy:amd64
MarkInstall libsnappy1v5:amd64 < 1.1.8-1 -> 1.1.9-3 @ii umU > FU=0
Installing pv:amd64 as Recommends of mariadb-server:amd64
  MarkInstall pv:amd64 < none -> 1.6.20-1 @un uN > FU=0
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
The following package was automatically installed and is no longer required:
  libaio1
Use 'apt autoremove' to remove it.
The following additional packages will be 

Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-05-17 Thread Otto Kekäläinen
I did some more testing in throwaway containers.

In each test starting point was same:

apt-get install default-mysql-server zoph
sed s/bullseye/bookworm/g -i /etc/apt/sources.list
apt update

All cases ran apt 2.6.0.

I only varied the command that followed:

1) apt-get install default-mysql-server

Fails:

debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 16648 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.8+1.1.0_all.deb ...
Unpacking mysql-common (5.8+1.1.0) over (5.8+1.0.7) ...
Preparing to unpack .../mariadb-common_1%3a10.11.2-1_all.deb ...
Unpacking mariadb-common (1:10.11.2-1) over (1:10.5.19-0+deb11u2) ...
Preparing to unpack .../default-mysql-server_1.1.0_all.deb ...
Unpacking default-mysql-server (1.1.0) over (1.0.7) ...
dpkg: mariadb-client-10.5: dependency problems, but removing anyway as
you requested:
 mariadb-server-10.5 depends on mariadb-client-10.5 (>= 1:10.5.19-0+deb11u2).
 dbconfig-mysql depends on default-mysql-client | virtual-mysql-client; however:
  Package default-mysql-client is not installed.
  Package virtual-mysql-client is not installed.
  Package mariadb-client-10.5 which provides virtual-mysql-client is
to be removed.
(Reading database ... 16648 files and directories currently installed.)
Removing mariadb-client-10.5 (1:10.5.19-0+deb11u2) ...
Removing mariadb-client-core-10.5 (1:10.5.19-0+deb11u2) ...
dpkg: mariadb-server-10.5: dependency problems, but removing anyway as
you requested:
 zoph depends on default-mysql-server | virtual-mysql-server; however:
  Package default-mysql-server is not configured yet.
  Package virtual-mysql-server is not installed.
  Package mariadb-server-10.5 which provides virtual-mysql-server is
to be removed.
Removing mariadb-server-10.5 (1:10.5.19-0+deb11u2) ...
Stopping MariaDB database server: mariadbd failed!
invoke-rc.d: initscript mariadb, action "stop" failed.
dpkg: error processing package mariadb-server-10.5 (--remove):
 installed mariadb-server-10.5 package pre-removal script subprocess
returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 mariadb-server-10.5
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

# apt --fix-broken install mariadb-client
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 default-mysql-server : Depends: mariadb-server but it is not going to
be installed
 mariadb-client : Depends: mariadb-client-core (>= 1:10.11.2-1) but it
is not going to be installed
  Depends: libssl3 (>= 3.0.0) but it is not going to
be installed
  Breaks: mariadb-server-10.5 but 1:10.5.19-0+deb11u2
is to be installed
 mariadb-server-10.5 : Depends: mariadb-client-10.5 (>=
1:10.5.19-0+deb11u2) but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages
(or specify a solution).



2) apt upgrade

Passes:

Everything is unpacked and installed, and MariaDB server restart is
among the last things that happen and is successful.

Upgrade of default-mysql-server was postponed and starts only when
running 'apt full-upgrade'.



3) apt full-upgrade

Fails:

...
Preparing to unpack .../default-mysql-server_1.1.0_all.deb ...
Unpacking default-mysql-server (1.1.0) over (1.0.7) ...
dpkg: mariadb-client-10.5: dependency problems, but removing anyway as
you requested:
 mariadb-server-10.5 depends on mariadb-client-10.5 (>= 1:10.5.19-0+deb11u2).
 dbconfig-mysql depends on default-mysql-client | virtual-mysql-client; however:
  Package default-mysql-client is not installed.
  Package virtual-mysql-client is not installed.
  Package mariadb-client-10.5 which provides virtual-mysql-client is
to be removed.
(Reading database ... 18487 files and directories currently installed.)
Removing mariadb-client-10.5 (1:10.5.19-0+deb11u2) ...
Removing mariadb-client-core-10.5 (1:10.5.19-0+deb11u2) ...
dpkg: mariadb-server-10.5: dependency problems, but removing anyway as
you requested:
 zoph depends on default-mysql-server | virtual-mysql-server; however:
  Package default-mysql-server is not configured yet.
  Package virtual-mysql-server is not installed.
  Package mariadb-server-10.5 which provides virtual-mysql-server is
to be removed.
Removing mariadb-server-10.5 (1:10.5.19-0+deb11u2) ...
Stopping MariaDB database server: mariadbd failed!
invoke-rc.d: initscript mariadb, action "stop" failed.
dpkg: error processing package mariadb-server-10.5 (--remove):
 installed mariadb-server-10.5 package pre-removal script subprocess
returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 mariadb-server-10.5
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an 

Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-05-15 Thread Andreas Beckmann

On 15/05/2023 02.38, Otto Kekäläinen wrote:

This is not a fix, but could help make the situation easier to
detect/debug for users:


I haven't tried that and have no time to do it right now: if you first 
upgrade apt to the bookworm version, and do the dist-upgrade afterwards, 
does that change the removal order?


Anyway you should file a bug against apt, perhaps they have some insight 
what's happening and how it could be worked around in bookworm. 
Unfortunately the upgrades have to work with apt from bullseye ...



Andreas



Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-05-14 Thread Otto Kekäläinen
This is not a fix, but could help make the situation easier to
detect/debug for users:

* https://salsa.debian.org/mariadb-team/mariadb-10.5/-/merge_requests/14
* https://salsa.debian.org/mariadb-team/mariadb-10.3/-/merge_requests/37



Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-05-14 Thread Otto Kekäläinen
Hi Andreas!

Thanks for reporting and looking into this.

> Here apt choses a suboptimal removal order: mariadb-server-10.5 gets
> removed (and therefore stopped, but that fails) only after
> mariadb-client-10.5 and mariadb-client-core-10.5 are already gone.

You are right. The /usr/bin/mysqladmin command is gone and thus the
'$MYADMIN shutdown' will always fail in /etc/init.d/mariadb when
removal happens in this order.

The history here is that I submitted
https://github.com/MariaDB/server/pull/2299/commits/a7fb9f80af6f6aa2e5ca2f36a79d325358b40e00
upstream in a PR that got squashed (against my recommendation) and
thus got applied upstream as
https://github.com/MariaDB/server/commit/f4adf3547420cced027d26ee8b8190be8a2bdea2.
Upstream bug tracker was https://jira.mariadb.org/browse/MDEV-28640
and is still open, and this was filed now in Debian as
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1035949 but I recall
there was duplicates earlier as well. Anyway, clearly this isn't fully
fixed yet.

> I have tried the early upgrade scenario only with one other package that
> needs it (icinga2-ido-mysql), and there it worked flawless.
> Some bits from the log:
>
> ...
>   Preparing to unpack .../mariadb-common_1%3a10.11.2-1_all.deb ...
>   Unpacking mariadb-common (1:10.11.2-1) over (1:10.5.19-0+deb11u2) ...
>   Preparing to unpack .../default-mysql-server_1.1.0_all.deb ...
>   Unpacking default-mysql-server (1.1.0) over (1.0.7) ...
>   Removing mariadb-server-10.5 (1:10.5.19-0+deb11u2) ...
>   invoke-rc.d: could not determine current runlevel
>   Stopping MariaDB database server: mariadbd.
>   Removing mariadb-client-10.5 (1:10.5.19-0+deb11u2) ...
>   Removing mariadb-client-core-10.5 (1:10.5.19-0+deb11u2) ...
>   Removing mariadb-server-core-10.5 (1:10.5.19-0+deb11u2) ...
> ...
>
>
> Do you have a test in you CI that does something equivalent to
>
> * apt-get install default-mysql-server
> * sed s/bullseye/bookworm/ sources.list
> * apt-get install default-mysql-server # early upgrade
> * apt-get dist-upgrade

I was able to reproduce this on my laptop in a Docker container with simply:

./test-prepare-container
apt-get install default-mysql-server zoph
sed s/bullseye/bookworm/g -i /etc/apt/sources.list
apt update
apt-get install default-mysql-server

NOTE: Installing 'zoph' here is key. It will pull in dbconfig-common
etc and create this interaction. Removing 'zoph' makes the upgrade
pass just fine. This is similar to what we discovered with Cacti in
Bug#1031116

I added this 'zoph' update as a new Salsa-CI job in commit 2 of
https://salsa.debian.org/mariadb-team/mariadb-server/-/merge_requests/26
(result in https://salsa.debian.org/otto/mariadb-server/-/jobs/4213540).


One way to mitigate this would be to backport
https://github.com/MariaDB/server/pull/2299/commits/a7fb9f80af6f6aa2e5ca2f36a79d325358b40e00
to MariaDB 10.5 in Debian. However it would not fix the fact that the
client library is removed too early.

I need to play around with this to find out a proper solution.



Bug#1035949: mariadb: upgrade issue: mariadb-server-10.5 fails to stop after all other -10.5 packages were removed

2023-05-11 Thread Andreas Beckmann
Source: mariadb
Version: 1:10.11.2-1
Severity: serious
User: debian...@lists.debian.org
Usertags: piuparts
Control: affects -1 + zoph

Hi,

during a test with piuparts I noticed your package fails to upgrade from
'bullseye'.
It installed fine in 'bullseye', then the upgrade to 'bookworm' fails.

This failure is observable while testing the zoph package.
Since timing is unfortunate and upgrading zoph causes db accesses while
the db is temporarily down, I tried to first upgrade
default-mysql-server (as I usually do in this case) by running
  apt-get install default-mysql-server
immediately after switching sources.list to bookworm (and running
apt-get update to refresh the lists.)

>From the attached log (scroll to the bottom...):

  Upgrading early: default-mysql-server
...
  Starting 2 pkgProblemResolver with broken count: 0
  Done
  The following packages were automatically installed and are no longer 
required:
libaio1 libsnappy1v5
  Use 'sudo apt autoremove' to remove them.
  The following additional packages will be installed:
gcc-12-base libc-bin libc6 libdaxctl1 libkmod2 libndctl6 libpmem1 libssl3
libstdc++6 liburing2 libzstd1 mariadb-client mariadb-client-core
mariadb-common mariadb-server mariadb-server-core
  Suggested packages:
glibc-doc libc-l10n locales libnss-nis libnss-nisplus mailx mariadb-test
netcat-openbsd
  Recommended packages:
manpages libdbd-mariadb-perl | libdbd-mysql-perl libterm-readkey-perl
libhtml-template-perl mariadb-plugin-provider-bzip2
mariadb-plugin-provider-lz4 mariadb-plugin-provider-lzma
mariadb-plugin-provider-lzo mariadb-plugin-provider-snappy pv
  The following packages will be REMOVED:
mariadb-client-10.5 mariadb-client-core-10.5 mariadb-server-10.5
mariadb-server-core-10.5
  The following NEW packages will be installed:
gcc-12-base libdaxctl1 libkmod2 libndctl6 libpmem1 libssl3 liburing2
mariadb-client mariadb-client-core mariadb-server mariadb-server-core
  The following packages will be upgraded:
default-mysql-server libc-bin libc6 libstdc++6 libzstd1 mariadb-common
  6 upgraded, 11 newly installed, 4 to remove and 189 not upgraded.
  Need to get 21.1 MB of archives.
...
  Preparing to unpack .../libc6_2.36-9_amd64.deb ...
  Unpacking libc6:amd64 (2.36-9) over (2.31-13+deb11u6) ...
  Setting up libc6:amd64 (2.36-9) ...
  Preparing to unpack .../libc-bin_2.36-9_amd64.deb ...
  Unpacking libc-bin (2.36-9) over (2.31-13+deb11u6) ...
  Setting up libc-bin (2.36-9) ...
  Preparing to unpack .../mariadb-common_1%3a10.11.2-1_all.deb ...
  Unpacking mariadb-common (1:10.11.2-1) over (1:10.5.19-0+deb11u2) ...
  Preparing to unpack .../default-mysql-server_1.1.0_all.deb ...
  Unpacking default-mysql-server (1.1.0) over (1.0.7) ...
  dpkg: mariadb-client-10.5: dependency problems, but removing anyway as you 
requested:
   mariadb-server-10.5 depends on mariadb-client-10.5 (>= 1:10.5.19-0+deb11u2).
   dbconfig-mysql depends on default-mysql-client | virtual-mysql-client; 
however:
Package default-mysql-client is not installed.
Package virtual-mysql-client is not installed.
Package mariadb-client-10.5 which provides virtual-mysql-client is to be 
removed.

  Removing mariadb-client-10.5 (1:10.5.19-0+deb11u2) ...
  Removing mariadb-client-core-10.5 (1:10.5.19-0+deb11u2) ...
  dpkg: mariadb-server-10.5: dependency problems, but removing anyway as you 
requested:
   zoph depends on default-mysql-server | virtual-mysql-server; however:
Package default-mysql-server is not configured yet.
Package virtual-mysql-server is not installed.
Package mariadb-server-10.5 which provides virtual-mysql-server is to be 
removed.

  Removing mariadb-server-10.5 (1:10.5.19-0+deb11u2) ...
  invoke-rc.d: could not determine current runlevel
  Stopping MariaDB database server: mariadbd [ESC][31mfailed![ESC][39;49m
  invoke-rc.d: initscript mariadb, action "stop" failed.
  dpkg: error processing package mariadb-server-10.5 (--remove):
   installed mariadb-server-10.5 package pre-removal script subprocess returned 
error exit status 1
  dpkg: too many errors, stopping
  Errors were encountered while processing:
   mariadb-server-10.5
  Processing was halted because there were too many errors.
  E: Sub-process /usr/bin/dpkg returned an error code (1)


Here apt choses a suboptimal removal order: mariadb-server-10.5 gets
removed (and therefore stopped, but that fails) only after
mariadb-client-10.5 and mariadb-client-core-10.5 are already gone.

I have tried the early upgrade scenario only with one other package that
needs it (icinga2-ido-mysql), and there it worked flawless.
Some bits from the log:

...
  Preparing to unpack .../mariadb-common_1%3a10.11.2-1_all.deb ...
  Unpacking mariadb-common (1:10.11.2-1) over (1:10.5.19-0+deb11u2) ...
  Preparing to unpack .../default-mysql-server_1.1.0_all.deb ...
  Unpacking default-mysql-server (1.1.0) over (1.0.7) ...
  Removing mariadb-server-10.5 (1:10.5.19-0+deb11u2) ...