Bug 15827

Summary: Upgrading from mga4 needs mysql_upgrade
Product: Mageia Reporter: Thomas Spuhler <thomas>
Component: RPM PackagesAssignee: AL13N <alien>
Status: RESOLVED OLD QA Contact:
Severity: major    
Priority: Normal CC: davidwhodgins, laidlaws, marja11
Version: CauldronKeywords: IN_ERRATA5
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard: MGA5TOO
Source RPM: mariadb-10.0.17-1.mga5 CVE:
Status comment:
Attachments: Error message

Description Thomas Spuhler 2015-05-03 02:22:16 CEST
After upgrading mariadb from mga4 to mga5 (or cauldron) one has tu run mysql_upgrade

This is mentioned in the update information, but the advice is wrong and not working. This is being told:
The initscript used to start mysql has been reverted to use the one shipped
by MariaDB. This means the following changes:

 * The generation of the initial system mysql database is now done when mysql
   is started from the initscript and only if the /var/lib/mysql/mysql
   directory is empty (mysql_install_db). Previousely this was quite hidden and
   silently done at (rpm) install time. As a consequence to this change you may
   have to perform some manual tasks to upgrade the mysql system database and
   such. So, doing something like this might help you:

   systemctl stop mysqld.service
   TMPDIR=/var/tmp mysql_install_db
   mysql_upgrade --skip-write-binlog

But mysql_upgrade needs to be run with a running mariadb.
See errors shown in the attachment


Reproducible: 

Steps to Reproduce:
Comment 1 Thomas Spuhler 2015-05-03 02:24:11 CEST
Created attachment 6431 [details]
Error message

Error Message attached
Comment 2 Thomas Spuhler 2015-05-03 02:27:24 CEST
I am going to rate this as a release blocker. This is a DB that is used extensively and w/o upgrading we may loose data. Please feel free to rate it differently

Priority: Normal => release_blocker
Assignee: bugsquad => alien

Comment 3 AL13N 2015-05-03 08:53:23 CEST
whoa... don't exagerrate... there is no losing data here...

but the information should be adjusted...

there has been upstream some discussion on what type of systemd unit and with automatic upgrade and such, but afaik there is no final version yet...
Comment 4 Rémi Verschelde 2015-05-03 12:26:18 CEST
Decreasing priority, this does not affect the installer so it can be fixed after the Mageia 5 release. At this stage, release blockers should only be bugs affecting the installer or that bring severe usability or security issues.

Priority: release_blocker => Normal
Severity: critical => major

