This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Akonadi won't start: Could not open required defaults file

Tags: akonadi, failure akonadi, failure akonadi, failure
(comma "," separated)
bovender
Registered Member
Posts
40
Karma
0
OS
After yesterday's upgrade to KDE Applications 19.08 on KDE neon User Edition 5.16, Akonadi won't start any more. It was operational until then.

Code: Select all
$ akonadictl start
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-akonadi"
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: "mysqld-akonadi: [ERROR] Could not open required defaults file: /home/USER/.local/share/akonadi/mysql.conf\nmysqld-akonadi: [ERROR] Fatal error in defaults handling. Program aborted!\n"
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...


I verified that ~/.local/share/akonadi/mysql.conf still exists and that I have permissions for that file. I also tried to move it out of the way (expecting Akonadi to regenerate it from scratch), but that did not help either. The system was fully shut down after the update, then booted today.

Regarding the message concerning mysqld, I do happen to have a running mysql server on my machine, but I guess this is about Akonadi's built-in local mysql server.

I heavily rely on KMail and KOrganizer for my work -- any hints to solve this problem would be highly appreciated.


Code: Select all
$ akonadictl -v
akonadictl 5.12.0
$ sudo pkcon refresh && sudo pkcon update
Refreshing cache              [=========================]
Loading cache                 [=========================]
Refreshing software list      [=========================]
Downloading packages          [=========================]
Running                       [=========================]
Finished                      [=========================]
# [sources list snipped]
Getting updates               [=========================]
Finished                      [=========================]
No packages require updating to newer versions.

Last edited by bovender on Tue Aug 20, 2019 12:22 pm, edited 1 time in total.
dfoskett
Registered Member
Posts
34
Karma
0
OS
I'm having the same problem, also on KDE Neon. Akonadi/Kmail has almost always broken on updates for me, both on systems with old hardware and new, but usually following the "clean start after a failed migration" directions fixes things. This time it didn't work.

When starting Akonadi after deleting everything called for in the failed migration directions, I did notice that while Akonadi re-created the akonadi folder in local/share and in config, it didn't re-create any of the usual files in config outside of the config/akonadi folder.

also, I took a peek in /run/user/1000/akonadi/ and it was empty (and stayed empty when starting akonadi in order to try to re-create everything).

<sigh>
User avatar
raphaelra
Registered Member
Posts
209
Karma
0
OS
bovender
Registered Member
Posts
40
Karma
0
OS
raphaelra wrote:Maybe it is again the problem with apparmor ???


I don't think so. Added the line

