Bug 32118

Summary: "Script failed" for mariadb popup during upgrade mga8->9
Product: Mageia Reporter: Morgan Leijström <fri>
Component: InstallerAssignee: QA Team <qa-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: High CC: bequimao.de, davidwhodgins, mageia
Version: Cauldron   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Source RPM: CVE:
Status comment:
Attachments: compressed report.bug

Description Morgan Leijström 2023-07-18 11:44:03 CEST
__Description of problem:

Upgrading using netinstaller, graphical interface, a popup:

  ERROR: 'script' failed for mariadb-10.11.4-1.mga9.x86_64

Upgrade finished successfully, system working.
I have never installed or configured mariadb manually on that system


__Version:
Per 2023-07-12 a fully updated mga8-64 plasma 64 bit, upgraded using latest nonfree netinstaller.


__How reproducible:
At least one other tester, from QA list
2023-07-14 kl. 17:27, Herman Viaene:
> As in previous tests with rc1 and last beta, I get an error on installing mariadb during the upgrade. The package is updated successfully after finishing the upgade OK and rebooting.
> Problem mentioned in the riseup pad. I have a .fsa backup of the M8 on which the upgrade was run. 


__Some lines from report.bug:
.
.
* trans: scheduling update of mariadb-core-10.11.4-1.mga9.x86_64 (id=29197, file=/mnt/var/cache/urpmi/rpms/mariadb-core-10.11.4-1.mga9.x86_64.rpm)
.
.
* urpmi error: ERROR: 'script' failed for mariadb-10.11.4-1.mga9.x86_64
* mariadb not installed, %prein(mariadb-10.11.4-1.mga9.x86_64) scriptlet failed, exit status 1
.
.
created transaction for installing on /mnt (remove=0, install=0, upgrade=48)
mariadb-client-10.11.4-1.mga9.x86_64
mariadb-common-10.11.4-1.mga9.x86_64
mariadb-common-core-10.11.4-1.mga9.x86_64
.
.
mariadb-extra-10.11.4-1.mga9.x86_64
mariadb-core-10.11.4-1.mga9.x86_64
.
.
Running in chroot, ignoring command 'is-active'
ERROR 2002 (HY000): Can't connect to local server through socket '/var/lib/mysql/mysql.sock' (2)
%prein(mariadb-10.11.4-1.mga9.x86_64) scriptlet failed, exit status 1    <<<<<<<<<<<<<<<<<
mariadb-10.11.4-1.mga9.x86_64
mariadb-10.11.4-1.mga9.x86_64: install failed     <<<<<<<<<<<<<<<<<<
.
.
mariadb-10.5.21-1.mga8.x86_64: erase skipped     <<<<<<<<<<<<<<<<
.
. 
* selecting packages task-x11
.
.
* found 2 packages to install: mariadb-10.11.4-1.mga9.x86_64, sound-scripts-0.62-23.mga9.noarch
* installing packages
.
.
* found 2 packages to install: mariadb-10.11.4-1.mga9.x86_64, sound-scripts-0.62-23.mga9.noarch
* install::pkgs::install /mnt
* install::pkgs::install the following: mariadb sound-scripts
* opened /mnt/root/drakx/install.log
* rpm transactions start
* scheduled sets of transactions:
* chrooted db version used by librpm is at least as good as non-rooted one
* transactions done, now trying to close still opened fd; exit code=0
* closing install.log file


And checking the installed system, mariadb-10.11.4-1.mga9 is installed, and no mariadb mga8 packages.
So it seems the install/update trigged by task-x11 saves the situation.

For another desktop, i suppose that might not happen.
- but I suppose  next normal update would fix that.

Question here is why %prein(mariadb-10.11.4-1.mga9.x86_64) scriptlet failed.
The result is a bad looking error popup message.
Morgan Leijström 2023-07-18 11:53:45 CEST

Priority: Normal => High
Assignee: bugsquad => mageiatools

