Bug 157853 - KLauncher could not be reached via D-Bus
Summary: KLauncher could not be reached via D-Bus
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: klauncher (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: David Faure
: 151760 157407 161043 163768 164671 166895 167106 167270 168883 173784 (view as bug list)
Depends on:
Reported: 2008-02-15 09:03 UTC by dc
Modified: 2008-12-16 02:30 UTC (History)
17 users (show)

See Also:
Latest Commit:
Version Fixed In:

Original kate.desktop from opensuse 11.0 (4.78 KB, application/octet-stream)
2008-07-07 18:56 UTC, Ivo Anjo
kate.desktop created by systemsettings, which fixes the problem (310 bytes, application/octet-stream)
2008-07-07 18:57 UTC, Ivo Anjo
dbus-monitor log while konqueror tries to contact klauncher (53.09 KB, text/plain)
2008-07-19 20:35 UTC, auxsvr

Note You need to log in before you can comment on or make changes to this bug.
Description dc 2008-02-15 09:03:35 UTC
Version:           4.0.1 (using 4.0.1 (KDE 4.0.1), Kubuntu packages)
Compiler:          gcc
OS:                Linux (i686) release 2.6.22-14-generic

Klauncher doesn't seem to answer... In konqueror, the request of a new URL displays :

Could not start process Cannot talk to klauncher: Connection is closed.

While clicking on an icon (panel, desktop...) pops up a window with :

KLauncher could not be reached via D-Bus, error when calling start_service_by_desktop_name:

After this incident, there is only one klauncher process showed by a ps 'klauncher [kdeinit]', while there seem to be a second one when I restart KDE.There is on fathered by 'kdeinit4: kdeinit4 Run up', while the other has 'kdeinit Running...' as a father.

I have the same sort of situation with kded4 and kded... Could it be that there is a racing condition between the two ? 

Comment 1 Rich Johnson 2008-02-23 07:40:23 UTC
Hey David, I have run across quite a few of these now on Launchpad, however one guy attached some fairly decent traces as well as running Konqi from the command line to provide some further output. Here is the link for you to look over if you need to. Thanks!

Comment 2 David Faure 2008-05-09 19:40:12 UTC
I get a permission error on that bugs.launchpad.net URL, even though I'm logged in.

Does this bug still happen? (especially after revision 805923 - I committed today a fix for klauncher running kde3 desktop files... and you mention kde3's kded so maybe it helps).
Comment 3 dc 2008-06-18 10:41:31 UTC
It also happens in 4.1 beta, while selecting a Koffice file in Dolphin.
Comment 4 Maciej Pilichowski 2008-06-22 09:21:13 UTC
(fresh KDE4Daily) Happened to me today --> I cannot open KMenu.
Comment 5 David Faure 2008-07-07 13:19:19 UTC
Sounds like the kde3 klauncher is being started instead of the kde4 klauncher. Can you check the set up? Is the right klauncher in the PATH? Is KDEDIRS set to kde4? etc.
Comment 6 Ivo Anjo 2008-07-07 13:31:45 UTC
I kinda have this problem, if I pick a file on dolphin, right click, select open with > other and type kate, dolphin stops responding for awhile and then I get the 
"KLauncher could not be reached via D-Bus, error when calling start_service_by_desktop_name:
empty "

It can be fixed by doing what is described in this comment ( https://bugs.launchpad.net/ubuntu/+source/kde4libs/+bug/205517/comments/6 ) from this bug ( https://bugs.launchpad.net/ubuntu/+source/kde4libs/+bug/205517 ) [ I think no login is needed for these ].

I checked, and I seem to be running only one klauncher, which is the kde4 one.
Comment 7 David Faure 2008-07-07 16:56:20 UTC
> "/usr/lib/kde4/bin/kate %U". I changed %U into %u

%U is correct; kate can handle multiple urls in the command line.
So either
1) there's a bug in the handling of %U
2) the fact that you change the Exec line makes a local copy of the desktop file in your KDEHOME,
and *that* is what works around the problem (not the %U->%u change itself).
Anyone trying this workaround, please double check if you have a kate.desktop file
in ~/.kde ~/.kde4 or ~/.local first.
Also, those who tried it already, please try if putting %U back in makes the bug come back.
Comment 8 Ivo Anjo 2008-07-07 17:12:24 UTC
Ok, so I've retested it on my openSUSE 11 / kde 4.0.4 and kde4daily, and it seems the bug is related to your #2 suggestion:

I searched for and deleted the kate.desktop file that was on ~/.local, tried it again, and it gave that error again; then I went to systemsettings and added and removed a space from the kate command line (so it would detect a change and create a new kate.desktop), and indeed it is confirmed, even with kate %U there is no problem.

So it seems that something (klauncher?) is having trouble starting kate in this case, it's not a problem with kate.
Comment 9 David Faure 2008-07-07 17:28:19 UTC
When you delete the kate.desktop from ~/.local, the question is, which kate.desktop is used then.

Please check all dirs returned by kde4-config --path xdgdata-apps
and those returned by kde4-config --path apps

I suspect the kde3 kate.desktop is being used.
Comment 10 Ivo Anjo 2008-07-07 17:48:57 UTC
I doubt it's using the kate.desktop from kde3, because it's the kde4 version that launches in both cases, and because neither kde4daily nor my current openSUSE 11 install have kde3 (the opensuse install has some kde3 stuff, but I don't have kate).

I also did a find / | grep "kate.desktop", and it found only the default kde4 one ( /usr/share/applications/kde4/kate.desktop ), after I'd deleted the one in .local again.

Do you want me to include here the output from the kde4-config stuff?
Comment 11 David Faure 2008-07-07 18:36:43 UTC
Strange... If you copy /usr/share/applications/kde4/kate.desktop to ~/.local/share/applications/, does it work then?
If you copy it to ~/.local/share/applications/kde4/, does it work then?

If it doesn't work when doing either one, please check if putting there the "local version that works", fixes it.
If yes, the answer lies in the difference between the global and the local file; I guess the local file that works
doesn't have the X-DBus-StartupType key? Can you try to find out if this line makes the difference, or which
other line makes a difference?
Sorry for having you do all the debugging, but I don't get this issue here so I can't do it myself.
Comment 12 Ivo Anjo 2008-07-07 18:56:06 UTC
Ok, so I've been trying with both kate.desktop files in ~/.local/share/applications/kde4/ -- the one created by systemsettings, and the system one. Just replacing one with the other triggers the bug immediately, so it really seems to be related to the .desktop file.

I'm attaching both .desktop files, but by looking at them I noticed that both have X-DBUS-StartupType=Multi, but the system one has "X-DBUS-ServiceName=org.kate-editor.kate" (on both suse and kde4daily), and I tried to remove just that line (that isn't present on the one created by ss), and it also seems to "fix" the problem.

So it seems to be related to the X-DBUS-ServiceName property, whatever that does.

Also, I should be the one to thank you for your time and patience.
Comment 13 Ivo Anjo 2008-07-07 18:56:37 UTC
Created attachment 25903 [details]
Original kate.desktop from opensuse 11.0
Comment 14 Ivo Anjo 2008-07-07 18:57:33 UTC
Created attachment 25904 [details]
kate.desktop created by systemsettings, which fixes the problem
Comment 15 David Faure 2008-07-07 19:12:42 UTC
Interesting, kate registers to DBus as org.kde.kate, not as org.kate-editor.kate!
1) klauncher has to give a better error message in this case (I can have a look at that)
2) the kate .desktop file is wrong. I'll fix it right now.
Comment 16 David Faure 2008-07-07 19:13:17 UTC
SVN commit 829142 by dfaure:

