Bug 421922

Summary: kde-apps/akonadi-{19.08.3,19.12.2} with dev-db/mysql-8.0.19{-r1} - error: 'Can't connect to local MySQL server through socket '/run/user/1000/akonadi/mysql.socket' (2)'
Product: [Frameworks and Libraries] Akonadi Reporter: Stephan Karacson <stkabugs>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: major CC: asturm, jr, Manfred.Knick, rdieter, sam, vmatare+kdebug
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 20.12.3
Sentry Crash Report:
Attachments: mysql-global.conf.patch
patch that removes problematic settings instead of changing them

Description Stephan Karacson 2020-05-22 16:23:27 UTC
As suggested on Gentoo I report this bug here as it hit us and is noticed as an serious problem.
Gentoo bug: https://bugs.gentoo.org/709812

Hit me first on akonadi-19.08.3 (whole kdepim doesnt work since update)

I tried to rebuild database (delete ~/.local/share/akonadi/ ~/.config/akonadi/ ~/.config/akonadi*) 

Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
org.kde.pim.akonadiserver: Starting up the Akonadi Server...
org.kde.pim.akonadiserver: database server stopped unexpectedly
org.kde.pim.akonadiserver: Database process exited unexpectedly during initial connection!
org.kde.pim.akonadiserver: executable: "/usr/sbin/mysqld"
org.kde.pim.akonadiserver: arguments: ("--defaults-file=/home/USER/.local/share/akonadi/mysql.conf", "--datadir=/home/USER/.local/share/akonadi/db_data/", "--socket=/run/user/1000/akonadi/mysql.socket", "--pid-file=/run/user/1000/akonadi/mysql.pid")
org.kde.pim.akonadiserver: stdout: ""
org.kde.pim.akonadiserver: stderr: ""
org.kde.pim.akonadiserver: exit code: 1
org.kde.pim.akonadiserver: process error: "Unknown error"
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/run/user/1000/akonadi/mysql.socket' (2)'
Check that mysqld is running and that the socket: '/run/user/1000/akonadi/mysql.socket' exists!
org.kde.pim.akonadiserver: Failed to remove runtime connection config file
org.kde.pim.akonadiserver: Shutting down AkonadiServer...
org.kde.pim.akonadicontrol: Application '/usr/bin/akonadiserver' exited normally...

reemerge akonadi* and qtsql with new mysql doesn't work

downgrade to mysql 5.7 works with resetting (delete folders and setting up whole kdepim) again.


STEPS TO REPRODUCE
1. Upgrade to mysql 8
2. start any kdepim-program
3. See that no KDE-applikation can access akonadi

Thomas Deutschmann said I should "make sure that this server configuration is compatible with MySQL v8".
As I use the auto-configuration of akonady with an user-mysql-instance I coul'd only tweak it after wrong auto-config by akonadi, somehow...
He and Manfred Knick also suggested that the lower_case_table_names must be initialized or converted correctly.

As you see, I am no expert in mysql. But it seems akonadi fails on confing mysql  version 8 and breaks my whole, single productive kdepim-installation.
(and sorry, I had a hell of work in the last two month so this report is a little late.)
Comment 1 Christophe Marin 2020-05-22 20:32:58 UTC
It's unlikely lower_case_table_names. Mysql 8 throws errors if this parameter's value is changed after a database is initialized.

As you wiped your DB before trying, the issue is probably elsewhere.

Is there anything printed in the dmesg output when you try to start akonadi?
Comment 2 Stephan Karacson 2020-05-22 21:19:03 UTC
It wasn't me who tried lower_case_table_names=0, seems Manfred Knick did it, with success.

My approach was a clean akonadi-setup, tested with mysql 5.7 and 8.
Currently I have a lack of machine for testing. I might have set up one in some days.
Comment 3 Jonathan Riddell 2020-08-04 09:43:09 UTC
Rebuilding Akonadi for KDE neon against mysql 8 breaks new and pre-existing akonadi setups.  I've switched to mariadb for our akonadi build but if it touches a mysql build of akonadi then it seems forever broken.  akonadi should get a cmake check to only build with mariadb and not mysql.
Comment 4 Stephan Karacson 2020-08-10 18:27:50 UTC
Sorry for the big delay, but during these days my work became priority and took all time. 

