Akonadi
Template:I18n/Language Navigation Bar
Introduction
This page is mainly concerned with troubleshooting Akonadi, as there are inevitable glitches in early stages of migration. For many people the first signs of Akonadi activity will be in KDE SC 4.4, and many will be confused by it. For a brief description of the purpose of Akonadi, see this Glossary entry. You will also find useful links to further reading. Once the inevitable teething troubles are over Akonadi will provide a power-house usable by many applications.
Troubleshooting Tips
- When reporting problems with the Akonadi server, always include the comprehensive self-test report. This report can be obtained from the self-test dialog which shows up whenever the Akonadi server was unable to start successfully. You also can access this dialog via systemsettings -> Advanced -> Akonadi -> Server Configuration -> Test.
- Starting the Akonadi server manually on the command line can result in additional useful information. This can be done by running akonadictl start on a console. Similar, with akonadictl stop the Akonadi server can be stopped again.
Common Problems
Nepomuk
Starting with KDE 4.4, it is required that Nepomuk is running in order for Akonadi to work correctly. Akonadi will check this and display an error dialog on startup if this is not the case.
Currently, only the Sesame2 backend for Nepomuk is usable, the Redland backend is pathetically slow and can not be used. Sesame2 is Java-based. You can check whether the Nepomuk is running with the correct backend by using the Akonadi self-test dialog, as described above.
If you have installed the Sesame2 backend, but it doesn't work, then you need to set up the correct environment variables. For me, adding /usr/lib64/jvm/java/jre/lib/amd64/server to LD_LIBRARY_PATH helped, but this varies depending on the distro and the architecture.
Apparmor
Some distributions using Apparmor have it set up in a way that prevents Akonadi from running its internal database server. This can result in a variety of fuzzy error messages, including but not limited to the following:
- unknown error 255 when running akonadictl
- "DB error: 'Could not open required defaults file: /home/$username/.local/share/akonadi/mysql.conf"
You can solve this by running aa-complain mysqld with root privileges then reload apparmor. On KUbuntu this is:
sudo aa-complain mysqld sudo /etc/init.d/apparmor reload
Note that you might be using Apparmor even if it does not show up in the process list.
Also note that some distributions ship an additional mysqld binary called mysqld-akonadi which has AppArmor set up correctly. If that's the case on your system and you see this problem nevertheless, there are two possible reasons:
- Akonadi still uses mysqld instead of mysqld-akonadi. You can change that in Systemsettings -> Advanced -> Akonadi -> Server configuration.
- AppArmor is not setup correctly for mysqld-akonadi either. Try running the aa-complain command noted above with mysqld-akonadi instead of mysqld.
---
You will also experience this problem if you are running an encrypted home directory using encryptfs combined with AppArmor as the Akonadi apparmor profile currently does not account for an ecrypted home (common with Ubuntu Jaunty users). Error messages with include:
- dmesg produces:
ecryptfs_do_create: Failure to create dentry in lower fs; rc = [-13] ecryptfs_create: Failed to create file inlower filesystem
- Akonadi will list the following errors:
Akonadi server process not registered at D-Bus
The fix is to edit the following file "/etc/apparmor.d/usr.sbin.mysqld-akonadi". Below the line:
@{HOME}/.local/share/akonadi/** rwk,
Add a new line:
@{HOME}/.Private/** rwk,
Restart apparmor and restart akonadi.
Missing Prerequisite
To use Akonadi you need to have the following packages installed (names might differ depending on your distribution):
- The MySQL server (called mysql on OpenSuse)
- The Qt4 MySQL plugin (called libqt4-sql-mysql on OpenSuse)
If you compile Qt4 yourself, make sure to tell the configure script to build in MySQL support by passing it the '-plugin-sql-mysql' option. If configure cannot locate the necessary MySQL client code (i.e, says "MySQL support cannot be enabled due to functionality tests") then ensure that the corresponding package is installed (typically called [lib]mysql[client]-dev[el]). Also, depending on the install location of the MySQL headers, additional parameters to configure might be needed (eg. -I /usr/include/mysql on OpenSuse).
Environment Setup
The Akonadi server searches for Akonadi agents and resources in the paths defined in the XDG_DATA_DIRS environment variable. If Akonadi complains about not finding agents or resources, check if this variable is set correctly. Also keep in mind that even if set in a current console session, it might not have been set when starting the server. Starting the server manually in the current console session excludes this cause.
Table 'mysql. servers' doesn't exist
If MySQL server log contains the following error:
[ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
[ERROR] Cannot open mysql.db
[ERROR] Cannot open mysql.user
[ERROR] Cannot open mysql.event
then, most probably, you don't have your MySQL configuration file in place. Copy it from /usr/share/config/akonadi/mysql-global.conf into ~/.config/akonadi/mysql-local.conf. (For debian users the file ist located in /etc/akonadi/mysql-global.conf). Then open it and uncomment the line sql_mode=strict_trans_tables. If, after that, you get the following errors:
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE
failed.
[ERROR] Unknown/unsupported table type: innodb
[ERROR] Aborting
then in the same file find the line that starts just like the one above (which you have uncommented), but has additional parameters, separated by commas (something like sql_mode=strict_trans_tables,strict_all_tables, ...etc). Comment the shorter sql_mode=... line and uncomment the longer one.
Restarting after a previous error
If you had problems starting Akonadi and fixed those (such as a missing package or the Apparmor problem) make sure that the Akonadi server is completely shut down before trying to start it again, by calling akonadictl stop on the command line. You can confirm that it was indeed shut down completely by running akonadictl status.
Under some circumstances the Akonadi server can be stuck in a partially running state after a failure which will prevent the next attempt to start it to fail as well. Please file a bug report if you run into this problem including the self-test report of the initial problem.
The so-called "Gentoo-Assert"
That's an especially nasty problem that so far only affects users of source-based distributions, most prominently Gentoo. It is named after MySQL assertions like the following example and is most likely caused by a MySQL protocol mismatch between the MySQL server and the client library or the Qt MySQL driver.
akonadiserver: libmysql.c:4301: setup_one_fetch_function: Assertion `param->buffer_length != 0' failed.
It is extremely hard to diagnose as the assertion mentioned above are only triggered sometimes. Instead you'll get a wide range of weird symptoms:
- ASAP protocol logs show successful creation of objects which are supposedly no longer available when the next commands accesses them again.
- SQL protocol logs show INSERT or UPDATE commands with values that mismatch the corresponding column types and nevertheless succeed.
- SQL protocol logs showing large apparently random record ids which are nevertheless considered valid.
References:
- http://forum.kde.org/viewtopic.php?f=20&t=61738
- http://bugs.gentoo.org/show_bug.cgi?id=267513
- https://bugs.kde.org/202623 (contains a possible solution)
- http://bbs.archlinux.org/viewtopic.php?id=78358
Possible solution: Rebuild the Qt MySQL driver after upgrading MySQL (which most likely caused this problem in the first place).