Kmail - fatal error!

Argh… After a computer crash last month that broke akonadi, a computer crash today broke it again. But now I’ve got this error.

The weird thing is, when running akonadi-fsck, akonadi runs, mail gets collected, gets filtered and when I start kmail, as long as I don’t press OK on the dialog that says there’s a fatal error, kmail downloads mail according to the progress bar and shows new mail in the right folders!

(btw, is it normal that akonadi-fsck simply doesn’t stop, but keeps running?)

Konsole shows this after starting kmail:

org.kde.pim.akonadiserver: DATABASE ERROR:
org.kde.pim.akonadiserver:   Error code: "2067"
org.kde.pim.akonadiserver:   DB error:  "UNIQUE constraint failed: CollectionTable.parentId, CollectionTable.name"
org.kde.pim.akonadiserver:   Error text: "UNIQUE constraint failed: CollectionTable.parentId, CollectionTable.name Unable to fetch row"
org.kde.pim.akonadiserver:   Values: QList(QVariant(QString, ""), QVariant(QString, ""), QVariant(QString, "outbox"), QVariant(qlonglong, 2), QVariant(qlonglong, 3), QVariant(bool, true), QVariant(int, 2), QVariant(int, 2), QVariant(int, 2), QVariant(bool, true), QVariant(int, -1), QVariant(int, -1), QVariant(bool, false), QVariant(QString, ""), QVariant(bool, false))
org.kde.pim.akonadiserver:   Query: "INSERT INTO CollectionTable (remoteId, remoteRevision, name, parentId, resourceId, enabled, syncPref, displayPref, indexPref, cachePolicyInherit, cachePolicyCheckInterval, cachePolicyCacheTimeout, cachePolicySyncOnDemand, cachePolicyLocalParts, isVirtual) VALUES (:0, :1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14)"
org.kde.pim.akonadiserver: Error during insertion into table "CollectionTable" "UNIQUE constraint failed: CollectionTable.parentId, CollectionTable.name Unable to fetch row"
org.kde.pim.akonadiserver: Failed to append Collection "outbox" in resource "akonadi_maildir_resource_0"
org.kde.pim.akonadiserver: Error while handling command CreateCollection on connection kmail2-2256637077 (0x606e4c38bfd0)
org.kde.pim.akonadiserver: New notification connection (registered as Akonadi::Server::NotificationSubscriber(0x73c3c4277b40) )
org.kde.pim.akonadiserver: Subscriber Akonadi::Server::NotificationSubscriber(0x73c3c4277b40) identified as "MessageListTagCacheMonitor - 94426689233696"

@rempt:

Nope – “akonadictl fsck” should stop after –

 > akonadictl fsck
Looking for resources in the DB not matching a configured resource...
Looking for collections not belonging to a valid resource...
Checking collection tree consistency...
Looking for items not belonging to a valid collection...
Looking for item parts not belonging to a valid item...
Looking for item flags not belonging to a valid item...
Looking for overlapping external parts...
Verifying external parts...
 . 
 . 
Checking Collection 1610 search index...
Checking Collection 1611 search index...
Checking Collection 1615 search index...
Checking Collection 1643 search index...
Flushing collection statistics memory cache...
Making sure virtual search resource and collections exist
Consistency check done.
 > 

Please check the contents of ‘~/.local/share/akonadi/’ – should be some something like [here with KDE Plasma 5] –

 > l .local/share/akonadi/
insgesamt 20
drwxr-xr-x   7 xxx users  189 16. Jun 11:33 ./
drwx------  83 xxx users 4096 16. Jun 11:30 ../
-rw-r--r--   1 xxx users    0 16. Jun 11:33 Akonadi.error
-rw-r--r--   1 xxx users    0 16. Jun 11:33 Akonadi.error.old
drwxr-xr-x   7 xxx users 4096 16. Jun 09:30 db_data/
drwxr-xr-x   2 xxx users    6 10. Jan 2024  db_misc/
drwxr-xr-x 102 xxx users 4096 10. Jan 2024  file_db_data/
drwxr-xr-x   2 xxx users    6 22. Apr 18:01 file_lost+found/
-rw-r--r--   1 xxx users 3227 16. Jun 2024  mysql.conf
drwxr-xr-x   8 xxx users  105 31. Aug 2024  search_db/
lrwxrwxrwx   1 xxx users   22 16. Jun 09:30 socket-yyy-default -> /run/user/????/akonadi/
 >

You could also take a look at the database with “akonadiconsole” – for me, it’s included in the RPM package “akonadiconsole” …

I have:

