Bug#1108553: [debian-mysql] Bug#1108553: mariadb-server: Upgrading 1:11.8.1-4 to 1:11.8.2-1 generates warning and error, but appears to work

2025-11-26 Thread Otto Kekäläinen
> Hi Daniel!
>
> You filed this https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1108553
> and https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1105029, both
> with with detailed investigations and a patch for upstream code. Did
> you open PR(s) upstream, did they accept your fix?

Just checking how it went with these?

It would be great if you could contribute this fix directly to
upstream systemd files (see
https://github.com/MariaDB/server/tree/main/support-files).



Bug#1105029: [debian-mysql] Bug#1108553: mariadb-server: Upgrading 1:11.8.1-4 to 1:11.8.2-1 generates warning and error, but appears to work

2025-08-28 Thread Otto Kekäläinen
Hi Daniel!

You filed this https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1108553
and https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1105029, both
with with detailed investigations and a patch for upstream code. Did
you open PR(s) upstream, did they accept your fix?

- Otto



Bug#1108553: mariadb-server: Upgrading 1:11.8.1-4 to 1:11.8.2-1 generates warning and error, but appears to work

2025-07-04 Thread Daniel Lewart
Control: reassign -1 src:mariadb
Control: tags -1 patch

Dear Otto, et al,

Thank you for your comments!

Untested patch for the "mysql.user table already exists!" error is attached.

Regarding the "mariadb.service changed on disk" warning,
I think it should be handled by dh_installsystemd.
This part of the rules file seems correct, but I am no expert:
   212# Define name used for service, and install mariadb.service
on Linux only
   213override_dh_installsystemd:
   214ifneq (,$(filter linux,$(DEB_HOST_ARCH_OS)))
   215dh_installsystemd -pmariadb-server mariadb.service
   216endif

Thank you!
Daniel Lewart
Urbana, Illinois
diff -ru a/mariadb-server.postinst b/mariadb-server.postinst
--- a/mariadb-server.postinst	2025-06-08 03:19:07.0 -0500
+++ b/mariadb-server.postinst	2025-07-05 00:00:00.0 -0500
@@ -183,20 +183,23 @@
 touch "$mysql_datadir/debian-__MARIADB_MAJOR_VER__.flag"
 
 # initiate databases. Output is not allowed by debconf :-(
-# This will fail if we are upgrading an existing database; in this case
+# This will skip if we are upgrading an existing database; in this case
 # mariadb-upgrade, called from the /etc/mysql/debian-start script, will
 # handle things.
 # Debian: beware of the bashisms...
 # Debian: can safely run on upgrades with existing databases
 # Workaround for Debian Bug #1022994: failure to create database when
 # working with libpam-tmpdir (by setting TMPDIR to empty value).
-set +e
-TMPDIR='' bash /usr/bin/mariadb-install-db \
-  --rpm --cross-bootstrap \
-  --user=mysql --disable-log-bin \
-  --skip-test-db 2>&1 |
-  $ERR_LOGGER
-set -e
+if [ ! -f "$mysql_datadir/mysql/user.frm" ]
+then
+  set +e
+  TMPDIR='' bash /usr/bin/mariadb-install-db \
+--rpm --cross-bootstrap \
+--user=mysql --disable-log-bin \
+--skip-test-db 2>&1 |
+$ERR_LOGGER
+  set -e
+fi
 
 # On new installations root user can connect via unix_socket.
 # But on upgrades, scripts rely on debian-sys-maint user and


Bug#1108553: mariadb-server: Upgrading 1:11.8.1-4 to 1:11.8.2-1 generates warning and error, but appears to work

2025-06-30 Thread Otto Kekäläinen
Hi!

Thanks for a detailed report!

The mariadb.service file for systemd/systemctl is inherited as-is from
upstream and it has a change in the most recent upstream release:
https://salsa.debian.org/mariadb-team/mariadb-server/-/blob/debian/latest/support-files/mariadb.service.in

Off the top of my head I don't know how systemd is designed to handle
service file updates, and if this warning is supposed to trigger every
single time any service file updates, and if packages are supposed to
do anything more than just trigger service reloads (like done via
https://salsa.debian.org/mariadb-team/mariadb-server/-/blob/debian/latest/debian/mariadb-server.triggers)
or if maintainer scripts are supposed to run systemctl reloads on
their own.

What comes to the 'mysql.user table already exists!' warning, there
are at least no changes in the maintainer script
https://salsa.debian.org/mariadb-team/mariadb-server/-/blob/debian/latest/debian/mariadb-server.postinst
in latest 1:11.8.2-1, nor for a long time before it either. The `--rpm
--cross-bootstrap` has existed for 10+ years since
https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8823defebeb9bd5c75e4398541a8cf295d5014db
and are correct, albeit confusingly named upstream parameters to tell
the script it is being called from a Linux packaging script.

The most recent functional change to this section is
https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/cde8b8613e08ecb8d5f4a5de09d34418576d3040
by Sunil, but I don't see how it would cause the warnings you are
seeing.

Thus, I think that the mariadb-install-db section has probably emitted
that warning all the time. But you are correct to point out that it is
bad design to have warnings emitted to users about something users
should not worry about. The `mariadb-install-db` should run only if
the data directory is empty and no database exists, and otherwise
`mariadb-upgrade` should run to upgrade the existing database.



Bug#1108553: mariadb-server: Upgrading 1:11.8.1-4 to 1:11.8.2-1 generates warning and error, but appears to work

2025-06-30 Thread Daniel Lewart
Package: mariadb-server
Version: 1:11.8.2-1
Severity: minor

Dear Otto, et al,

Upgrading mariadb-server from version 1:11.8.1-4 to 1:11.8.2-1
generates a warning and an error, but appears to work:

$ sudo apt-get install mariadb-server
...
Setting up mariadb-server (1:11.8.2-1) ...
Warning: The unit file, source configuration file or drop-ins of 
mariadb.service changed on disk. Run 'systemctl daemon-reload' to reload units.

$ journalctl -p3 -t mariadb-server.postinst
... debian mariadb-server.postinst[n]: mysql.user table already exists!
... debian mariadb-server.postinst[n]: Run mariadb-upgrade, not 
mariadb-install-db

$ sudo mariadb-upgrade
This installation of MariaDB is already upgraded to 11.8.1-MariaDB.
There is no need to run mariadb-upgrade again for 11.8.2-MariaDB, because 
they're both 11.8.
You can use --force if you still want to run mariadb-upgrade

Relevant excerpt from mariadb-server.postinst:
   185  # initiate databases. Output is not allowed by debconf :-(
   186  # This will fail if we are upgrading an existing database; in this 
case
   187  # mariadb-upgrade, called from the /etc/mysql/debian-start script, 
will
   188  # handle things.
   189  # Debian: beware of the bashisms...
   190  # Debian: can safely run on upgrades with existing databases
   191  # Workaround for Debian Bug #1022994: failure to create database 
when
   192  # working with libpam-tmpdir (by setting TMPDIR to empty value).
   193  set +e
   194  TMPDIR='' bash /usr/bin/mariadb-install-db \
   195--rpm --cross-bootstrap \
   196--user=mysql --disable-log-bin \
   197--skip-test-db 2>&1 |
   198$ERR_LOGGER
   199  set -e

Perhaps the journal errors could be addressed by the following?:
if [ ! -f "$mysql_datadir/mysql/user.frm" ]; then

fi

Also, why is "--rpm --cross-bootstrap" used?

Thank you!
Daniel Lewart
Urbana, Illinois