You are not logged in.

#1 2014-07-13 05:20:48

amish
Member
Registered: 2014-05-10
Posts: 475

MariaDB upgrade and akonadi

As per this announcement yesterday:
MariaDB 10.0 enters [extra]

MariaDB was upgraded and required running mysql_upgrade

However mysql_upgrade does not cover Akonadi, which uses per user mysql databases for its data.

Here are steps I did to upgrade each user's mysql akonadi database: (just incase it helps)


Note:
Replace "userid" below with actual userid
DB upgrade may not really be required but its a good idea to upgrade (may be to use better algorithms/indexes etc.)

Preparing
Logout of KDE (so that akonadi shuts down and does not make any more changes to database)
Go to any tty (say Ctrl-Alt-F2 for tty2)
Login as user whose akonadi database is to be upgraded


Before upgrading MariaDB (Do for each KDE user)

rm /tmp/akodbbkp-userid-mysql.socket
/usr/bin/mysqld --defaults-file=/home/userid/.local/share/akonadi/mysql.conf --datadir=/home/userid/.local/share/akonadi/db_data/ --socket=/tmp/akodbbkp-userid-mysql.socket &
sleep 5
mysqldump --socket=/tmp/akodbbkp-userid-mysql.socket --add-drop-database --all-databases > akonadi.sql
### create database mysql because mysql_upgrade assumes its existence
mysql --socket=/tmp/akodbbkp-userid-mysql.socket -e 'create database mysql'
mysqladmin --socket=/tmp/akodbbkp-userid-mysql.socket shutdown
sleep 5

Upgrade MariaDB

sudo pacman -Syu

After upgrading MariaDB (Do for each KDE user)

/usr/bin/mysqld --defaults-file=/home/userid/.local/share/akonadi/mysql.conf --datadir=/home/userid/.local/share/akonadi/db_data/ --socket=/tmp/akodbbkp-userid-mysql.socket &
sleep 5
mysql --verbose --socket=/tmp/akodbbkp-userid-mysql.socket < akonadi.sql > import.log
mysql_upgrade --socket=/tmp/akodbbkp-userid-mysql.socket
### mysqladmin will not work now, so we kill the process
killall mysqld
sleep 10
/usr/bin/mysqld --defaults-file=/home/userid/.local/share/akonadi/mysql.conf --datadir=/home/userid/.local/share/akonadi/db_data/ --socket=/tmp/akodbbkp-userid-mysql.socket &
### now if you want then drop database mysql which is not used by akonadi
### or you can leave it there so future use of 'mysql_upgrade' does not show error
### we run twice because for some reason first time gives error
mysql --socket=/tmp/akodbbkp-userid-mysql.socket -e 'drop database mysql'
mysql --socket=/tmp/akodbbkp-userid-mysql.socket -e 'drop database mysql'
mysqladmin --socket=/tmp/akodbbkp-userid-mysql.socket shutdown
sleep 5
rm /tmp/akodbbkp-userid-mysql.socket #incase it exists

Hope this helps.


Additional notes:

This time it was a major release of MariaDB hence it needed manual DB dumping/restoring.

But in most cases, after MariaDB is upgraded, running this command should be sufficient: (for akonadi)

#create mysql DB if does not exist
mysql --socket=/tmp/akonadi-userid.XXXXXX/mysql.socket -e 'create database mysql'
mysql_upgrade --socket=/tmp/akonadi-userid.XXXXXX/mysql.socket

where:
XXXXXX varies at every KDE boot, so you need to find it out before running that command.
replace userid is your userid

Afterwards simply logout of KDE and relogin. (which will also restart mysqld of akonadi)

Last edited by amish (2014-07-15 03:36:04)

Offline

#2 2014-07-13 18:52:28

lxkraken
Member
Registered: 2014-07-13
Posts: 3

Re: MariaDB upgrade and akonadi

Wish I would have read this before doing a full upgrade. Any idea what can be done post- 'pacman -Syu'?

Thanks.

Offline

#3 2014-07-13 21:42:06