akonadi.db      akonadi.db-wal  Akonadi.error.old  search_db
akonadi.db-shm  Akonadi.error   file_db_data       socket-thinkstation-default
halla@thinkstation:~/.local/share/akonadi$

Maybe I should just do what I did the last time… Remove all akonadi files and config, restore my imap accounts and the reset all my filters once again to the right folders…

yes, try removing the db files:

find ~/.local/share/akonadi/file_db_data/ -type f | xargs rm -f

Same problem…

halla@thinkstation:~$ find ~/.local/share/akonadi/file_db_data/ -type f | xargs rm -f
halla@thinkstation:~$ kmail
kf.windowsystem: KWindowInfo is only functional when running on X11
org.kde.pim.akonadicore: Failed SpecialCollectionsRequestJob::slotResult "Could not create collection trash, resourceId 3"
org.kde.pim.mailcommon: "The Email program encountered a fatal error and will terminate now.\nThe error was:\nCould not create collection trash, resourceId 3"
org.kde.pim.akonadicore: Failed to open external payload: "/home/alla/.local/share/akonadi/file_db_data/63/448763_r0" "No such file or directory"
org.kde.pim.akonadicore: Failed to open external payload: "/home/halla/.local/share/akonadi/file_db_data/64/448764_r0" "No such file or directory"
org.kde.pim.akonadicore: Failed to open external payload: "/home/halla/.local/share/akonadi/file_db_data/63/448763_r0" "No such file or directory"
org.kde.pim.akonadicore: Failed to open external payload: "/home/halla/.local/share/akonadi/file_db_data/64/448764_r0" "No such file or directory"
org.kde.kitinerary: filePath : "/usr/lib/x86_64-linux-gnu/libexec/kf6/kitinerary-extractor" Cannot find external extractor: "kitinerary-extractor"

Almost the same problem but, not quite …


Simply removing the Akonadi database is possibly not a good idea –

  • It seems that, if there’s a valid KMail configuration then, KMail expects the Akonadi database to be present and, populated …
  • On the other hand, if there ain’t no KMail configuration and, there ain’t no Akonadi database and, Akonadi isn’t running then, KMail will create a new configuration and Akonadi database – possibly because, it started Akonadi which then created a new database …

The Akonadi UserBase has some information but, not very much – <Akonadi>

Same problem :

org.kde.pim.akonadiserver: Subscriber Akonadi::Server::NotificationSubscriber(0x7d0f2c224610) identified as "SpecialCollectionsMonitor - 96366936213200"
org.kde.pim.akonadiserver: DATABASE ERROR:
org.kde.pim.akonadiserver:   Error code: "1062"
org.kde.pim.akonadiserver:   DB error:  "Duplicate entry '5-outbox' for key 'CollectionTable_parentAndNameIndex'"
org.kde.pim.akonadiserver:   Error text: "Duplicate entry '5-outbox' for key 'CollectionTable_parentAndNameIndex' QMYSQL: Impossible d'exécuter la requête"
org.kde.pim.akonadiserver:   Values: QList(QVariant(QString, ""), QVariant(QString, ""), QVariant(QString, "outbox"), QVariant(qlonglong, 5), QVariant(qlonglong, 3), QVariant(bool, true), QVariant(int, 2), QVariant(int, 2), QVariant(int, 2), QVariant(bool, true), QVariant(int, -1), QVariant(int, -1), QVariant(bool, false), QVariant(QString, ""), QVariant(bool, false))
org.kde.pim.akonadiserver:   Query: "INSERT INTO CollectionTable (remoteId, remoteRevision, name, parentId, resourceId, enabled, syncPref, displayPref, indexPref, cachePolicyInherit, cachePolicyCheckInterval, cachePolicyCacheTimeout, cachePolicySyncOnDemand, cachePolicyLocalParts, isVirtual) VALUES (:0, :1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14)"
org.kde.pim.akonadiserver: Error during insertion into table "CollectionTable" "Duplicate entry '5-outbox' for key 'CollectionTable_parentAndNameIndex' QMYSQL: Impossible d'exécuter la requête"
org.kde.pim.akonadiserver: Failed to append Collection "outbox" in resource "akonadi_maildir_resource_0"
org.kde.pim.akonadicore: Failed SpecialCollectionsRequestJob::slotResult "Could not create collection outbox, resourceId 3"

As all my emails are on IMAPs servers, I’ve just :

akonadictl stop
rm -rf ~/.local/share/local-mail/
akonadictl start
kmail

DO NOT DO THAT IF YOU HAVE MAILS STORED IN YOUR LOCAL FOLDER !