Commit r585903 by jowenn made kate register to dbus as org.kde.kate, but the desktop file wasn't updated so klauncher got very confused when trying to start up kate via its desktop file.
BUG: 157853

 M  +1 -1      kate.desktop  

WebSVN link: http://websvn.kde.org/?view=rev&revision=829142
Comment 17 David Faure 2008-07-07 19:16:21 UTC
On Monday 07 July 2008, Ivo Anjo wrote:
> I went to systemsettings and added and removed a space from the kate command line 

Oh, and 3) this action shouldn't change the X-DBUS-ServiceName.
Where exactly in systemsettings are you changing the kate command line?
In the filetypes editor, after looking for text/plain?
Comment 18 Ivo Anjo 2008-07-07 19:23:11 UTC
Thanks for fixing it, this is one of those bugs that is really annoying.

Yeah, filetypes editor, text/plain, select kate, edit, application, command. Also, if you compare the two files, it seems this "edit" is completely recreating the desktop file, with all the translations and most other stuff being thrown away.
Comment 19 Ivo Anjo 2008-07-07 19:35:32 UTC
I was reading comment #3 and decided to test kword on kde4daily, and it seems kword, kspread, kpresenter, kivio, krita also suffer from something similar.
[kexi, kplato, karbon don't seem to have it].

They don't have a X-DBUS-ServiceName, but I removing the X-DBUS-StartupType=Multi from kword.desktop, and it seemed to fix it, so, this time really is the StartupType.
Comment 20 Ivo Anjo 2008-07-08 16:21:47 UTC
It seems this also happens with ktorrent that has X-DBUS-StartupType=Single .

To repeat this I did what I always do: pick a random file on dolphin, right click, select open with, and type ktorrent.

Commenting the X-DBUS-StartupType line on the desktop file "fixed" it.

So maybe this deserves reopened? There seem to be a lot of apps where this happens. Or is the bug related to the open-with dialog and klauncher?
Comment 21 David Faure 2008-07-12 01:19:53 UTC
*** Bug 163768 has been marked as a duplicate of this bug. ***
Comment 22 A. Spehr 2008-07-13 02:47:52 UTC
*** Bug 161043 has been marked as a duplicate of this bug. ***
Comment 23 A. Spehr 2008-07-13 02:49:57 UTC
*** Bug 157407 has been marked as a duplicate of this bug. ***
Comment 24 A. Spehr 2008-07-13 02:54:30 UTC
*** Bug 164671 has been marked as a duplicate of this bug. ***
Comment 25 Christophe Marin 2008-07-13 10:48:57 UTC
Since bug 164671 was marked as duplicate, reopening.
Comment 26 Pino Toscano 2008-07-18 10:10:35 UTC
*** Bug 166895 has been marked as a duplicate of this bug. ***
Comment 27 auxsvr 2008-07-19 20:35:40 UTC
Created attachment 26268 [details]
dbus-monitor log while konqueror tries to contact klauncher

I have a similar problem here: for some reason a konqueror process cannot
communicate with klauncher ("Cannot talk to klauncher: Connection is closed")
and every time I try to visit an URL kbuildsycoca4 is launched. When I launch a
new konqueror process, the message "Konqueror didn't close correctly" appears,
even though the previous session is still running, and the new process works
fine, like every other KDE application (kontact, akregator, dolphin).

I'm using the KDE 4.0.99 (4.1 RC1+) RPMs from the opensuse factory.
Comment 28 Philippe Piquer 2008-07-20 18:20:37 UTC
Well the exact same thing happened to me today (while it worked perfectly before) after modifying the mode for a gpx file to display it as an xml ...
Klauncher message , then the whole system begins to go heratic , mouse goes nuts , keyboard follows , the HD went wild ... I had to hard reboot , the same thing happened whenever I opened a gpx file with kate ...
I found this bug report , removed the X-DBUS-ServiceName line but it didn't change a thing ...
But removing also the X-DBUS-StartupType line seems to have fixed it ...

Kubuntu 8.04 - - KDE 4.00.98 (kate still 4.00.83)
Comment 29 Pino Toscano 2008-07-21 00:08:15 UTC
*** Bug 167106 has been marked as a duplicate of this bug. ***
Comment 30 Christophe Marin 2008-07-23 11:54:33 UTC
*** Bug 167270 has been marked as a duplicate of this bug. ***
Comment 31 A. Spehr 2008-08-01 13:16:13 UTC
*** Bug 151760 has been marked as a duplicate of this bug. ***
Comment 32 Christophe Marin 2008-08-11 10:32:19 UTC
*** Bug 168883 has been marked as a duplicate of this bug. ***
Comment 33 Josef Weidendorfer 2008-08-13 17:52:30 UTC
*** Bug 169017 has been marked as a duplicate of this bug. ***
Comment 34 Jithin Emmanuel 2008-08-14 06:16:22 UTC
I have this problem with Kcachegrind I use kde 4.1 fedora core9
Comment 35 zygfryd homonto 2008-09-09 22:24:49 UTC
same with ktorrent from archlinux
removing: "X-DBUS-StartupType=Unique" from desktop file solves this problem
Name           : ktorrent
Version        : 3.1.2-1
URL            : http://ktorrent.org
Licenses       : GPL  
Groups         : None
Provides       : None
Depends On     : kdelibs>4  gmp  qca  
Optional Deps  : None
Required By    : None
Conflicts With : None
Replaces       : None
Installed Size : 12204.00 K
Packager       : Hugo Doria <hugo@archlinux.org>
Architecture   : i686
Build Date     : Wed 13 Aug 2008 08:24:29 PM EEST
Install Date   : Thu 04 Sep 2008 10:31:49 PM EEST
Install Reason : Explicitly installed
Install Script : No
Description    : A BitTorrent program for KDE
Comment 36 Rex Dieter 2008-10-14 22:13:38 UTC
SVN commit 871391 by rdieter:

similar fix as for kate and bug #157853 comment #16

BUG: 157853
CCMAIL: ktorrent-owner@fedoraproject.org

 M  +1 -0      ktorrent.desktop  

WebSVN link: http://websvn.kde.org/?view=rev&revision=871391
Comment 37 Rex Dieter 2008-10-14 22:17:18 UTC
oops, reopening.  just fixed the ktorrent side of the issue... may well be other misbahaving apps (tho, I'd argue each should have their own bug)
Comment 38 Christophe Marin 2008-10-28 21:19:35 UTC
*** Bug 173784 has been marked as a duplicate of this bug. ***
Comment 39 John 2008-12-14 09:40:48 UTC
This happened to me today. I just installed Kubuntu 8.10 running KDE 4.1.3. I navigated through the K menu to find the Konsole icon. I right-clicked it and added it to the Desktop. I think clicked on the icon on the desktop to open the console. The system froze for a few moments and then I got the following error:

KLauncher could not be reached via D-Bus. Error when calling start_service_by_desktop_path:

Interestingly, after that happened, I was also no longer able to launch the Konsole from the K menu. I would get the same error! I re-started X in order to launch Konsole from the K Menu, but I did not attempt to add it to the desktop again.
Comment 40 David Faure 2008-12-16 02:30:47 UTC
The error message with "empty" is fixed for 4.2 (possibly even 4.1.3, I forgot if I backported that one).

The error when launching kcachegrind was 169017, fixed.
Rex fixed ktorrent, thanks.
kde3 apps (like kde3-koffice) was fixed for 4.1.x (DCOP key isn't parsed as being valid for DBUS anymore).
And I just fixed the kioexec case, as well as a more general porting bug in klauncher, in case any of the duplicates was about that.

I think this fixes all the cases mentionned here, if not, please open a new kdelibs bug report (or reopen those merged-in duplicates which are not solved in 4.2), I'm getting confused by all the various issues mixed up in the same report.