How to get the Akonadi PIM service to run with MariaDB again?

I could run a known mail program for a while to some degree.
My application test triggered a corresponding software improvement.

Now I would like to try such software out once more.

elfring@Sonne:~> kmail 
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString) 
org.kde.pim.akonadiserver: Starting up the Akonadi Server... 
…
org.kde.pim.akonadiserver: Running DB initializer 
org.kde.pim.akonadiserver: DB initializer done 
org.kde.pim.akonadiserver: DATABASE ERROR: 
org.kde.pim.akonadiserver:   Error code: "2013" 
org.kde.pim.akonadiserver:   DB error:  "Lost connection to MySQL server during query" 
org.kde.pim.akonadiserver:   Error text: "Lost connection to MySQL server during query QMYSQL3: Unable to execute statement" 
org.kde.pim.akonadiserver:   Values: QMap((":0", QVariant(qlonglong, 1))(":1", QVariant(qlonglong, 2))) 
…

I wonder about the reported database connection failure in similar ways to other users.

Examples:

Involved components:

  • akonadi-server 20.12.1-1.1
  • kmail 20.12.1-1.1
  • mariadb 10.5.8-3.2

I would appreciate your advices.

The thrown error (2013) is not something an end User is expected to resolve.
Pls submit a bug to https://bugzilla.opensuse.org.
It’ll get pushed upstream to the maintainers of your mail client to write the database query correctly.

TSU

Thanks for such information.

It’ll get pushed upstream to the maintainers of your mail client to write the database query correctly.

I got the impression that the PIM service tries a special query.

…
org.kde.pim.akonadiserver:   Error text: "Lost connection to MySQL server during query QMYSQL3: Unable to execute statement"
org.kde.pim.akonadiserver:   Values: QMap((":0", QVariant(qlonglong, 1))(":1", QVariant(qlonglong, 2)))
org.kde.pim.akonadiserver:   Query: "SELECT count(DISTINCT PimItemTable.id), sum(PimItemTable.size), sum(CASE WHEN ( SeenFlags.Flag_id IS NOT NULL OR IgnoredFlags.Flag_id IS NOT NULL ) THEN 1 ELSE 0 END), PimItemTable.collectionId FROM PimItemTable LEFT JOIN PimItemFlagRelation AS SeenFlags ON ( PimItemTable.id = SeenFlags.PimItem_id AND SeenFlags.Flag_id = :0 ) LEFT JOIN PimItemFlagRelation AS IgnoredFlags ON ( PimItemTable.id = IgnoredFlags.PimItem_id AND IgnoredFlags.Flag_id = :1 ) GROUP BY PimItemTable.collectionId
…

Do I need to check if such an SQL statement would be executable by other programming tools?

Are other log messages also suspicious?

…
org.kde.pim.akonadicontrol: Akonadi server is now operational.
org.kde.pim.akonadicontrol: Application '/usr/bin/akonadiserver' exited normally...
org.kde.pim.akonadicontrol: ProcessControl: Application "/usr/bin/akonadi_maildir_resource" stopped unexpectedly ( "Process crashed" )
org.kde.pim.akonadicontrol: Application '/usr/bin/akonadi_maildir_resource' crashed. No restart!
…

I stumbled on another solution approach for the mentioned software failure.
It seems that it helped to move the directory “~/.local/share/akonadi” here.

Use with care – very carefully …

  • Do this if and only if, you have regularly archived all your e-Mails and everything else which is managed by Kontact …
  • Once the Akonadi database has been re-created, compare all your local e-Mails with the contents of the archives …
  • Ditto the Address Book and the Calendar …

:\ The database regeneration was probably needed in my case also because the previous log file “~/.local/share/akonadi/db_data/mysql.err” provided questionable information according to software failures.

What, exactly, is the solution to this problem? It is happening to me.

org.kde.pim.akonadiserver: DATABASE ERROR:
org.kde.pim.akonadiserver:   Error code: "2013"
org.kde.pim.akonadiserver:   DB error:  "Lost connection to server during query"
org.kde.pim.akonadiserver:   Error text: "Lost connection to server during query
 QMYSQL3: Unable to execute statement"
org.kde.pim.akonadiserver: database server stopped unexpectedly
org.kde.pim.akonadiserver:   Values: QMap((":0", QVariant(int, 0))(":1", QVarian
t(QString, "60630"))(":2", QVariant(QString, ""))(":3", QVariant(QString, ""))("
:4", QVariant(qlonglong, 162))(":5", QVariant(qlonglong, 4))(":6", QVariant(QDat
eTime, QDateTime(2022-05-21 00:21:09.431 UTC Qt::UTC)))(":7", QVariant(QDateTime
, QDateTime(2022-05-21 00:21:09.428 UTC Qt::UTC)))(":8", QVariant(bool, false))(
":9", QVariant(qlonglong, 5557)))
org.kde.pim.akonadiserver:   Query: "INSERT INTO PimItemTable (rev, remoteId, re
moteRevision, gid, collectionId, mimeTypeId, datetime, atime, dirty, size) VALUE
S (:0, :1, :2, :3, :4, :5, :6, :7, :8, :9)"
org.kde.pim.akonadiserver: Error during insertion into table "PimItemTable" "Los
t connection to server during query QMYSQL3: Unable to execute statement"
org.kde.pim.akonadiserver: DATABASE ERROR:
org.kde.pim.akonadiserver: Error while handling command CreateItem on connection
 akonadi_imap_resource_1 (0x5632dd3eb500)
org.kde.pim.akonadicore: ""
org.kde.pim.akonadicore: Creating/updating items from the akonadi database faile
d: "Failed to append item"
org.kde.pim.akonadicore: Creating/updating items from the akonadi database faile
d: "Failed to append item"
org.kde.pim.akonadicore: Error during ItemSync:  "Failed to append item"
org.kde.pim.akonadicore: "QLocalSocket: Remote closed" "/run/user/1000/akonadi/a
konadiserver-cmd.socket"
org.kde.pim.akonadicore: Socket error occurred: "QLocalSocket: Remote closed"
org.kde.pim.akonadiagentbase: Failed to fetch collection for collection sync:  "
Unknown resource"
org.kde.pim.imapresource: Failed to modify collection:  "Failed to execute SQL q
uery"
org.kde.pim.akonadicore: Error during ItemSync:  "Failed to append item"
org.kde.pim.akonadiagentbase: Failed to retrieve collection for attribute sync: 
 "Collection does not exist"
akonadictl start
org.kde.pim.akonadictl: Starting Akonadi Server...
org.kde.pim.akonadicontrol: Service org.freedesktop.Akonadi.Control.lock already
 registered, terminating now.
Error: akonadi_control was started but didn't register at D-Bus session bus.
Make sure your system is set up correctly!

Where is this lock file?