Just tested it on my old PC, (never used akonadi on that I believe, no akonadi recources on that pc)
Upgrated to mysql 8.0.20 and akonadi 20.04.3. same result. Akonadi won't start.

Is mysql the only backend with auto-configuration? If mariadb is managed by akonadi by private instance gentoo could/should add it as default option.

The problem is that gentoo dropped the mysql-connector-c package older than 8. As I can't run a full sql-server for a single kdepim on an laptop the pressure rises...
Comment 5 Hannes Schweizer 2020-08-10 19:39:53 UTC
Created attachment 130766 [details]
mysql-global.conf.patch

I've been facing a similar problem in my gentoo setup.
dev-db/mysql-8.0.20-r1
kde-apps/akonadi-20.04.3

Akondi starts fine after changing 4 settings in /etc/xdg/akonadi/mysql-global.conf (among other things lower_case_table_names=0).

See the attached patch. Especially the name change from log_warnings to log_error_verbosity should be fixed in akonadi, right?
Comment 6 Stephan Karacson 2020-08-15 13:57:05 UTC
Tested your patch on my old test-pc and now on my productive one, thank you a lot. 

Although it still needs new akonadi-recources (lost configs of mail and all extra organizer files, some like default ics and outgoing mails are kep).

I can confirm that the patch works on 2 machines with gentoo & kde-apps/akonadi-20.04.3, dev-db/mysql-8.0.20-r1.

It's a good workaround and I hope it survives the updates.
But what about the people who don't know /etc?
Comment 7 Christophe Marin 2020-09-02 15:37:13 UTC
(In reply to Hannes Schweizer from comment #5)
> 
> See the attached patch. Especially the name change from log_warnings to
> log_error_verbosity should be fixed in akonadi, right?

According to https://mariadb.com/kb/en/system-variable-differences-between-mariadb-103-and-mysql-57/ I suspect this would be an issue for mariadb users
Comment 8 Andreas Sturmlechner 2020-10-12 18:04:30 UTC
(In reply to Christophe Giboudeaux from comment #7)
> According to
> https://mariadb.com/kb/en/system-variable-differences-between-mariadb-103-
> and-mysql-57/ I suspect this would be an issue for mariadb users
If this is the case, should mariadb finally be split out into QMASQL or similar?
Comment 9 Manfred Knick 2020-11-27 11:26:20 UTC
After recent *stable* updates, problem still persists:

     kde-apps/akonadi-{19.08.3,19.12.2,20.08.3} 
with 
     dev-db/mysql-{8.0.19{-r1},8.0.21-r1}

[ https://bugs.gentoo.org/709812#c30 ]
Comment 10 Manfred Knick 2020-12-15 13:44:19 UTC
Does Akonadi 20.12.0 contain any progress on this issue?
Comment 11 Samuel Penn 2020-12-20 14:31:09 UTC
I'm seeing the same problem on Ubuntu 20.04. Installed Ubuntu on a new PC, got KMail working just fine without any problems. Then I installed MySQL server and the following morning noticed that KMail was refusing to start because of these problems with Akonadi.
Comment 12 Victor Mataré 2021-01-16 00:21:14 UTC
Created attachment 134915 [details]
patch that removes problematic settings instead of changing them

Please take a look at this patch. I think it's a better idea to simply remove the incompatible config entries. It's working fine for me with mysql and I'm pretty certain it also won't break mariadb.
Comment 13 Bug Janitor Service 2021-02-16 21:41:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/pim/akonadi/-/merge_requests/49
Comment 14 Stephan Karacson 2021-02-25 21:36:10 UTC
New Gentoo build kde-apps/akonadi-20.12.2-r1 hit stable. Works for me (with the akonadi-reset first and the default mysql-conf by supplied kdepim).
Thank you all for resolve  and valuable work.