Bug 392948 - Akonadi fails to start on a fresh system (cannot create directory)
Summary: Akonadi fails to start on a fresh system (cannot create directory)
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: GIT (master)
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 393817 395453 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-04-09 21:12 UTC by OlafLostViking
Modified: 2018-07-05 14:56 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.8.3


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description OlafLostViking 2018-04-09 21:12:36 UTC
I just installed a fresh KDE Neon Developer Edition using the development branches because I wanted to check for another critical (for me) bug (#374546).

The assistant when starting Kontact the first time fails without giving usable error messages. The console reveals that the database directory is not created automatically and akonadi fails to start. Bad for new users ;-)

olaflostviking@neon-valhalla:~$ akonadictl start  
olaflostviking@neon-valhalla:~$ Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
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/olaflostviking/.local/share/akonadi/mysql.conf", "--datadir=/home/olaflostviking/.local/share/akonadi/db_data/", "--socket=/tmp/akonadi-olaflostviking.7ef5j8/mysql.socket", "--pid-file=/tmp/akonadi-olaflostviking.7ef5j8/mysql.pid")
org.kde.pim.akonadiserver: stdout: ""
org.kde.pim.akonadiserver: stderr: "180409 23:03:19 [Note] /usr/sbin/mysqld (mysqld 10.0.34-MariaDB-0ubuntu0.16.04.1) starting as process 1809 ...\n180409 23:03:19 [Warning] Can't create test file /home/olaflostviking/.local/share/akonadi/db_data/neon-valhalla.lower-test\n\x07/usr/sbin/mysqld: Can't change dir to '/home/olaflostviking/.local/share/akonadi/db_data/' (Errcode: 2 \"No such file or directory\")\n180409 23:03:19 [ERROR] Aborting\n\n180409 23:03:19 [Note] /usr/sbin/mysqld: Shutdown complete\n\n"
org.kde.pim.akonadiserver: exit code: 1
org.kde.pim.akonadiserver: process error: "Unknown error"
org.kde.pim.akonadiserver: Failed to remove runtime connection config file
org.kde.pim.akonadicontrol: Application 'akonadiserver' exited normally...

olaflostviking@neon-valhalla:~$ cd .local/share/akonadi/ 
olaflostviking@neon-valhalla:~/.local/share/akonadi$ ls -l
total 24
-rw-rw-r-- 1 olaflostviking olaflostviking  150 Apr  9 23:03 akonadi_control.error
-rw-rw-r-- 1 olaflostviking olaflostviking  150 Apr  9 23:03 akonadi_control.error.old
-rw-rw-r-- 1 olaflostviking olaflostviking    0 Apr  9 23:03 akonadictl.error
-rw-rw-r-- 1 olaflostviking olaflostviking    0 Apr  9 23:03 akonadictl.error.old
-rw-rw-r-- 1 olaflostviking olaflostviking  995 Apr  9 23:03 akonadiserver.error
-rw-rw-r-- 1 olaflostviking olaflostviking  995 Apr  9 23:03 akonadiserver.error.old
-rw-rw-r-- 1 olaflostviking olaflostviking 3423 Apr  9 22:58 mysql.conf
drwxrwxr-x 4 olaflostviking olaflostviking 4096 Apr  9 22:58 search_db
lrwxrwxrwx 1 olaflostviking olaflostviking   34 Apr  9 22:58 socket-neon-valhalla -> /tmp/akonadi-olaflostviking.7ef5j8
olaflostviking@neon-valhalla:~/.local/share/akonadi$ mkdir db_data
olaflostviking@neon-valhalla:~/.local/share/akonadi$ akonadictl start
olaflostviking@neon-valhalla:~/.local/share/akonadi$ Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
/usr/bin/mysqlcheck: Got error: 1049: Unknown database 'akonadi' when selecting the database
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
org.kde.pim.kidentitymanagement: IdentityManager: There was no default identity. Marking first one as default.
org.kde.pim.maildirresource: the resource is not properly configured: there is no config file for the resource. We create a new one.
org.kde.pim.kidentitymanagement: IdentityManager: There was no default identity. Marking first one as default.
org.kde.pim.kidentitymanagement: IdentityManager: There was no default identity. Marking first one as default.
"No file selected."
org.kde.pim.maildirresource: the resource is not properly configured: there is no config file for the resource. We create a new one.
QObject::killTimer: Timers cannot be stopped from another thread
Comment 1 tiegs 2018-04-30 08:50:21 UTC
I'm having the same Issue on a fresh install of KDE Neon. Akonadi server fails to start.
Looks like akonadi fails to create the db_data directory.