Code: Select all
/{,var/}run/user/[0-9]*/akonadi/** rwk,


both under

Code: Select all
/usr/sbin/mysqld-akonadi { ... }


and under

Code: Select all
profile /usr/sbin/mysqld { ... }


in /etc/apparmor.d/usr.sbin.mysqld-akonadi, and issued

Code: Select all
sudo systemctl reload apparmor
akonadictl start


both times and got the same error messages.

I also uninstalled akonadi-server, moved ~/.local/share/akonadi out of the way, then re-installed the PIM applications and still could not start KMail, KOrganizer & Co.
dfoskett
Registered Member
Posts
34
Karma
0
OS
raphaelra wrote:Maybe it is again the problem with apparmor ???


Thanks for the suggestion, but I couldn't get this to work for me. First of all, I looked in /etc/apparmor.d/usr.sbin.mysqld-akonadi and per the thread you referenced, it did include the bugfix for the lockfile:

Code: Select all
owner /run/user/*/akonadi/default/* wr,


I noticed in my akonadi output (same as bovender's, above) that the argument being supplied to org.kde.pim.akonadiserver had a slightly different path

Code: Select all
"--socket=/run/user/1000/akonadi/mysql.socket"


and not

Code: Select all
"--socket=/run/user/1000/akonadi/default/mysql.socket"


and adding a line

owner /run/user/*/akonadi/* wr,


to /etc/apparmor.d/usr.sbin.mysqld-akonadi just in case it made a difference didn't do anything, either.

I guess it's probably time to file a bug report.
bovender
Registered Member
Posts
40
Karma
0
OS
User avatar
raphaelra
Registered Member
Posts
209
Karma
0
OS
bovender wrote:
$ akonadictl start
...
org.kde.pim.akonadiserver: executable: "/usr/sbin/mysqld-akonadi"
org.kde.pim.akonadiserver: arguments: ("--defaults-file=/home/USER/.local/share/akonadi/mysql.conf", "--datadir=/home/daniel/.local/share/akonadi/db_data/", "--socket=/run/user/1000/akonadi/mysql.socket", "--pid-file=/run/user/1000/akonadi/mysql.pid")
org.kde.pim.akonadiserver: stderr: "mysqld-akonadi: [ERROR] Could not open required defaults file: /home/USER/.local/share/akonadi/mysql.conf
...



Did you edit the log to anonyminize you user name or is this the original log output ? If original, than the launcher is using probably the environment variable $USER wrong ??? The error message points to defaults (mysql.conf) file.

Last edited by raphaelra on Tue Aug 20, 2019 9:14 am, edited 1 time in total.
bovender
Registered Member
Posts
40
Karma
0
OS
raphaelra wrote:
bovender wrote:
$ akonadictl start
...
org.kde.pim.akonadiserver: executable: "/usr/sbin/mysqld-akonadi"
org.kde.pim.akonadiserver: arguments: ("--defaults-file=/home/USER/.local/share/akonadi/mysql.conf", "--datadir=/home/daniel/.local/share/akonadi/db_data/", "--socket=/run/user/1000/akonadi/mysql.socket", "--pid-file=/run/user/1000/akonadi/mysql.pid")
org.kde.pim.akonadiserver: stderr: "mysqld-akonadi: [ERROR] Could not open required defaults file: /home/USER/.local/share/akonadi/mysql.conf
...



Did you edit the log to anonyminize you user name or is this the original log output ? If original, than the launcher is using probably the environment variable $USER wrong ??? The error message points to defaults (mysql.conf) file.


It's redacted. I replaced my true user name with USER here. Will add this to the bug report in order to avoid confusion. Thanks.
dfoskett
Registered Member
Posts
34
Karma
0
OS
bovender wrote:https://bugs.kde.org/show_bug.cgi?id=411093


Beat me to it!

Awesome, thanks.
User avatar
raphaelra
Registered Member
Posts
209
Karma
0
OS
I dared to update my neon today ...
Code: Select all
Betriebssystem: KDE neon 5.16
KDE-Plasma-Version: 5.16.4
KDE-Frameworks-Version: 5.61.0
Qt-Version: 5.12.3
Kernel-Version: 4.15.0-58-generic
...

Akonadi started without errors after reboot :)

@bovender:
Regarding to your comment to reported bug ... Here my apparmor profile for akonadi-mysql:

Code: Select all
#include <tunables/global>

/usr/sbin/mysqld-akonadi {
  #include <abstractions/base>

  /usr/sbin/mysqld-akonadi r,
  /dev/tty rw,
  /usr/sbin/mysqld cx,

  profile /usr/sbin/mysqld {
    #include <abstractions/base>
    #include <abstractions/nameservice>
    #include <abstractions/user-tmp>

    capability setgid,
    capability setuid,

    /etc/mysql/conf.d/ r,
    /etc/mysql/conf.d/* r,
    /etc/mysql/my.cnf r,
    /etc/mysql/mariadb.cnf r,
    /etc/mysql/mariadb.conf.d/ r,
    /etc/mysql/mariadb.conf.d/* r,

    /sys/devices/system/cpu/ r,

    /usr/sbin/mysqld mr,
    /usr/share/mysql/** r,

    @{HOME}/.local/share/akonadi/** rwk,
    owner /home/*/ r,
    owner /run/user/*/akonadi/default/* wr,

    # Site-specific additions and overrides. See local/README for details.
    #include <local/usr.sbin.mysqld-akonadi>
  }
}
dfoskett
Registered Member
Posts
34
Karma
0
OS
raphaelra wrote:I dared to update my neon today ...


weird. your apparmor profile for akonadi-mysql is identical to mine. system is the same except my kernel is 5.0.0-25 generic. could that be a factor?
bovender
Registered Member
Posts
40
Karma
0
OS
raphaelra wrote:I dared to update my neon today ...
@bovender:
Regarding to your comment to reported bug ... Here my apparmor profile for akonadi-mysql:
[/code]


Thanks. It's almost identical to mine:

Code: Select all
$ diff -u usr.sbin.mysqld-akonadi.bak usr.sbin.mysqld-akonadi
--- usr.sbin.mysqld-akonadi.bak 2019-08-19 11:46:11.770475711 +0200
+++ usr.sbin.mysqld-akonadi     2019-08-21 05:55:40.148208689 +0200
@@ -1,4 +1,3 @@
-# vim:syntax=apparmor

 #include <tunables/global>

@@ -8,7 +7,6 @@
   /usr/sbin/mysqld-akonadi r,
   /dev/tty rw,
   /usr/sbin/mysqld cx,
-  /{,var/}run/user/[0-9]*/akonadi/** rwk,

   profile /usr/sbin/mysqld {
     #include <abstractions/base>
@@ -34,7 +32,6 @@
     owner /home/*/ r,
     owner /run/user/*/akonadi/default/* wr,

-
     # Site-specific additions and overrides. See local/README for details.
     #include <local/usr.sbin.mysqld-akonadi>
   }


I pasted it into my file nonetheless and systemctl-reloaded apparmor, to no avail. Could it be that another apparmor profile is interfering? Seems that I have to learn more about apparmor after all...
User avatar
raphaelra
Registered Member
Posts
209
Karma
0
OS
From bovender's syslog:
Code: Select all
audit(1566329666.867:197): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld"
name="/sys/devices/system/node/" pid=22974 comm="mysqld-akonadi" requested_mask="r" denied_mask="r"
fsuid=1000 ouid=0
You see here the profile name "/usr/sbin/mysqld", so i think it's right file. Mysql try to open "/sys/devices/system/node/", which is not in your AppArmor config file. I would try to change the line
Code: Select all
/sys/devices/system/cpu/ r,
into
Code: Select all
/sys/devices/system/** r,
Let mysql read for first all under /sys/devices/system/. Later you can "strace" mysql starting with same params as in akonadi log file and investigate which file(s) under /sys/devices/system/... it try to open/read. You can alternatively try aa-logprof.
bovender
Registered Member
Posts
40
Karma
0
OS
I think I finally solved it! Kind of by accident, and I still don't know what the cause was.

Code: Select all
$ sudo service apparmor teardown
$ sudo service apparmor start


(NB: systemctl cannot handle the `teardown` task)

Now akonadi works again! :-)
dfoskett
Registered Member
Posts
34
Karma
0
OS
bovender wrote:Now akonadi works again! :-)


Does it work after rebooting? Or do you have to tear down and restart apparmor every time?


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]