Comment 1 Morgan Leijström 2023-07-18 11:56:30 CEST
Created attachment 13925 [details]
compressed report.bug
Ulrich Beckmann 2023-07-18 19:43:51 CEST

CC: (none) => bequimao.de

Comment 2 Dave Hodgins 2023-07-18 20:01:00 CEST
Assigning to the registered maintainer for mariadb.

Looks like the simplest solution is to add the command "true" at the
end of the preinstall scriptlet so force the return code to be zero
so that it works whether mariadb is currently running or not.

CC: (none) => davidwhodgins
Assignee: mageiatools => mageia

Comment 3 Thomas Backlund 2023-07-18 20:40:35 CEST
yeah, that is buggy / broken packaging... 
it assumes passwordless write access to databases
Comment 4 Ulrich Beckmann 2023-07-18 22:03:39 CEST
The database must have a clean shutdown, because there might be incompatible changes of the redo logs. Otherwise the database might be destroyed.

I saw many crashes of the user owned Akonadi database in the forums.
Comment 5 Dave Hodgins 2023-07-18 23:17:28 CEST
During an upgrade the script must not assume the service is running or
can be started as an upgrade using the classic iso does not allow it.

Database servers such as mariadb may or may not have a password and may be
for user level usage or system level usage (or both from one server).
/usr/share/doc/mariadb/README.urpmi strongly encourages setting a password
to protect the database, especially when used for web applications.

akonadi may use a postgresql or SQLite database, and mariadb is used by web
applications, not just kde/akonadi.

Ensuring a clean shutdown of any database can only be done by the users.

Clear instructions on how to do a clean shutdown must be given to the users
for upgrading using an iso. For users upgrading using mgaapplet, that can be
handled by a script, but only if the database service is already running, with
each type of database backend handled appropriately.
Comment 6 Dave Hodgins 2023-07-18 23:20:51 CEST
Note that any such script should be part of akonadi, so it doesn't break things
for apache/php.
Comment 7 Morgan Leijström 2023-07-18 23:37:49 CEST
> Clear instructions on how to do a clean shutdown must be given to the users
for upgrading using an iso.

I did a normal shutdown, from plasma launch menu. 
Normal shutdowns are not clean?


> For users upgrading using mgaapplet, that can be handled by a script, 
> but only if the database service is already running,
> with each type of database backend handled appropriately.

And we also need instructions for CLI; urpmi and dnf...


Setting for errata; explain the error popup if we do not fix it
Maybe for release notes, if we can add not too complicated instructions.
-If we fix it: neither above :)

Keywords: (none) => FOR_ERRATA8

Morgan Leijström 2023-07-18 23:39:05 CEST

Keywords: FOR_ERRATA8 => FOR_ERRATA9

Comment 8 Morgan Leijström 2023-07-20 09:49:23 CEST
https://wiki.mageia.org/en/Mageia_9_Errata#Upgrade_issues

Keywords: FOR_ERRATA9 => IN_ERRATA9

Comment 9 Marc Krämer 2023-07-20 10:46:30 CEST
There is no prein script in mariadb package. I don't know where this comes from. Maybe this is a rpm-macro?
Comment 11 Marc Krämer 2023-07-20 17:14:03 CEST
argh. I hate systems that name things differently.

