! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
thunar root - error
Status:
RESOLVED: FIXED

Comments

Description joksik83 2017-09-25 10:47:48 CEST
i use latest thunar from git. when i want run thunar with root privilege i always run: gksudo thunar or pkexec thunar in both cases i have the same error:

gksudo thunar

(thunar:6536): GLib-GIO-CRITICAL **: g_dbus_proxy_new_sync: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(thunar:6536): thunar-CRITICAL **: Name 'org.xfce.FileManager' lost on the message dbus, exiting.
ThunarThumbnailer: failed to create proxy: Błąd podczas wywoływania wiersza poleceń „dbus-launch --autolaunch=0f33a3b91c4f4d018354b970613911f1 --binary-syntax --close-stderr”: Proces potomny został zakończony z kodem 1
Comment 1 joksik83 2017-09-25 10:50:05 CEST
pkxec show more info

pkexec thunar
Thunar: Failed to initialize Xfconf: Error spawning command line ?dbus-launch --autolaunch=0f33a3b91c4f4d018354b970613911f1 --binary-syntax --close-stderr?: Child process exited with code 1


(thunar:6636): GLib-GIO-CRITICAL **: g_dbus_proxy_new_sync: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(thunar:6636): thunar-CRITICAL **: Name 'org.xfce.FileManager' lost on the message dbus, exiting.
ThunarThumbnailer: failed to create proxy: Błąd podczas wywoływania wiersza poleceń „dbus-launch --autolaunch=0f33a3b91c4f4d018354b970613911f1 --binary-syntax --close-stderr”: Proces potomny został zakończony z kodem 1
Comment 2 Bernhard Landauer 2017-09-27 01:13:22 CEST
What works for me is:

gksu dbus-launch thunar
Comment 3 Andre Miranda editbugs 2017-10-05 04:36:19 CEST
Created attachment 7342 
an ugly workaround

I'm not sure if just skipping the name registration is the correct fix.
Comment 4 joksik83 2017-10-05 08:40:37 CEST
on manjaro board they advised to install dbus-X11 it also fix the problem so now i dont know is this a bug in thunar or maybe only not installed all needed package?
Comment 5 Andre Miranda editbugs 2017-10-06 03:24:31 CEST
This behavior of exit if fails to register the dbus name was introduced recently and the use case for root user was overlooked, not really a bug yet since we haven't released a development version of Thunar. Let's see if it's possible to just launch sudo thunar as before and avoid the use of dbus-launch and similar approaches.
Comment 6 Git Bot editbugs 2017-11-22 04:47:03 CET
Andre Miranda referenced this bugreport in commit b1af81ca05f0ef0310b1eddac410c2650ef89305