Comment 5 Thomas Spuhler 2015-05-03 16:57:32 CEST
(In reply to AL13N from comment #3)
> whoa... don't exagerrate... there is no losing data here...
> 
> but the information should be adjusted...
> 
> there has been upstream some discussion on what type of systemd unit and
> with automatic upgrade and such, but afaik there is no final version yet...

I am glad there will be no lose of data. But w/o upgrade the logs surely look scary.
Comment 6 Doug Laidlaw 2015-05-07 09:11:04 CEST
Just experienced the original bug.  Started mysql first and the upgrade ran to conclusion.  But it wasn't my real problem.

CC: (none) => laidlaws

Comment 7 Thomas Spuhler 2015-05-19 22:41:18 CEST
This package has been upgraded, but this bug hasn't been touched.
Samuel Verschelde 2015-05-19 23:45:19 CEST

Whiteboard: (none) => MGA5TOO FOR_ERRATA

Comment 8 Doug Laidlaw 2015-05-20 03:36:31 CEST
Can't comment.  Haven't had occasion to try again.

The README.urpmi has:

   systemctl stop mysqld.service
   TMPDIR=/var/tmp mysql_install_db
   mysql_upgrade --skip-write-binlog

Deleting the first line should do it?
Should there be an extra / in Line 2 ?
Comment 9 Thomas Spuhler 2015-05-20 03:58:18 CEST
I did an update. I just run mysql_upgrade
but the server must be running.
Comment 10 Samuel Verschelde 2015-05-20 09:16:42 CEST
Would:

   systemctl stop mysqld.service
   TMPDIR=/var/tmp mysql_install_db
   systemctl start mysqld.service
   mysql_upgrade --skip-write-binlog

Be ok?
Comment 11 Thomas Spuhler 2015-05-20 16:53:02 CEST
According to
https://mariadb.com/kb/en/mariadb/upgrading-from-mariadb-55-to-mariadb-100/

all that is required and recommended is to run:
mysql_upgrade

some distros do it automatically at upgrade, but I am not in favor of it. The database/sysadmin should decide when to run it.
Comment 12 Samuel Verschelde 2015-05-20 17:35:30 CEST
It'd nice from AL13N to comment, we just need to put the relevant instructions in release notes and in the message showed to the user after upgrade.
Comment 13 Samuel Verschelde 2015-06-09 12:18:24 CEST
I'm still eager to add this to Errata but I really don't know what to write!
Comment 14 Samuel Verschelde 2015-06-09 12:18:36 CEST
(In reply to Samuel VERSCHELDE from comment #13)
> I'm still eager to add this to Errata but I really don't know what to write!

or release notes
Comment 15 Doug Laidlaw 2015-06-09 15:32:55 CEST
The message you need to get across is, IMO, from my Comment 8, that the line:

systemctl stop mysqld.service

is wrong.

If mysqld.service is running, leave it that way.  Perhaps change the sentence

"So, doing something like this might help you:"

to 

"Mariadb must be running when you do the following:

   TMPDIR=/var/tmp mysql_install_db
   mysql_upgrade --skip-write-binlog"

but I am not really happy with that either, as a way of putting the message across.
Comment 16 Thomas Spuhler 2015-06-19 22:26:09 CEST
added Paragraph to errata.
Comment 17 Marja Van Waes 2015-06-20 00:09:48 CEST
(In reply to Thomas Spuhler from comment #16)
> added Paragraph to errata.

https://wiki.mageia.org/en/Mageia_5_Errata#Upgrading_Mariadb

Thanks, Thomas :-)

CC: (none) => marja11
Whiteboard: MGA5TOO FOR_ERRATA => MGA5TOO IN_ERRATA

Comment 18 Thomas Spuhler 2015-10-17 00:11:55 CEST
(In reply to Marja van Waes from comment #17)
> (In reply to Thomas Spuhler from comment #16)
> > added Paragraph to errata.
> 
> https://wiki.mageia.org/en/Mageia_5_Errata#Upgrading_Mariadb
> 
> Thanks, Thomas :-)

Are we now happy with ERRATA or are we going to fix this one day?
Comment 19 AL13N 2015-10-17 17:30:19 CEST
there's discussion on how to fix this upstream with systemd...
Comment 20 Thomas Spuhler 2015-10-17 18:10:18 CEST
do you really want to do this automatically?
I would prefer to fix the message and then leave it alone.
Comment 21 Dave Hodgins 2015-10-18 20:08:08 CEST
Can it be done automatically if the sql root user has a password, as
recommended by /usr/share/doc/mariadb/README.urpmi ?

CC: (none) => davidwhodgins

Comment 22 Doug Laidlaw 2015-10-18 20:29:04 CEST
I have had this problem only once, and I would be happy with an "errata."  I will leave it to the sysadmins to decide.  One less fiddle may be welcome to them.
Comment 23 AL13N 2015-10-18 23:09:56 CEST
actually, if upstream has a clean way of doing this, that would be great, but with auth_pam, a password might not even be needed, for a system account...

i would prefer to fix this with upstream and just have a message and wait for them to fix this in a better way...
Comment 24 Thomas Spuhler 2016-03-12 19:36:19 CET
Why don't we fix the error in the README.urpmi and move on.
Comment 25 Doug Laidlaw 2016-03-12 19:55:10 CET
That was my thought from the beginning, but I am not a sysadmin.
Comment 26 Marja Van Waes 2017-03-29 07:11:25 CEST
This bug is set to Version: cauldron, but I understand this is _no_ problem for Mga5=>6, correct?

Please set this report to Version: 5, and remove MGA5TOO from the whiteboard if it won't be a mga5->6 upgrade problem.

Or, if it will be a problem, either:
* add the FOR_ERRATA6 keyword
* add the IN_ERRATA6 keyyword and also add a note about it to:
  https://wiki.mageia.org/en/Mageia_6_Errata#Mariadb

Keywords: (none) => IN_ERRATA5
Whiteboard: MGA5TOO IN_ERRATA => MGA5TOO

Comment 27 Marja Van Waes 2017-06-11 09:31:21 CEST
(In reply to Marja van Waes from comment #26)
> This bug is set to Version: cauldron, but I understand this is _no_ problem
> for Mga5=>6, correct?


@ AL13N

I suppose you know?

> 
> Please set this report to Version: 5, and remove MGA5TOO from the whiteboard
> if it won't be a mga5->6 upgrade problem.
> 
> Or, if it will be a problem, either:
> * add the FOR_ERRATA6 keyword
> * add the IN_ERRATA6 keyyword and also add a note about it to:
>   https://wiki.mageia.org/en/Mageia_6_Errata#Mariadb
Comment 28 Doug Laidlaw 2017-06-14 17:34:19 CEST
I haven't needed to upgrade for a while. Currently running 6 RC.  I make every distro upgrade a reinstall.  I delete existing databases, restore them from a backup, grant permissions all over again, and that is all I need to do.  Maybe I need to restore the db containing the permissions as well, but I have only two small databases.  So I can't really help Marja.
Comment 29 Marja Van Waes 2017-11-24 20:29:08 CET
Thanks for trying to answer my question, Doug.

No one reported that this bug still exists for mga5=>6 upgrades, so closing this bug as OLD.

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