Monday, June 24, 2013

Fixing akonadi startup in KDE

IMPORTANT UPDATE

The actual problem most certainly was due to Apparmor misconfiguration. On my Ubuntu 14.04 this hack is no longer needed and in fact will break your Akonadi with
[16134.738227] audit: type=1400 audit(1421321299.961:42): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/moo/.local/share/akonadi/mysql.conf" pid=12758 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000

If your Akonadi does not start the problem is most probably elsewhere.

Original post

I finally wanted to try KDE mail/calendar suit today. On my system Kmail has failed start up - Akonadi service failed with "Akonadi control process not registered at D-Bus" error. Apparently this error is misleading - the problem has nothing to do with D-Bus. Running akonadictl start reveals more details:

$ akonadictl start
....
Database process exited unexpectedly during initial connection!                                                                                                                                                                              
executable: "/usr/sbin/mysqld-akonadi"                                                                                                                                                                                                       
arguments: ("--defaults-file=/home/moo/.local/share/akonadi/mysql.conf", 
            "--datadir=/home/moo/.local/share/akonadi/db_data/",
            "--socket=/home/moo/.local/share/akonadi/socket-bar/mysql.socket")
stdout: ""
stderr: "Could not open required defaults file: /home/moo/.local/share/akonadi/mysql.conf
Fatal error in defaults handling. Program aborted
"
exit code: 1
process error: "Unknown error"
So what is actually failing is MySQL startup. Here comes the mystery: running /usr/sbin/mysqld-akonadi ... with all of the above arguments actually fails:
$ /usr/sbin/mysqld-akonadi --defaults-file=/home/moo...
Could not open required defaults file: /khome/zaar.hai/.local/share/akonadi/mysql.conf
Fatal error in defaults handling. Program aborted
However if you just copy /usr/sbin/mysqld-akonadi to, say, /tmp it will start flawlessly.

I was not able to understand this weirdness, but the cure was simple: fortunately this akonadi script is just a dumb wrapper that execs mysql. So I've edited /home/moo/.config/akonadi/akonadiserverrc to launch mysql directly and akonadi started successfully.

No comments:

Post a Comment