Bug 199209 - root cannot run kde4 applications from the command line without using dbus-launch
Summary: root cannot run kde4 applications from the command line without using dbus-la...
Status: RESOLVED WORKSFORME
Alias: None
Product: kde
Classification: I don't know
Component: general (show other bugs)
Version: 4.2.4
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
: 165268 191700 191964 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-07-06 23:46 UTC by Robert Dyck
Modified: 2014-06-22 13:38 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Dyck 2009-07-06 23:46:32 UTC
Version:            (using KDE 4.2.4)
OS:                Linux
Installed from:    Fedora RPMs

When I attempt to run the install script for printer ( Samsung multifunction ) as root it hangs. If I modify the script to eliminate the test for qt4 and force it to use its qt3 method, I am able to complete the installation. I had previously used the script on a kde 3.5.9 system without difficulty.

Further testing showed that kde3 apps and gtk apps could be run as root. kde4 apps could not be run from the cli as root.
Comment 1 Dario Andres 2009-07-07 17:06:58 UTC
Do they work if you launch them as "dbus-launch kdeAppName" ?
Comment 2 Robert Dyck 2009-07-07 17:51:50 UTC
I retested the printer install script using dbus-launch. The install GUI appeared.

Using dbus-launch I was able to run konqueror and kcalc. These apps would not run if I simply typed the app name.
Comment 3 Dario Andres 2009-07-07 20:35:59 UTC
*** Bug 191700 has been marked as a duplicate of this bug. ***
Comment 4 Dario Andres 2009-07-07 20:36:31 UTC
*** Bug 191964 has been marked as a duplicate of this bug. ***
Comment 5 Dario Andres 2009-07-07 20:37:33 UTC
Bug 165268 is also related to this, but it has further information
Comment 6 Dave Plater 2009-07-25 09:01:05 UTC
I have the same symptoms after updating to kde4.2.98-97 from opensuse build service on a factory system. After an attempted roll back to kde4.2.95 from factory (11.2 m4) the problem persists.
Comment 7 Dave Plater 2009-07-26 09:05:10 UTC
I would love to know what causes this problem one day. Yesterday I had this problem on my system. Under kde3 I could use the run command to run as root and start root programs, under kde4 the only way I could start programs with root privileges was from a terminal with root privileges obtained by cli su and then dbus-launch program as described in C#1. I had logged out / in and init3 / init5 to restart x numerous times. The last time this problem appeared around 9 June and it disappeared after editing kdesurc and returning it to it's original state with logout/logins in between the editing 
(see http://bugzilla.novell.com/show_bug.cgi?id=511480 ) This time it has disappeared with a reboot. The only clue is that my ~/.kde/share/config/kdesurc wasn't replaced at last upgrade but ~/.kde4/share/config/kdesurc was.
Comment 8 Steven Sroka 2011-04-24 21:13:03 UTC
Does anyone know if the root cause of this has been found/fixed?
Comment 9 Dave Plater 2011-04-24 23:37:10 UTC
I no longer have a problem, I can hardly remember this bug it's so old, but I think openSUSE have their own su to root method? The root cause was most probably some long forgotten bug that has disappeared that caused kdesurc to be altered.
Comment 10 Steven Sroka 2011-04-25 01:07:52 UTC
openSUSE is having a problem with running root programs and dbus, and this is one of the related bugs mentioned. So I was wondering what the status is with this bug report.

Anyway, I'll tell the opensuse devs this bug is essentially fixed/closed. Do you want to officially close it?
Comment 11 Dmytro Taranovsky 2011-04-25 03:28:45 UTC
This bug is still present (using Fedora 14 and KDE 4.6.1):

[dmytro@home ~]$ su
Password: 
[root@home dmytro]# konqueror 
**
GLib-GIO:ERROR:gdbusconnection.c:2270:initable_init: assertion failed: (connection->initialization_error == NULL)
Aborted (core dumped)
Comment 12 Malvern Star 2011-05-03 16:43:59 UTC
I can confirm this bug as being present in openSuSE 11.4 Final, running KDE 4.6.0.  It is always reproducible, and was first reported in openSuSE 11.2 (running KDE 4.2 I believe).  Numerous applications cannot be launched from the commandline by the root user.  The easiest example to test with is kwrite.  The openSuSE bug report closed as "upstream" by them is located here: https://bugzilla.novell.com/show_bug.cgi?id=514056
Comment 13 S. Burmeister 2011-07-04 01:28:44 UTC
Either this report is mixing two issues or this is a "always worked for me".

su - (don't forget the "-")
<password>
kwrite

and it opens.
Comment 14 Thomas Zander 2011-07-04 09:04:57 UTC
I would add my vote that this can be closed as "WORKSFORME".

Using just 'su' without the minus (dash) is not expected to work; it would be a big security issue if you would make it work, if I understand correctly.

Here is why;
Using 'su' keeps the environment but substitutes the user. part of this environment is the variable;  DBUS_SESSION_BUS_ADDRESS and this points to a bug session bus created specifically for the original user.
Not changing this env var but replacing your user means that another user tries to connect to the dbus session reserved for the original user, which then is rejected with a
  'the message bus security policy blocked the reply'


A proper solution would be to force a new session bus to be created for the substitute user.
Either do an su with a login shell, or unset the mentioned dbus variable before starting your app as another user.
Comment 15 Malvern Star 2011-07-20 10:23:57 UTC
It does not work, even with the dash after su.  Kwrite also now crashes.  The following feedback is given in openSUSE 12.1 Milestone 3, running KDE 4.6.5:

kwrite(6044): Session bus not found 
To circumvent this problem try the following command (with Linux and bash) 
export $(dbus-launch) 

KCrash: Application 'kwrite' crashing...
KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
sock_file=/root/.kde4/socket-knet5/kdeinit4__0

[1]+  Stopped                 kwrite


Please re-open this bug.
Comment 16 Thomas Zander 2011-07-20 10:43:57 UTC
Malvarn,

the reason the bug is closed is because the steps you take give the correct response, which is the one you see. I'm ignoring the crash you see since thats not what this report is about.
This report is about a user trying to reuse a dbus session that belongs to another user.  Expecting that to work is a huge security issue and thus the response you get is correct.

This is not a bug in KDE, this is incorrect usage of the tools provided which gets stopped due to security issues.

Please use a tool like 'sux' or manually unset the variable DBUS_SESSION_BUS_ADDRESS after doing a plain su.
Comment 17 Malvern Star 2011-07-20 10:56:45 UTC
Thomas, reply 13 gives the following information:

su - (don't forget the "-")
<password>
kwrite

and it opens.

Yet, as I have said, it does not, even WITH the dash.  There is definitely a bug somewhere.  For more information, you can read the new bug report opened by Steven here: https://bugs.kde.org/show_bug.cgi?id=277249
Comment 18 Chao Feng 2014-06-22 13:38:25 UTC
*** Bug 165268 has been marked as a duplicate of this bug. ***