Bug 409736 - After upgrade to Applications 19.04.3: Akonadi can't connect to local MySQL server any more
Summary: After upgrade to Applications 19.04.3: Akonadi can't connect to local MySQL s...
Status: RESOLVED DOWNSTREAM
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: server (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-12 07:02 UTC by tsa
Modified: 2019-07-12 17:42 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tsa 2019-07-12 07:02:17 UTC
SUMMARY
After upgrade to KDE Applications 19.04.3 Kontact can not start the Akonadi Server any more.


STEPS TO REPRODUCE
1. Start Kontact, Kmail, Akonadi, ...
2. Observe the error message that Akonadi can't be started
 
OBSERVED RESULT

Starting via "akonadictl start" creates the following output:

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/till/.local/share/akonadi/mysql.conf", "--datadir=/home/till/.local/share/akonadi/db_data/", "--socket=/run/user/1000/akonadi/default/mysql.socket", "--pid-file=/run/user/1000/akonadi/default/mysql.pid")
org.kde.pim.akonadiserver: stdout: ""
org.kde.pim.akonadiserver: stderr: ""
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/default/mysql.socket' (2)'
Check that mysqld is running and that the socket: '/run/user/1000/akonadi/default/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...

Apparently the socket '/run/user/1000/akonadi/default/mysql.socket' doesn't exist.


EXPECTED RESULT

-- 

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: KDE Neon
(available in About System)
KDE Plasma Version: 5.16.3
KDE Frameworks Version: 5.59.0
Qt Version: 5.12.3

ADDITIONAL INFORMATION
Comment 1 Brent 2019-07-12 09:47:55 UTC
Same here, on two similarly configured machines all PIM applications were rendered unusable. Stopgap solution that worked for me: install akonadi-backend-sqlite and then remove akonadi-backend-mysql.
Comment 2 Brent 2019-07-12 11:12:37 UTC
Perhaps I should have added that I tried to fixes permissions for /var/lib/mysql (if you run /usr/bin/akonadiserver you'll get an error about that), to remove ~/.local/share/akonadi, but nothing helped or led to more info (to me).
Comment 3 fknghostile 2019-07-12 11:16:56 UTC
Same problem here. I've tried deleting akonadi's configs and folders.... and making a clean install of my packages...but still refusing to connect.
Comment 4 Stefan Galinski 2019-07-12 11:31:29 UTC
I solved the problem. It'a an AppArmor issue.

You need to edit your AppArmor configuration.

vim /etc/apparmor.d/usr.sbin.mysqld-akonadi

The content looks like this from the beginning. I only added a lot's of stuff at the top.

```
# vim:syntax=apparmor
  
#include <tunables/global>

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

  profile /usr/sbin/mysqld {
    /run/user/1000/akonadi/default/mysql.pid rwmk,
    /run/user/1000/akonadi/default/mysql.socket rwmk,
    /run/user/1000/akonadi/default/mysql.socket.lock rwmk,
    /sys/devices/system/node/* r,
    /sys/devices/system/node/ r,
    /etc/mysql/* r,
    /etc/mysql/mysql.conf.d/ r,
    /etc/mysql/mysql.conf.d/* r,
    /sys/devices/system/node/node0/meminfo r,
[more lines]
```

Afterwards reload the apparmor configuration for the file.

apparmor_parser -r /etc/apparmor.d/usr.sbin.mysqld-akonadi

You can restart Akonadi via the Akonadi console or a system restart now.

At least it worked for me and I'm fine again. :-)
Comment 5 Brent 2019-07-12 13:28:33 UTC
I think updates were just released that fix it.
Comment 6 Christophe Marin 2019-07-12 14:13:40 UTC
As stated in comment#4, this is an apparmor issue.
Comment 7 fknghostile 2019-07-12 14:44:58 UTC
(In reply to Stefan Galinski from comment #4)
> I solved the problem. It'a an AppArmor issue.
> 
> You need to edit your AppArmor configuration.
> 
> vim /etc/apparmor.d/usr.sbin.mysqld-akonadi
> 
> The content looks like this from the beginning. I only added a lot's of
> stuff at the top.
> 
> ```
> # vim:syntax=apparmor
>   
> #include <tunables/global>
> 
> /usr/sbin/mysqld-akonadi {
>   #include <abstractions/base>
>   /usr/sbin/mysqld-akonadi r,
>   /usr/sbin/mysqld cx,
> 
>   profile /usr/sbin/mysqld {
>     /run/user/1000/akonadi/default/mysql.pid rwmk,
>     /run/user/1000/akonadi/default/mysql.socket rwmk,
>     /run/user/1000/akonadi/default/mysql.socket.lock rwmk,
>     /sys/devices/system/node/* r,
>     /sys/devices/system/node/ r,
>     /etc/mysql/* r,
>     /etc/mysql/mysql.conf.d/ r,
>     /etc/mysql/mysql.conf.d/* r,
>     /sys/devices/system/node/node0/meminfo r,
> [more lines]
> ```
> 
> Afterwards reload the apparmor configuration for the file.
> 
> apparmor_parser -r /etc/apparmor.d/usr.sbin.mysqld-akonadi
> 
> You can restart Akonadi via the Akonadi console or a system restart now.
> 
> At least it worked for me and I'm fine again. :-)

I don't have any "usr.sbin.mysqld-akonadi" in my KDE Neon.
Comment 8 fknghostile 2019-07-12 17:42:36 UTC
Finally i've created (i think) usr.sbin.mysqld-akonadi file with:
sudo apparmor_parser -r /etc/apparmor.d/usr.sbin.mysqld-akonadi

and fix the trouble as is suggested. Thank you!