Kontact does not find the Kontact/Plugin service type resulting empty window:

I was also able to reproduce the error with this little c++ snippet:
# main.pro
SOURCES = main.cpp
QT += KService KCoreAddons
// main.cpp
#include <KServiceType>
#include <KServiceTypeTrader>
int main(int argc, char** argv) {
QCoreApplication a(argc, argv);
auto res = KServiceTypeTrader::self()->query(QStringLiteral("Kontact/Plugin"));
}
qmake main.pro
make
./main
kf5.kservice.services: KServiceTypeTrader: serviceType "Kontact/Plugin" not found
$ kontact
grantlee.template: "Plugin library 'kde_grantlee_plugin' not found."
grantlee.template: "Plugin library 'kde_grantlee_plugin' not found."
kf5.kservice.services: KServiceTypeTrader: serviceType "Kontact/Plugin" not found
grantlee.template: "Plugin library 'kde_grantlee_plugin' not found."
grantlee.template: "Plugin library 'kde_grantlee_plugin' not found."
"x86_64-linux"Linux 4.14.42, NixOS, 18.09.git.3c5bdec (Jellyfish)yesyesnix-env (Nix) 2.0"""nixpkgs, unstable-small-18.09pre137207.92f0d31b949"/home/joerg/git/nixpkgsI don't understand how services are defined. What files do I need to look for to see what services are available on my system?
According to strace it also finds all kontact plugins in the service directory:
statx(AT_FDCWD, "/home/joerg/.nix-profile/share/kservices5/kontactconfig.desktop", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=5847, ...}) = 0
statx(AT_FDCWD, "/home/joerg/.nix-profile/share/kservices5/kontact", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFDIR|0555, stx_size=9, ...}) = 0
openat(AT_FDCWD, "/home/joerg/.nix-profile/share/kservices5/kontact", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 7
statx(AT_FDCWD, "/home/joerg/.nix-profile/share/kservices5/kontact/todoplugin.desktop", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=6754, ...}) = 0
statx(AT_FDCWD, "/home/joerg/.nix-profile/share/kservices5/kontact/summaryplugin.desktop", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=5390, ...}) = 0
statx(AT_FDCWD, "/home/joerg/.nix-profile/share/kservices5/kontact/kmailplugin.desktop", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=5172, ...}) = 0
statx(AT_FDCWD, "/home/joerg/.nix-profile/share/kservices5/kontact/specialdatesplugin.desktop", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=5416, ...}) = 0
statx(AT_FDCWD, "/home/joerg/.nix-profile/share/kservices5/kontact/journalplugin.desktop", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=5548, ...}) = 0
statx(AT_FDCWD, "/home/joerg/.nix-profile/share/kservices5/kontact/korganizerplugin.desktop", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=5625, ...}) = 0
statx(AT_FDCWD, "/home/joerg/.nix-profile/share/kservices5/kontact/kaddressbookplugin.desktop", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=5788, ...}) = 0
statx(AT_FDCWD, "/run/current-system/sw/share/kservices5/kontact", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFDIR|0555, stx_size=8, ...}) = 0
openat(AT_FDCWD, "/run/current-system/sw/share/kservices5/kontact", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 7
statx(AT_FDCWD, "/run/current-system/sw/share/kservices5/kontact/kmailplugin.desktop", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=5172, ...}) = 0
statx(AT_FDCWD, "/run/current-system/sw/share/kservices5/kontact/specialdatesplugin.desktop", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=5416, ...}) = 0
statx(AT_FDCWD, "/run/current-system/sw/share/kservices5/kontact/korganizerplugin.desktop", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=5625, ...}) = 0
statx(AT_FDCWD, "/run/current-system/sw/share/kservices5/kontact/todoplugin.desktop", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=6754, ...}) = 0
statx(AT_FDCWD, "/run/current-system/sw/share/kservices5/kontact/summaryplugin.desktop", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=5390, ...}) = 0
statx(AT_FDCWD, "/run/current-system/sw/share/kservices5/kontact/journalplugin.desktop", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=5548, ...}) = 0
Were you able to solve this? I'm having the same issue right now and don't know what package or anything I am missing.
Hi nydn, I'm not sure if this will completely address your issue, but see the following references for packages. I used to run into the same problem, but no longer do with this configuration. See the Kontact/KDE related system packages installed at this link and then also the user Kontact/KDE installed packages found at this link.
Hey John,
Thanks for the help, it looks like configuring a mailbox in KMail fixed this issue somehow? I did nothing particular since yesterday, in fact I just wanted to test your advice, but started Kontact before that to check the error message again and voila, it works correctly now (aside from some warning messages) and it's fully functional. The only thing I changed was configuring a mailbox in Kmail and a calendar in KOrganizer separately.
@nydn no
I suspect there might be some files in the wrong build output that prevent them from being linked into the profile.
@nydn Sadly setting up several mail accounts and calendars didn't fix the issue for me.
What packages have you got installed? Just Kontact or did you also explicitly install some parts of it (e.g. KMail, korganizer)? If yes, in which profile?
Yes, I explicitly stated all the packages, in my system configuration because I wasn't sure. Half of them probably doesn't need to be in there, but I haven't got the time to check all the dependencies and clean it up.
{
...
systemPackages = with pkgs; with plasma5; with kdeApplications;
[
...
# KDE Apps
akonadi
akonadi-calendar
akonadi-contacts
akonadi-import-wizard
akonadi-mime
akonadi-notes
akonadi-search
akonadiconsole
akregator
ark
gwenview
kaddressbook
kalarm
kalarmcal
kate
kcalcore
kcalutils
kcontacts
kdav
kdepim-addons
kdepim-apps-libs
kdepim-runtime
kdialog
kidentitymanagement
kldap
kmail
kmailtransport
kmbox
kmime
kmix
kontact
kontactinterface
korganizer
konversation
kpimtextedit
libkdepim
libksieve
mailcommon
messagelib
pimcommon
pim-sieve-editor
okular
oxygen
oxygen-icons5
oxygenfonts
redshift-plasma-applet
spectacle
# End of KDE Apps
];
...
}
Strangely, I have encountered this same issue on a brand new Arch install last week and adding a New Account solved it there too.
Adding the packages mentioned by @nydn to my system packages helped, now Kontact is working as intended.
Over the next days I'm going to remove those packages from my environment again one by one, to find the problematic ones.
bisect search might be faster :)
@Mic92 yeah, already had that idea. But enough procrastination for me today…
I was able to narrow it down to nixpkgs.kdeApplications.kontactinterface for Kontact (and additionally kdeApplications.akonadi-mime for KOrganizer to work, see #38887) to be present in environment.systemPackages.
That is a workaround, but a proper fix for the Kontact derivation itself would be welcome.
I am not sure if there is a way to provide this through a wrapper. Maybe we can at least document it somewhere?
Most helpful comment
Hey John,
Thanks for the help, it looks like configuring a mailbox in KMail fixed this issue somehow? I did nothing particular since yesterday, in fact I just wanted to test your advice, but started Kontact before that to check the error message again and voila, it works correctly now (aside from some warning messages) and it's fully functional. The only thing I changed was configuring a mailbox in Kmail and a calendar in KOrganizer separately.