ProfessorTomoe
Member
From: Garland, TX
Registered: 2008-02-12
Posts: 61

Re: MariaDB upgrade and akonadi

lxkraken wrote:

Wish I would have read this before doing a full upgrade. Any idea what can be done post- 'pacman -Syu'?

I've got the same problem, unfortunately.  Someone, please throw us a lifeline here!

Offline

#4 2014-07-13 21:59:35

okubax
Member
From: Kent, UK.
Registered: 2010-04-24
Posts: 210
Website

Re: MariaDB upgrade and akonadi

I did upgrade mariadb to v10 before reading this and rebooted, akonadi & kmail couldn't start and throws some errors. I then downgraded mariadb packages and rebooted and my system was back to normal with kmail and akonadi working as normal.

I then followed this guide, upgraded mariadb and kmail and akonadi are working as expected. Thanks for this mate!.

Last edited by okubax (2014-07-13 21:59:51)

Offline

#5 2014-07-13 22:52:33

ProfessorTomoe
Member
From: Garland, TX
Registered: 2008-02-12
Posts: 61

Re: MariaDB upgrade and akonadi

okubax wrote:

I did upgrade mariadb to v10 before reading this and rebooted, akonadi & kmail couldn't start and throws some errors. I then downgraded mariadb packages and rebooted and my system was back to normal with kmail and akonadi working as normal.

I then followed this guide, upgraded mariadb and kmail and akonadi are working as expected. Thanks for this mate!.

Now *that's* what I call a lifeline.  Problem solved here as well.  Thanks!

Offline

#6 2014-07-14 03:55:05

amish
Member
Registered: 2014-05-10
Posts: 475

Re: MariaDB upgrade and akonadi

Yes in most such cases downgrading works, unless upgrade did lots of config changes.

Offline

#7 2014-07-14 04:02:09

amish
Member
Registered: 2014-05-10
Posts: 475

Re: MariaDB upgrade and akonadi

This was a major release of MariaDB hence it needed manual DB dumping/restoring.

But in most cases, after MariaDB is upgraded, running this command should be sufficient: (for akonadi)

#create mysql DB if does not exist
mysql --socket=/tmp/akodbbkp-userid-mysql.socket -e 'create database mysql'
mysql_upgrade --socket=/tmp/akonadi-userid.XXXXX/mysql.socket

where:
XXXXX varies at every KDE boot, so you need to find it out before running that command.
replace userid is your userid

Afterwards simply logout of KDE and relogin. (which will also restart mysqld of akonadi)

Last edited by amish (2014-07-14 04:12:15)

Offline

#8 2014-07-14 11:34:31

aexoxea
Member
From: Australia
Registered: 2012-11-17
Posts: 70
Website

Re: MariaDB upgrade and akonadi

amish, you're a champion. Like others here I had already upgraded mariadb and performed mysql_upgrade, but using these instructions in concert with a temporary downgrade (ala okubax) has Akonadi working once more. Many thanks for posting this!

Offline

#9 2014-07-14 15:05:47

epsilom
Member
Registered: 2009-04-18
Posts: 29

Re: MariaDB upgrade and akonadi

the solution for me was deleting ~/.local/share/akonadi/mysql.conf

this bug reported here

Offline

#10 2014-07-14 16:01:08

amish
Member
Registered: 2014-05-10
Posts: 475

Re: MariaDB upgrade and akonadi

Deleting mysql.conf may have worked but does not sound to be right solution.

Recreating database (backup and restore) is probably safest solution.

Offline

#11 2014-07-14 23:07:27

camarao
Member
Registered: 2013-01-29
Posts: 27

Re: MariaDB upgrade and akonadi

Hi everybody,

after upgrading MariaDB to the version 10, my akonadi also broke. I did as okubax and downgraded MariaDB to the previous version and akonadi got back online. Different from okubax, not everything went back as it was before. Now, I am not able to start my downgraded MariaDB, it keeps complaining that the mysqld.socket is missing. Indeed I searched for the socket in /run and /var and it is missing. I've been looking around to find how to recover the missing mysqld.socket but for no avail.