there is no simple solution to that. It would be best integrated into mysql_upgrade. but most setups fail to install tz info which results in faulty time values.
We assume, that root is able to use/write the system database which should be true.
Comment 12 Marc Krämer 2023-07-20 17:16:55 CEST
But I think it must be moved to the post section - pre is wrong.
Comment 13 Thomas Backlund 2023-07-20 17:53:10 CEST
(In reply to Marc Krämer from comment #11)
> argh. I hate systems that name things differently.
> 
> there is no simple solution to that. It would be best integrated into
> mysql_upgrade. but most setups fail to install tz info which results in
> faulty time values.
> We assume, that root is able to use/write the system database which should
> be true.

you cant assume that, as any security minded admin will lock down mariadb, making the script fail...

Also, this part is not really correct:

%pre common-core
# enable plugins
if [ -f %{_sysconfdir}/my.cnf ]; then
	perl -pi -e "s|^#plugin-load|plugin-load|g" %{_sysconfdir}/my.cnf
	perl -pi -e "s|^#federated|federated|g" %{_sysconfdir}/my.cnf
	# switch to federatedx provider
	perl -pi -e "s|;ha_federated\.so$|;ha_federatedx\.so|g" %{_sysconfdir}/my.cnf
fi


if a sysadmin disables any of those, this will quietly re-enable them causing behaviour change on a working customized setup...
Comment 14 Dave Hodgins 2023-07-20 19:36:37 CEST
Keep in mind. The mysql root user is not the same as the linux root user.
The may (should) have different passwords.

The unhashed password is not available anywhere on the system. It is not
available to any scripts, let alone rpm scriplets.
Comment 15 Marc Krämer 2023-07-20 23:31:23 CEST
I really hate those blaming sessions.

That perl code is written by "alien"; I've never touched it. And it is really OLD. Maybe it is incorrect, but no one ever complained.

And even this bug was introduced by the end of march. So I guess most people have a .my.cnf file which connects to the database.

The idea with this script was, to make timezone data available to mariadb, which we do for almost all other package. I guess most people forget about this, as I did. And mariadb really makes wrong computations on timestamp data, if timezones are not available. So I thought it would be best to include this in our installation/update process.

Everyone makes mistakes - but anyway not setting the data is a mistake too. I could include a hint after the installation - but to be honest, who really reads those hints after updating 2000 packages from mga8 -> 9?
Comment 16 Thomas Backlund 2023-07-21 20:10:06 CEST
its not a blaming session...

this tend to happend in bugreports when rpm scripts fails, then people start looking closer at the scripts in the affected packages, and point out the issues they see...

no blaming, just pointing out issues that should be looked at / fixed some way...
Comment 17 Marc Krämer 2023-07-23 20:13:12 CEST
the pointed perl scripts don't have any effect, as the my.cnf file is almost empty, because of the configuration directory /etc/my.cnf.d

removed the perl scripts and the timezone script. Changed the readme file.
New package can be moved.
Comment 18 Marc Krämer 2023-07-28 11:27:03 CEST
changes can be moved.

Assignee: mageia => qa-bugs

Comment 19 Marc Krämer 2023-08-01 19:37:40 CEST
files are in updates_testing.

CC: (none) => mageia

Comment 20 Dave Hodgins 2023-08-02 00:05:02 CEST Comment hidden (obsolete)
Comment 21 Dave Hodgins 2023-08-02 01:03:30 CEST
Sorry, ignore comment 20 as that was installing while m9 was running, and
picked up the release version. Will retest doing a full upgrade.
Comment 22 Dave Hodgins 2023-08-02 01:30:08 CEST
Just realized. It can not be tested properly while it's in qa testing.

Will test that it's working in an m9 install, but the upgrade portion can not
be tested until it's pushed to core release, as the classical installer doesn't
allow using core updates testing, and testing while doing an upgrade using
urpmi doesn't test the problem properly.
Comment 23 Dave Hodgins 2023-08-02 01:34:30 CEST
Confirmed mysqld.service is working ok using phpmyadmin with
# rpm -qa|grep mariadb|sort
lib64mariadb3-10.11.4-2.mga9
lib64mariadbd19-10.11.4-2.mga9
mariadb-10.11.4-2.mga9
mariadb-client-10.11.4-2.mga9
mariadb-common-10.11.4-2.mga9
mariadb-common-core-10.11.4-2.mga9
mariadb-connect-10.11.4-2.mga9
mariadb-core-10.11.4-2.mga9
mariadb-extra-10.11.4-2.mga9

So ask for the freeze push, and then an upgrade can be testing using the
classical installer.
Comment 24 Marc Krämer 2023-08-02 01:36:58 CEST
except for the popup, the error would be thrown the same way.

I think we are in freeze phase, so it must be pushed here.
Comment 25 Dave Hodgins 2023-08-02 01:56:34 CEST
Freeze pushes for cauldron are still handled in the dev ml, not via bug reports.
Some testing (usually by the packager) is required in advance, but not to the
same level as on a stable release.

I thought the purpose of this update was to fix the script failed message.
If not, then this update must be rejected, and m9 will remain on hold until
it is fixed.
Comment 26 Marc Krämer 2023-08-02 01:59:12 CEST
it was removed.

If it is tested here, why not pushed via qa? I don't get it.
Comment 27 Dave Hodgins 2023-08-02 03:51:20 CEST
With a stable release, each update is handled by an advisory such as
https://svnweb.mageia.org/advisories/31997.adv?revision=14824&view=markup

The srpm list in the advisory is used by the script that pushes updates to
move the srpm and associated rpm packages from updates testing to updates.

In cauldron, even in the freeze period the updates are move from the
updates testing repos to the release repos, based on a request in the dev ml.

When the final iso images are created, normally it only includes packages from
the release repos.

As https://svnweb.mageia.org/packages/cauldron/mariadb/current/SPECS/mariadb.spec?revision=1961318&view=markup#l915
is still trying to install the tz data into the mysql database, which will
fail during an upgrade due to being in a chroot, and will fail during
install of a normal update in a stable release if the admin has followed
the readme to create a mysql password for the mysql root user.

An update must not assume the service is running or ready to be started.
The proper way to handle getting the tz data installed is to inform the user
it's needed, and tell them what commands are needed so that they can manually
install the tz data, after the login to mysql with the proper password.

If it's needed for a per user copy of mysqld, then the admin must be
informed that they need to inform all users, not just the one who installed
the update.
Comment 28 Dave Hodgins 2023-08-02 03:55:36 CEST
Once the final iso images pass testing, then cauldron is forked and a new stable
release is created. Only then do updates start getting moved from updates testing
to the updates repos. Until then packages are moved from updates testing to
release.
Comment 29 Marc Krämer 2023-08-02 09:49:37 CEST
that is really nonsense.
Ok. Then I wait until release.
Comment 30 Marc Krämer 2023-08-02 09:51:09 CEST
(In reply to Dave Hodgins from comment #27)
> With a stable release, each update is handled by an advisory such as
> https://svnweb.mageia.org/advisories/31997.adv?revision=14824&view=markup
> 
> The srpm list in the advisory is used by the script that pushes updates to
> move the srpm and associated rpm packages from updates testing to updates.
> 
> In cauldron, even in the freeze period the updates are move from the
> updates testing repos to the release repos, based on a request in the dev ml.
> 
> When the final iso images are created, normally it only includes packages
> from
> the release repos.
> 
> As
> https://svnweb.mageia.org/packages/cauldron/mariadb/current/SPECS/mariadb.
> spec?revision=1961318&view=markup#l915
> is still trying to install the tz data into the mysql database, which will
> fail during an upgrade due to being in a chroot, and will fail during
> install of a normal update in a stable release if the admin has followed
> the readme to create a mysql password for the mysql root user.
> 
> An update must not assume the service is running or ready to be started.
> The proper way to handle getting the tz data installed is to inform the user
> it's needed, and tell them what commands are needed so that they can manually
> install the tz data, after the login to mysql with the proper password.
> 
> If it's needed for a per user copy of mysqld, then the admin must be
> informed that they need to inform all users, not just the one who installed
> the update.

the update uses rev 1964111
Comment 31 Dave Hodgins 2023-08-02 17:55:08 CEST
Free push requested on the dev ml
Comment 32 Thomas Backlund 2023-08-12 12:24:46 CEST
moved to release ~1 week ago

Resolution: (none) => FIXED
Status: NEW => RESOLVED

Comment 33 Morgan Leijström 2023-08-12 14:34:44 CEST
Removed from errata

Keywords: IN_ERRATA9 => (none)