Allow Thunar run with sudo as before (Bug #13884)

https://git.xfce.org/xfce/thunar/commit?id=b1af81ca05f0ef0310b1eddac410c2650ef89305
Comment 7 Andre Miranda editbugs 2017-11-22 04:48:23 CET
I've pushed the fix to master, but I'll let this bug open just in case it causes any trouble.
Comment 8 Andre Miranda editbugs 2018-06-08 04:09:44 CEST
So far haven't noticed any issue and no one complained, closing..
Comment 9 guy.b 2019-10-05 08:43:39 CEST
Hi,

Please re open this bug because it's not solved at all, details on Arch up to date :

Installed packages :

thunar 1.8.9-2
dbus 1.12.16-2
python-dbus 1.2.8-2
python-dbus-common
polkit 0.116-2
aur/xfce-polkit 0.3-1

Result of pkexec thunar :

Thunar: Failed to initialize Xfconf: Error spawning command line ?dbus-launch --autolaunch=a69a0452d6474191bf0feb1dbf827eb3 --binary-syntax --close-stderr?: Child process exited with code 1


(thunar:12173): thunar-WARNING **: 08:20:38.410: Nom « org.xfce.FileManager » perdu sur le message dbus.

(thunar:12173): thunar-WARNING **: 08:20:38.410: Nom « org.freedesktop.FileManager1 » perdu sur le message dbus.
ThunarThumbnailer: failed to create proxy: Erreur lors de la génération de la ligne de commande « dbus-launch --autolaunch=a69a0452d6474191bf0feb1dbf827eb3 --binary-syntax --close-stderr » : Le processus fils s’est terminé avec le code 1

It open in a reduced window, doesn't generate any thumbnails and doesn't save any settings.

I'm using startx without any DM installed. Let me know if you need more informations.

Thanks.
Comment 10 Andre Miranda editbugs 2019-10-09 06:21:41 CEST
The fix mentioned here was reverted by the one from Bug #15149.
My dbus knowledge is far from great, so I don't know how apps running as root should handle name registration.

FWIW I see a similar problem when running pkexec nemo, and nautilus won't even launch (cannot open display).
Comment 11 guy.b 2019-10-09 09:00:21 CEST
I see... 

Maybe a good opportunity to ask directly on https://gitlab.freedesktop.org/dbus/dbus and mention this behavior ?
Comment 12 Andre Miranda editbugs 2019-11-06 02:52:47 CET
(In reply to guy.b from comment #9)
> It open in a reduced window, doesn't generate any thumbnails and doesn't
> save any settings.
It happens because xfconf, xfsettingsd and tumbler are not registered to root's dbus session. They also won't work with pkexec, sudo or gksudo. Like I said, Nemo and Nautilus also can't work with dbus in this setting.

(In reply to guy.b from comment #11)
> Maybe a good opportunity to ask directly on
> https://gitlab.freedesktop.org/dbus/dbus and mention this behavior ?
I tried my best to look at their documentation whether this use case is supported and searched for any app that supports it, no success. For this reason I can't really file a bug for something I'm not sure it's a defect. If you can volunteer to ask about this, please go ahead. If you also know of any app that is able to register a dbus name when run via pkexec also let us know.
Comment 13 guy.b 2019-11-06 08:26:08 CET
Hi,

As far as I remember Thunar was able to perfectly deal with pkexec/dbus, saving settings etc. Suddenly got broken by an update, fixed and by an update, and broken since by another (Thunar or dbus ?) update. 

At that time I was under Antergos os which is now dead. Unfortunately I can't find my bug report from that time because the forum is now closed.

Anyway, I will try to get the info from dbus as soon as I can and post the result.

Yes, I know an app that deals without any pkexec/dbus errors, it's Geany the file editor.
Comment 14 Andre Miranda editbugs 2019-12-21 18:41:18 CET
(In reply to guy.b from comment #13)
> Hi,
> 
> As far as I remember Thunar was able to perfectly deal with pkexec/dbus,
> saving settings etc. Suddenly got broken by an update, fixed and by an
> update, and broken since by another (Thunar or dbus ?) update.
That was probably Thunar 1.6.x, it uses dbus-glib instead of GDBus[1].

> Yes, I know an app that deals without any pkexec/dbus errors, it's Geany the
> file editor.
Doesn't work for me:
pkexec geany
Unable to init server: Could not connect: Connection refused
Geany: cannot open display

1 - https://git.xfce.org/xfce/thunar/commit/?id=4ce7c64
Comment 15 guy.b 2019-12-21 19:26:43 CET
(In reply to Andre Miranda from comment #14) 
> Doesn't work for me:
> pkexec geany
> Unable to init server: Could not connect: Connection refused
> Geany: cannot open display
> 
> 1 - https://git.xfce.org/xfce/thunar/commit/?id=4ce7c64

pkexec geany probably doesn't work because you need to create the file /usr/share/polkit-1/actions/org.freedesktop.geany.policy (here on Archlinux) which contains :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
 "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
<policyconfig>
  <vendor>geany</vendor>
  <vendor_url>https://www.geany.org/</vendor_url>
  <icon_name>geany</icon_name>
  <action id="org.freedesktop.policykit.pkexec.geany">
   <description>Run "geany"</description>
   <message>Authentication is required to run geany</message>
   <defaults>
     <allow_any>auth_admin</allow_any>
     <allow_inactive>auth_admin</allow_inactive>
     <allow_active>auth_admin</allow_active>
   </defaults>
     <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/geany</annotate>
     <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
   </action>  
</policyconfig>

Bug #13884

Reported by:
joksik83
Reported on: 2017-09-25
Last modified on: 2019-12-21

People

Assignee:
Andre Miranda
CC List:
5 users

Version

Attachments

an ugly workaround (566 bytes, patch)
2017-10-05 04:36 CEST , Andre Miranda
no flags

Additional information