Once I created it akonadi starts up without any issues.
May this be an issue with the neon dist packages?




Console log:

$ akonadiserver --version
akonadiserver 5.8.0

$ akonadictl status
Akonadi Control: stopped
Akonadi Server: stopped

$ akonadictl start
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
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=/tmp/akonadi-user.ehVg1k/mysql.socket", "--pid-file=/tmp/akonadi-user.ehVg1k/mysql.pid")
org.kde.pim.akonadiserver: stdout: ""
org.kde.pim.akonadiserver: stderr: "180430 10:16:30 [Note] /usr/sbin/mysqld (mysqld 10.0.34-MariaDB-0ubuntu0.16.04.1) starting as process 4363 ...\n180430 10:16:30 [Warning] Can't create test file /home/user/.local/share/akonadi/db_data/ATLAS.lower-test\n\x07/usr/sbin/mysqld: Can't change dir to '/home/user/.local/share/akonadi/db_data/' (Errcode: 2 \"No such file or directory\")\n180430 10:16:30 [ERROR] Aborting\n\n180430 10:16:30 [Note] /usr/sbin/mysqld: Shutdown complete\n\n"
org.kde.pim.akonadiserver: exit code: 1
org.kde.pim.akonadiserver: process error: "Unknown error"
org.kde.pim.akonadiserver: Failed to remove runtime connection config file
org.kde.pim.akonadicontrol: Application 'akonadiserver' exited normally...


$ mkdir /home/user/.local/share/akonadi/db_data/

$ akonadictl start
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
user@ATLAS:~/.local/share/akonadi$ /usr/bin/mysqlcheck: Got error: 1049: Unknown database 'akonadi' when selecting the database
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
org.kde.pim.maildirresource: the resource is not properly configured: there is no config file for the resource. We create a new one.
QObject::killTimer: Timers cannot be stopped from another thread
QDBusConnection: name 'org.freedesktop.Akonadi.Control' had owner '' but we thought it was ':1.88'
"No file selected."
org.kde.pim.maildirresource: the resource is not properly configured: there is no config file for the resource. We create a new one.
QObject::killTimer: Timers cannot be stopped from another thread
org.kde.pim.akonadi_indexer_agent: Xapian error in indexer: Can't delete non-existent document #13

$ akonadictl status
Akonadi Control: running
Akonadi Server: running
Comment 2 BAKfr 2018-06-17 13:12:12 UTC
*** Bug 395453 has been marked as a duplicate of this bug. ***
Comment 3 BAKfr 2018-06-17 13:21:44 UTC
*** Bug 393817 has been marked as a duplicate of this bug. ***
Comment 4 BAKfr 2018-06-17 13:26:41 UTC
This bug is present in KDE Neon User edition, and according to bug #393817, in several others distributions.
Comment 5 BAKfr 2018-06-17 16:11:29 UTC

I dig into this issue and think I've found the root of the problem.

On first run, Akonadi is supposed to initialize the database.
To do so, it checks the presence of mysql_install_db, and executes it with different arguments depending of the software (mysql or mariadb) and the version.

Since MySQL 5.7, mysql_install_db is deprecated. There is a new '--initialize' argument available to replace it, (present in both mysql and mariadb).

KDE Neon (and probably others Ubuntu-based distributions) does not include this script in all mysqld package anymore.
mysql_install_db isn't present in the path, and so the database initialization is never executed.


From KDE Neon User Edition, the packages "mariadb-server-10.0", "mysql-server-core-5.7" include the script. The packages "mariadb-server-10.0" and "mysql-server-core-5.7" does not.
Comment 6 Daniel Vrátil 2018-07-05 14:56:42 UTC
Git commit a3d9f7647bf36a35deb996516ebd84f88976f013 by Daniel Vrátil.
Committed on 05/07/2018 at 14:56.
Pushed by dvratil into branch 'Applications/18.04'.

Fix MariaDB initialization when mysql_install_db is missing

Apparently some distributions don't ship mysql_install_db with
mariadb-server. Luckily for us, MariaDB can initialize itself on the
first start or mysqld, and it only needs us to make sure that the
datadir directory exists.
FIXED-IN: 5.8.3

M  +13   -1    src/server/storage/dbconfigmysql.cpp

https://commits.kde.org/akonadi/a3d9f7647bf36a35deb996516ebd84f88976f013