Change:
Describe the bug Support for several protocols are missing in KIO after upgrading to plasma desktop 5.17.5 To Reproduce Steps to reproduce the behavior: with the latest nixos-unstable channel, sure the desktop is configured with the folder view logging in, an error message is displayed at the center of the screen: ! Expected behavior A folder view of the desktop icons should be displayed correctly. Additional context I think one can reproduce the error with kioclient5: This will give the same error message: Metadata
cc
Thanks for reporting this! I don't see any error message on the desktop in a VM, but I will try the reproduction next.
I cannot reproduce this in a clean VM. does this happen after upgrading an existing installation? If so, then I suspect this is a (known) issue with not performing cache invalidation correctly.
Hi , yes, I noticed the regression right after I upgraded my system with followed by followed by (I have network issues and I found this workaround somewhere on GitHub). Before the upgrade I was running plasma 5.16.5 where it worked well. Might be stupid but how can I clear the cache of ? I tried things like with no luck. I also tried with a new user but had the same issue.
will rebuild the current cache, but you have to actually remove all the existing caches: . Basically, this is because every KDE program runs in its own environment, so there may be multiple caches. However, the old caches wouldn't affect a new user, so if you are seeing the same with a new user, it must be something else.
Have the same issue. Just upgraded to 5.17.5, restarted PC and desktop shows the same error as originally reported. ! Removing cache with didn't help.
I have the same issue in an vm after upgrading, but I will try to reproduce it in an new VM.
Beside 'desktop', some other protocols are not working either. By checking I found similar error messages in other programs:
Can anyone share a configuration I can use to reproduce this?
Below is my configuration:
Also getting the same problem, ktorrent and yakuake are also reporting the same issue where they cannot find the desktop component (i.e. yakuake cannot find konsole). Also ktorrent is unable to find the plasma theme Clearing the cache had zero effect, here is my configuration
Also the firefox plasma integration seems to be failing, it has the error "Failed to connect to the native host" even though the package was installed.
Firefox plasma integration works fine for me despite I have the same problem with 'desktop' protocol.
I can reproduce this issue on first-time install of . Firefox plasma integration works fine while the protocol error is still there. EDIT : I have issue with also, it seems its does not want to launch correctly at start (keybinding is not opening it). If I launch in the terminal, it works but hang on first keystrokes to shows the following output : I have the feeling that this is not only the protocol that is impacted
I am (finally) able to reproduce this issue with the following configuration in a QEMU VM: I have checked that exists; missing this file is the most obvious way this could go wrong.
Using socket-activated D-Bus fixes this issue: I suspect that if the D-Bus session is started too early, the environment is not set up correctly.
Maybe related: Upstream changes to cause to run in an empty environment.
Switching the handling of D-Bus from X11-activated to socket-activated fixed the issue for me as well - didn't touch the ksycoca cache so far.
Thank you , it works! Saved my life!
I can also confirm that it works, is the change from going to X11 to socket activated d-bus likely to be merged into nixos-stable or is this an upstream issue that needs to be resolved and hence the current fix is just a workaround?
This fixes plasma for me, (including latte-dock not auto-starting). For some reason, plasma-browser-integration still is not working for me despite the extension being installed.
I can confirm it fixes the issue also for me.
Such a change in nixos 20.03 would be out of the question IMHO. It's a regression that it doesn't work properly in the first place.
It's neither: it is a workaround and it's not an upstream issue. The issue is that something in the "improved" unsets the environment for some processes during startup. Then those processes can't find D-Bus. I think with socket activation, the affected processes will start their own message bus. If you look at the log (), the Plasma session isn't properly started, but is just limping along. I agree with that this shouldn't be merged into NixOS 20.03, or into any other branch. If a proper solution is not forthcoming, then the Plasma 5.17 update should be reverted.
Okay thanks, I have commented this as a workaround in my . Hopefully we can solve the underlying issue.
I have narrowed this down somewhat. Some background: is a setuid binary that starts the Plasma session server; because it is setuid, its environment is reset at startup. reads the environment, runs , and passes the environment through a pipe. reads the environment from the pipe and sets the environment before calling . I have verified that truncates the environment, and I think that causes the problems we are seeing. I don't know why yet, but I have a suspect: has some sanity checks for the environment that it reads (for security) and one of those checks is on the length of each individual environment entry. I suspect that the new dependencies in Plasma 5.17 cause the limit to be exceeded.
I have confirmed that this is, indeed, the case. I believe I can have a patch ready in a day.

