Applications using dbus hang when ran with sudo

Bug #71248 reported by kundica
222
Affects Status Importance Assigned to Milestone
D-Bus
Fix Released
High
dbus-glib (Ubuntu)
Fix Released
High
Sebastian Dröge

Bug Description

After changing my repos to Feisty and updating I can no longer launch Nautilus as sudo from terminal. On entering the command:
$ sudo nautilus

the terminal just hangs indefinately with no error.

Revision history for this message
chefweb (ulrich-timm-uni-rostock) wrote :

$ gksudo nautilus

(nautilus:5505): GnomeUI-WARNING **: While connecting to session manager:
Authentication Rejected, reason : None of the authentication protocols specified are supported and host-based authentication failed.

Revision history for this message
John Vivirito (gnomefreak) wrote :

Thank you reporting this bug. Can you please try it with gksudo or gksu. sudo should never be used to run Gui apps.

Changed in nautilus:
status: Unconfirmed → Needs Info
Revision history for this message
John Vivirito (gnomefreak) wrote :

After trying a few things i can confirm this bug. I think its due to the version of nautilus in feisty not matching gnome version.

Changed in nautilus:
status: Needs Info → Confirmed
Revision history for this message
Mike Durham (mdurhamesq) wrote :

I also can confirm this bug.

Revision history for this message
Donald (mail-markus-wedel) wrote :

Me too. With "gksudo nautilus" i get the window with the password prompt, then nothing happens, nautilus does not start.

Revision history for this message
Sebastien Bacher (seb128) wrote :

That seems to be a dbus problem. Running "sudo gdmsetup" has the same problem by example and the package is still the edgy one which works fine on edgy. You can use dbus-launch to workaround that

Changed in nautilus:
importance: Undecided → High
Revision history for this message
John Vivirito (gnomefreak) wrote : Re: apps using dbus hang when runned with sudo

Sebastien thank you for the work around 'sudo dbus-launch gdmsetup' works great :)

Sebastian Dröge (slomo)
Changed in dbus:
assignee: nobody → slomo
Revision history for this message
In , Sebastian Dröge (slomo) wrote :

Hi,
the attached piece of code deadlocks when called via sudo but works fine
otherwise. This is probably caused by DBUS_SESSION_BUS_ADDRESS pointing to a
socket for the session bus of the user calling sudo which is not owned by root.

When using dbus_threads_init_default() or not initializing threads at all it
doesn't deadlock but fails gracefully.

Bye

Revision history for this message
In , Sebastian Dröge (slomo) wrote :

Created an attachment (id=7976)
test.c

Revision history for this message
In , Sebastian Dröge (slomo) wrote :

This is btw with dbus 1.0.1 and dbus-glib 0.72.

Changed in dbus:
status: Unknown → Confirmed
Revision history for this message
Amnon82 (amsoft) wrote : Re: apps using dbus hang when runned with sudo

just tested: "sudo dbus-launch nautilus" and it started up nautilus with root rights.
Use this till this bug is fixed.

Revision history for this message
In , Rob Taylor (robtaylor) wrote :

I think J5 mentioned he had a fix for this.

Revision history for this message
In , Johnp-redhat (johnp-redhat) wrote :

One workaround is to use dbus_threads_init_default() instead of
dbus_g_threads_init() since the internal thread implementation uses recursive
threading and glib's uses non-recursive. dbus_g_threads_init should start to
call dbus_threads_init_default() in the future. We should also fix this code to
work with nonrecursive locks by dropping the lock whenever we call functions
outside of bus.c that may call back into bus.c

Changed in dbus:
status: Confirmed → In Progress
Revision history for this message
Emilio Pozuelo Monfort (pochu) wrote : Re: apps using dbus hang when runned with sudo

I can confirm the bug

Revision history for this message
Nemes Ioan Sorin (nemes-sorin) wrote :

I can confirm this bug too on Feisty. And workaround too ( work for me ).

sorin@sorin:~$ nautilius == bash: nautilius: command not found
sorin@sorin:~$ dbus-launch nautilius == OK

sorin@sorin:~$ sudo dbus-launch gdmsetup == OK

Revision history for this message
tokj (tokj-deactivatedaccount) wrote :

> sorin@sorin:~$ sudo dbus-launch application

Yes, actually this is the correct workaround.

In alternative you can use:

$ sudo -i
# application

PS.: "nautilius"? It isn't "nautilus"?

Revision history for this message
Amnon82 (amsoft) wrote :

sudo dbus-launch nautilus
sudo dbus-launch gdmsetup

Works also here on my feisty machine. I confirm this bug too.

Revision history for this message
Gabriel Mazetto (brodock) wrote :

i confirm the bug in Edgy... and also the workaround works well
thanks

Revision history for this message
Jonah (jonah) wrote :

yup i've got the same bug on feisty amd64

Revision history for this message
Sebastian Dröge (slomo) wrote :

Should be fixed or better worked around with 0.72-0ubuntu3 in feisty...

Changed in dbus-glib:
status: Confirmed → Fix Released
Revision history for this message
Matthew East (mdke) wrote :

Is this warning indicative of the same error? I can't open the help button in network-admin as a result:

(yelp:30643): GnomeUI-WARNING **: While connecting to session manager:
Authentication Rejected, reason : None of the authentication protocols specified are supported and host-based authentication failed.

I have 0.72-0ubuntu3. If it's the same bug, please reopen.

Revision history for this message
Sebastian Dröge (slomo) wrote :

No, the session manager is not the same as the dbus session bus... this is a different bug (which I don't have here btw)

Revision history for this message
Richard Kleeman (kleeman) wrote :

gdmsetup now works from the gnome control center (Jan 25). My bug 80738 which was marked as a duplicate of this one is therefore fixed.

Revision history for this message
b0le (joel-boz) wrote :

The same problem also occurs in Gentoo

Revision history for this message
In , Rob Taylor (robtaylor) wrote :

Fixed in git head.

Revision history for this message
Erdal Ronahi (erdalronahi) wrote : Re: apps using dbus hang when runned with sudo

The workaround for gdmsetup does not work for me.

sudo dbus-launch gdmsetup gives the same error message:
Could not access configuration file (custom.conf)

Changed in dbus:
status: In Progress → Fix Released
description: updated
Changed in dbus:
importance: Unknown → High
Changed in dbus:
importance: High → Unknown
Changed in dbus:
importance: Unknown → High
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.