I am wondering if now I will be able to do the upgrade to version 10 from MariaDB as suggested before. Any suggestions?

Offline

#12 2014-07-15 07:05:17

Dhraakellian
Member
Registered: 2012-01-18
Posts: 2

Re: MariaDB upgrade and akonadi

If you don't want to log all the way out of KDE while doing the upgrade, the following appears to have worked for me

edit: but see amish's caveats below

kquitapp kmail
akonadictl stop

I then verified with htop that neither kmail nor akonadi were running (nor, in fact, anything mysql, I saw), ran the steps above, and rebooted (due to a kernel update that came in the pacman -Syu).

At a glance, kmail appears to be working properly

Last edited by Dhraakellian (2014-07-15 07:32:56)

Offline

#13 2014-07-15 07:17:58

amish
Member
Registered: 2014-05-10
Posts: 475

Re: MariaDB upgrade and akonadi

Yes that works too if you just use kmail.

Otherwise you need to kill many other apps which use akonadi.(Clock widget / Korganizer etc.)

Safe bet is to logout as akonadi may automatically be activated again if some other app send request for akonadi while you are in still process of upgrading.

Offline

#14 2014-07-15 19:08:56

xcomcmdr
Member
Registered: 2012-02-25
Posts: 2

Re: MariaDB upgrade and akonadi

Did a pacman -Syu.
Tried what the archlinux.org front page said :

systemctl restart mysqld
mysqld upgrade

Seemed to work OK.

On next boot, akonadi was not able to start (oops !), because mysqld crashed with signal 11.

Deleting ~/.local/share/akonadi/mysql.conf and restarting the akonadi server from the GUI (kcmshell4 kcm_akonadi_server) fixed it.

Last edited by xcomcmdr (2014-07-15 19:10:51)

Offline

#15 2014-07-18 11:39:55

matersci
Member
From: Hellas
Registered: 2006-01-19
Posts: 169

Re: MariaDB upgrade and akonadi

Some files mentioned in the first post don't exist in my system. For example I don't have .local/share/akonadi/mysql.conf and my /tmp/akodbbkp-userid-mysql.socket doesn't exist when akonadi is not running. So I tried the easiest way, I deleted ~/.local/share/akonadi/mysql.conf and everything ok.

Offline

#16 2014-07-18 11:45:05

amish
Member
Registered: 2014-05-10
Posts: 475

Re: MariaDB upgrade and akonadi

If your home is not in /home/userid then ofcourse file path will change accordingly.

Also socket file is temporary file, it is not supposed to exist anyway. (It gets created when mysqld runs and deleted when mysqld exits)

I added rm command just to be safe.

Offline

#17 2014-07-23 16:42:17

Moviuro
Member
Registered: 2012-06-03
Posts: 74

Re: MariaDB upgrade and akonadi

ProfessorTomoe wrote:
lxkraken wrote:

Wish I would have read this before doing a full upgrade. Any idea what can be done post- 'pacman -Syu'?

I've got the same problem, unfortunately.  Someone, please throw us a lifeline here!

RTFM
man 8 pacman
-U


bspwm, BTRFS over LUKS
Archlinux a lot, FreeBSD more and more...
Murphy's rule: The day you need a backup, you tell yourself you should have created some.

Offline

#18 2014-07-23 18:09:42

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,244

Re: MariaDB upgrade and akonadi

Sometimes, telling someone to read the fine manual is the correct thing to do.  In this case, that response was not only untimely, it was also moot.  The person who asked the question had solved the problem and had thanked those who helped them. 

https://wiki.archlinux.org/index.php/Fo … ther_Users

Be good to each other.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#19 2014-07-26 12:33:28

Caldazar
Member
Registered: 2012-06-21
Posts: 38

Re: MariaDB upgrade and akonadi

None of this works for me at all.

I did a huge pacman -Syu yesterday, including a KDE-Upgrade.

Of course I restarted and upgraded mysql. All went fine until the end of mysql_upgrade where the first error happens.

Could not create the upgrade info file '/var/lib/mysql/mysql_upgrade_info' in the MySQL Servers datadir, errno: 13