Discussion:
<ins> From 715c5f461b4992dac066601202a673bc551a5e33 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel <ttuegel@mailbox.org> Date: Sun, 16 Feb 2020 14:23:31 -0600 Subject: [PATCH 1/4] kinit-libpath --- src/kdeinit/kinit.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/kdeinit/kinit.cpp b/src/kdeinit/kinit.cpp index 8fff17a..0801b75 100644 --- a/src/kdeinit/kinit.cpp +++ b/src/kdeinit/kinit.cpp @@ -622,19 +622,15 @@ static pid_t launch(int argc, const char *_name, const char *args, if (!libpath.isEmpty()) { if (libpath_relative) { -                // NB: Because Qt makes the actual dlopen() call, the -                //     RUNPATH of kdeinit is *not* respected - see -                //     https://sourceware.org/bugzilla/show_bug.cgi?id=13945 -                //     - so we try hacking it in ourselves -                QString install_lib_dir = QFile::decodeName( -                        CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/"); -                QString orig_libpath = libpath; -                libpath = install_lib_dir + libpath; -                l.setFileName(libpath); -                if (!l.load()) { -                    libpath = orig_libpath; -                    l.setFileName(libpath); -                    l.load(); +                // Try to load the library relative to the active profiles. +                QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' '); +                // Reverse the profile list. +                std::reverse(profiles.begin(), profiles.end()); +                for (const QByteArray &profile: profiles) { +                    if (!profile.isEmpty()) { +                        l.setFileName(QFile::decodeName(profile) + QStringLiteral("/lib/") + libpath); +                        if (l.load()) break; +                    } } } else { l.load(); -- 2.23.1 </ins>

<ins> From 129cd0ae1e983adc10dbe84e87bcc6f31cb13db8 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel <ttuegel@mailbox.org> Date: Sun, 16 Feb 2020 14:23:44 -0600 Subject: [PATCH 2/4] start_kdeinit-path --- src/start_kdeinit/start_kdeinit_wrapper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/start_kdeinit/start_kdeinit_wrapper.c b/src/start_kdeinit/start_kdeinit_wrapper.c index 891f50c..ef664ad 100644 --- a/src/start_kdeinit/start_kdeinit_wrapper.c +++ b/src/start_kdeinit/start_kdeinit_wrapper.c @@ -23,7 +23,7 @@ #include <string.h> #include <unistd.h> -#define EXECUTE CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/start_kdeinit" +#define EXECUTE "/run/wrappers/bin/start_kdeinit" #if KDEINIT_OOM_PROTECT -- 2.23.1 </ins>

<ins> From 4f5d0de7e35744cdbfa9e280ee7e15a54cf21abb Mon Sep 17 00:00:00 2001 From: Thomas Tuegel <ttuegel@mailbox.org> Date: Sun, 16 Feb 2020 14:24:07 -0600 Subject: [PATCH 3/4] kdeinit-extra-libs --- src/kdeinit/kinit.cpp | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/kdeinit/kinit.cpp b/src/kdeinit/kinit.cpp index 0801b75..622dd5f 100644 --- a/src/kdeinit/kinit.cpp +++ b/src/kdeinit/kinit.cpp @@ -96,9 +96,9 @@ static const char *extra_libs[] = { "libKF5Parts.5.dylib", "libKF5Plasma.5.dylib" #else -    "libKF5KIOCore.so.5", -    "libKF5Parts.so.5", -    "libKF5Plasma.so.5" +    NIXPKGS_KF5_KIOCORE, +    NIXPKGS_KF5_PARTS, +    NIXPKGS_KF5_PLASMA #endif }; #endif @@ -1524,20 +1524,6 @@ static int initXconnection() } #endif -#ifndef Q_OS_OSX -// Find a shared lib in the lib dir, e.g. libkio.so. -// Completely unrelated to plugins. -static QString findSharedLib(const QString &lib) -{ -    QString path = QFile::decodeName(CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/") + lib; -    if (QFile::exists(path)) { -        return path; -    } -    // We could also look in LD_LIBRARY_PATH, but really, who installs the main libs in different prefixes? -    return QString(); -} -#endif - extern "C" { static void secondary_child_handler(int) @@ -1679,7 +1665,7 @@ int main(int argc, char **argv) #if defined(Q_OS_UNIX) && !defined(Q_OS_OSX) if (!d.suicide && qEnvironmentVariableIsEmpty("KDE_IS_PRELINKED")) { for (const char *extra_lib : extra_libs) { -            const QString extra = findSharedLib(QString::fromLatin1(extra_lib)); +            const QString extra = QString::fromLatin1(extra_lib); if (!extra.isEmpty()) { QLibrary l(extra); l.setLoadHints(QLibrary::ExportExternalSymbolsHint); -- 2.23.1 </ins>

<ins> From 41e94983dcfbc1667f1b18c5b566aa5c5975edcb Mon Sep 17 00:00:00 2001 From: Thomas Tuegel <ttuegel@mailbox.org> Date: Mon, 17 Feb 2020 04:45:03 -0600 Subject: [PATCH 4/4] start_kdeinit-environ-hard-limit --- src/start_kdeinit/start_kdeinit.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/start_kdeinit/start_kdeinit.c b/src/start_kdeinit/start_kdeinit.c index f2db3e9..4ff2602 100644 --- a/src/start_kdeinit/start_kdeinit.c +++ b/src/start_kdeinit/start_kdeinit.c @@ -148,7 +148,11 @@ int main(int argc, char **argv) ++i) { unsigned len; if (read(0, &len, sizeof(unsigned)) == sizeof(unsigned) -                            && len && len < (1 << 12)) { +                            && len) { +                        if (len >= (1 << 14)) { +                            fprintf(stderr, "%s: exceeded environment length limit", argv[0]); +                            return 1; +                        } env[ i ] = malloc(len + 1); if ((unsigned) read(0, env[ i ], len) == len) { env[ i ][ len ] = '0'; -- 2.23.1 </ins>

buildInputs = [ kconfig kcrash ki18n kio kservice kwindowsystem ]; <del> patches = copyPathsToStore (lib.readPathsFromFile ./. ./series); </del> <ins> patches = [ ./0001-kinit-libpath.patch ./0002-start_kdeinit-path.patch ./0003-kdeinit-extra-libs.patch ./0004-start_kdeinit-environ-hard-limit.patch ]; </ins> CXXFLAGS = [ ''-DNIXPKGS_KF5_KIOCORE="${getLib kio}/lib/libKF5KIOCore.so.5"'' ''-DNIXPKGS_KF5_PARTS="${getLib kparts}/lib/libKF5Parts.so.5"''

<del> Index: kinit-5.32.0/src/kdeinit/kinit.cpp =================================================================== --- kinit-5.32.0.orig/src/kdeinit/kinit.cpp +++ kinit-5.32.0/src/kdeinit/kinit.cpp @@ -96,9 +96,9 @@ static const char *extra_libs[] = { "libKF5Parts.5.dylib", "libKF5Plasma.5.dylib" #else -    "libKF5KIOCore.so.5", -    "libKF5Parts.so.5", -    "libKF5Plasma.so.5" +    NIXPKGS_KF5_KIOCORE, +    NIXPKGS_KF5_PARTS, +    NIXPKGS_KF5_PLASMA #endif }; #endif @@ -1533,20 +1531,6 @@ static int initXconnection() } #endif -#ifndef Q_OS_OSX -// Find a shared lib in the lib dir, e.g. libkio.so. -// Completely unrelated to plugins. -static QString findSharedLib(const QString &lib) -{ -    QString path = QFile::decodeName(CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/") + lib; -    if (QFile::exists(path)) { -        return path; -    } -    // We could also look in LD_LIBRARY_PATH, but really, who installs the main libs in different prefixes? -    return QString(); -} -#endif - extern "C" { static void secondary_child_handler(int) @@ -1692,7 +1676,7 @@ int main(int argc, char **argv) if (!d.suicide && qEnvironmentVariableIsEmpty("KDE_IS_PRELINKED")) { for (const char *extra_lib : extra_libs) { -            const QString extra = findSharedLib(QString::fromLatin1(extra_lib)); +            const QString extra = QString::fromLatin1(extra_lib); if (!extra.isEmpty()) { QLibrary l(extra); l.setLoadHints(QLibrary::ExportExternalSymbolsHint); </del>

<del> Index: kinit-5.32.0/src/kdeinit/kinit.cpp =================================================================== --- kinit-5.32.0.orig/src/kdeinit/kinit.cpp +++ kinit-5.32.0/src/kdeinit/kinit.cpp @@ -623,19 +623,15 @@ static pid_t launch(int argc, const char if (!libpath.isEmpty()) { if (libpath_relative) { -                // NB: Because Qt makes the actual dlopen() call, the -                //     RUNPATH of kdeinit is *not* respected - see -                //     https://sourceware.org/bugzilla/show_bug.cgi?id=13945 -                //     - so we try hacking it in ourselves -                QString install_lib_dir = QFile::decodeName( -                        CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/"); -                QString orig_libpath = libpath; -                libpath = install_lib_dir + libpath; -                l.setFileName(libpath); -                if (!l.load()) { -                    libpath = orig_libpath; -                    l.setFileName(libpath); -                    l.load(); +                // Try to load the library relative to the active profiles. +                QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' '); +                // Reverse the profile list. +                std::reverse(profiles.begin(), profiles.end()); +                for (const QByteArray &profile: profiles) { +                    if (!profile.isEmpty()) { +                        l.setFileName(QFile::decodeName(profile) + QStringLiteral("/lib/") + libpath); +                        if (l.load()) break; +                    } } } else { l.load(); </del>

<del> Index: kinit-5.24.0/src/start_kdeinit/start_kdeinit_wrapper.c =================================================================== --- kinit-5.24.0.orig/src/start_kdeinit/start_kdeinit_wrapper.c +++ kinit-5.24.0/src/start_kdeinit/start_kdeinit_wrapper.c @@ -23,7 +23,7 @@ #include <string.h> #include <unistd.h> -#define EXECUTE CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/start_kdeinit" +#define EXECUTE "/run/wrappers/bin/start_kdeinit" #if KDEINIT_OOM_PROTECT </del>