解决方案

解决方案

在寻找一套好的邮件/联系人/日历等应用程序时,我尝试了 KDE联系方式并在启动几乎所有捆绑应用程序(kmail、korganiser 等)时遇到以下问题。该应用程序将显示一个加载屏幕,如图 1 所示,然后它会在图 2 中显示错误,说明The Akonadi personal information management service is not operational.或类似的内容。

图片1: 加载中...

图片2: 错误

这是我提供的系统信息screenfetch

 OS: KDE neon 5.12
 Kernel: x86_64 Linux 4.13.0-45-generic
 Uptime: 4h 37m
 Packages: 2060
 Shell: bash 4.3.48
 Resolution: 1280x800
 DE: KDE 5.47.0 / Plasma 5.13.1
 WM: KWin
 GTK Theme: Breeze [GTK2/3]
 Icon Theme: breeze
 Font: Noto Sans Regular
 CPU: Intel Core2 Duo P8700 @ 2x 2.534GHz [36.0°C]
 GPU: intel
 RAM: 1802MiB / 2946MiB

我已经尝试卸载(并重新安装)Kontact 套件(无论是否有--purge参数apt由于某种原因,当我单击错误屏幕上提供的“详细信息”按钮时,它似乎没有执行任何操作。

我已经保存了自检报告文件到我的桌面,然后忘记了它在那里(我的编辑)。

答案1

解决方案

错误日志显示mysql这些 K* 应用程序所需的服务器的 akonadi 版本正在尝试访问~/.local/share/akonadi/db_data/ ,但db_data不存在,因此它会抛出一个错误,就像touch ~/nonexistent_dir/file.txt会发生的那样。

要解决此问题,只需运行以下命令即可。 cd ~/.local/share/akonadi/; mkdir db_data


说明

在互联网上进行了大量挖掘之后(有大量信息,但其中大部分是关于 Akonadi 类似但不相同问题的不完整/未解决的论坛主题)我能够找到来自 KDE 的 Akonadi 的总体总结是我自己调查的一个很好的开始。

在使用链接中提到的命令后,我得到了以下输出(我的编辑):

$ akonadictl start
$ Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
mysqld: [ERROR] Could not open required defaults file: /home/[my username]/.config/akonadi/
mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
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/[my username]/.local/share/akonadi/mysql.conf", "--datadir=/home/[my username]/.local/share/akonadi/db_data/", "--socket=/tmp/akonadi-[my username].UXCgLp/mysql.socket", "--pid-file=/tmp/akonadi-[my username].UXCgLp/mysql.pid")
org.kde.pim.akonadiserver: stdout: ""
org.kde.pim.akonadiserver: stderr: "mysqld: Can't change dir to '/home/[my username]/.local/share/akonadi/db_data/' (Errcode: 2 - No such file or directory)\n2018-06-21T19:34:18.989616Z 0 [Warning] The syntax '--log_warnings/-W' is deprecated and will be removed in a future release. Please use '--log_error_verbosity' instead.\n2018-06-21T19:34:18.989703Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).\n2018-06-21T19:34:18.991172Z 0 [Warning] Can't create test file /home/[my username]/.local/share/akonadi/db_data/[my hostname].lower-test\n2018-06-21T19:34:18.992274Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.22-0ubuntu0.16.04.1) starting as process 11859 ...\n2018-06-21T19:34:19.006500Z 0 [Warning] Can't create test file /home/[my username]/.local/share/akonadi/db_data/[my hostname].lower-test\n2018-06-21T19:34:19.006549Z 0 [Warning] Can't create test file /home/[my username]/.local/share/akonadi/db_data/[my hostname].lower-test\n2018-06-21T19:34:19.006623Z 0 [ERROR] failed to set datadir to /home/[my username]/.local/share/akonadi/db_data/\n2018-06-21T19:34:19.006632Z 0 [ERROR] Aborting\n\n2018-06-21T19:34:19.006658Z 0 [Note] Binlog end\n2018-06-21T19:34:19.006726Z 0 [Note] /usr/sbin/mysqld: Shutdown complete\n\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 '/tmp/akonadi-[my username].UXCgLp/mysql.socket' (2)'
Check that mysqld is running and that the socket: '/tmp/akonadi-[my username].UXCgLp/mysql.socket' exists!
org.kde.pim.akonadiserver: Failed to remove runtime connection config file
org.kde.pim.akonadicontrol: Application 'akonadiserver' exited normally...

这产生了一些有趣的线条。有问题的是org.kde.pim.akonadiserver: stderr: "mysqld: Can't change dir to '/home/[my username]/.local/share/akonadi/db_data/' (Errcode: 2 - No such file or directory).对我来说,这看起来像是程序试图写入它无权访问的目录并抛出错误,就像touch ~/nonexistent_dir/file.txt会发生的那样。

所以我跑去cd ~/.local/share/akonadi/; mkdir db_data重试。砰,它起作用了。

答案2

类似的问题,不同的解决方案。我的被​​诊断是这样的:

$ akonadictl --verbose start                                      
....
org.kde.pim.akonadiserver: Executing: "/usr/sbin/mysqld-akonadi" "--defaults-file=/home/dargaud/.local/share/akonadi/mysql.conf --datadir=/home/dargaud/.local/share/akonadi/db_data/ --socket=/run/user/10705/akonadi/mysql.socket --pid-file=/run/user/10705/akonadi/mysql.pid"
org.kde.pim.akonadiserver: database server stopped unexpectedly

$ tail /var/log/syslog                      
audit: type=1400 audit(1593423663.888:404): apparmor="DENIED" operation="mknod" profile="/usr/sbin/mysqld" name="/home/dargaud/.local/share/akonadi/db_data/mysqld_tmp_file_case_insensitive_test.lower-test" pid=156675 comm="mysqld-akonadi" requested_mask="c" denied_mask="c" fsuid=10705 ouid=10705

解决方案,添加将以下两行添加到 mysqld 的 apparmor 配置文件中:

$ sudo nano /etc/apparmor.d/usr.sbin.mysqld
/{,var/}run/user/[0-9]*/akonadi/** rw,
/home/*/.local/share/akonadi/** rwk,

其次是:

$ sudo systemctl restart apparmor.service
$ akonadictl --verbose start 

相关内容