Now akonadi (and K-Mail with it) doesn't start but returns a multitude of errors.
Mysql server protocol errors, Akonadi not registered on D-Bus, no resource agent found and whatnot. Totally borked.

I tried every possible solution in this thread, nothing works. By that I mean: not a single command.
None of the mentioned files in /tmp is actually there.
Mysql doesn't execute any of the commands without error, despite the status of mysqld.service looking fine.

When downgrading the mariadb packages and rebooting akonadi still doesn't work but gives the same errors as with mariadb 10.

Any ideas where I could start to repair this whole mess?


4.4.11-1-lts #1 SMP Thu May 19 21:03:24 CEST 2016 x86_64 GNU/Linux
KDE
AMD Phenom II X4 960T - AMD Radeon HD 6670 with Catalyst - 24GB RAM

Offline

#20 2014-07-26 13:00:06

amish
Member
Registered: 2014-05-10
Posts: 475

Re: MariaDB upgrade and akonadi

I was able upgrade easily to 10.0.12-2 following Additional notes section in first post.

#create mysql DB if does not exist
mysql --socket=/tmp/akonadi-userid.XXXXXX/mysql.socket -e 'create database mysql'
mysql_upgrade --socket=/tmp/akonadi-userid.XXXXXX/mysql.socket

After that logout from KDE and relogin.

Infact since version bump is from 10.0.12-1 to 10.0.12-2. I dont think even mysql_upgrade was necessary (Just logout from KDE and relogin).

But I did nonetheless.

Last edited by amish (2014-07-26 13:02:06)

Offline

#21 2014-07-26 15:25:48

Desade
Member
Registered: 2012-01-31
Posts: 7

Re: MariaDB upgrade and akonadi

I had already updated mariadb to 10.0.12-1, and run mysql_upgrade, before finding this post. I downgraded mariadb to 5.5.37-1, but then found myself in a situation where I couldn't start mysqld in the akonadi tree because various important tables didn't exist (mysql_plugin, for one). This kept me from running the database dump, or the mysql_upgrade under 5.5.37-1, or even creating a new mysql database.

Not wanting to risk losing my entire mail database, I was leery about running mysql_install_db. So I copied the default mysql database directory structure from /var/lib/mysql to the akonadi data dir above, and then started mysqld. There was a lot of barfing, but it limped along enough for me to execute amish's steps in the original post and get KMail working again.

Thanks amish!

Offline

#22 2014-07-26 15:35:24

Caldazar
Member
Registered: 2012-06-21
Posts: 38

Re: MariaDB upgrade and akonadi

I had the innodb inizialization problem described and solved in MySQL Reference: Troubleshooting InnoDB I/O Problems.

Because my first attempt to solve the problem described in this thread created the database for Akonadi but not the logfile.
After that I had no chance to give any commands because from that point on innodb would crash right on start.

Solution:
The solution from the mysql troubleshooting page meant for my specific problem that
I had to rename / delete the following in '/home/<myusername>/.local/share/akonadi/db_data/'

- all ibdata and ib_log files
- akonadi/ with its .frm and .ibd files

After that I could just start akonadi. It re-created the database and everything worked fine.
(That is even without amish' steps)
At least for KMail I've recognised no data loss.

Last edited by Caldazar (2014-07-26 15:40:18)


4.4.11-1-lts #1 SMP Thu May 19 21:03:24 CEST 2016 x86_64 GNU/Linux
KDE
AMD Phenom II X4 960T - AMD Radeon HD 6670 with Catalyst - 24GB RAM

Offline

#23 2014-07-29 21:23:21

quiqueck
Member
Registered: 2013-04-15
Posts: 83

Re: MariaDB upgrade and akonadi

epsilom wrote:

the solution for me was deleting ~/.local/share/akonadi/mysql.conf

That solved the issue for me to. But comparing the old file with the new created one does not find any changes yikes

Caldazar wrote:

At least for KMail I've recognised no data loss.

Malfunction of Akonadi should not loose Data in anyway.

Offline

Board footer

Powered by FluxBB