You are not logged in.

#1 2020-09-13 17:25:38

larsbs
Member
Registered: 2016-04-19
Posts: 3

Problems when trying to run xfce apps with sudo

Hello,

I have a fresh install of arch with the xfce4 desktop environment. I haven't done anything special yet, just install xfce4 and lightdm. However, there seems to be something wrong. For example, when I launch an app (like mousepad) from the terminal with the normal user, everything works fine, however, if I try to use `sudo` then, it fails giving me the following error:

Failed to initialize xfconf

and doesn't do anything else. When trying with another app like for example Thunar, I get the same error (and a few additional warnings) but it seems to go further at least and the app opens. Full error:

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


(thunar:614) thunar-WARNING **: 19:03:39.547: Name 'org.xfce.FileManager' lost on the message dbus.

(thunar:614) thunar-WARNING **: 19.03.39.547: Name 'org.freedesktop.FileManager1' lost on the messsage dbus.
ThunarThumbnailer: failed to create proxy: Error spawning command line "dbus-launch --autolaunch=53e0fc2a448442b5b806976d293562el  --binary-syntax --close-stderr": Child process exited with code 1

And I'm worried because that might signal something is not configured correctly but I cannot seem to find what might be. I've tried doing the same on Manjaro since it's based on Arch as well and see if that's a common error but everything works fine there.

Any ideas? Thanks

Last edited by larsbs (2020-09-13 18:16:36)

Offline

#2 2020-09-13 18:17:42

Zod
Member
From: Hoosiertucky
Registered: 2019-03-10
Posts: 377

Re: Problems when trying to run xfce apps with sudo

Did you install and configure sudo?

https://wiki.archlinux.org/index.php/Sudo

Offline

#3 2020-09-13 18:49:01

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 17,426

Re: Problems when trying to run xfce apps with sudo


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Online

#4 2020-09-13 18:59:51

larsbs
Member
Registered: 2016-04-19
Posts: 3

Re: Problems when trying to run xfce apps with sudo

Zod wrote:

Did you install and configure sudo?

https://wiki.archlinux.org/index.php/Sudo

Yes I did and added the regular user to the wheel group.

ewaller wrote:

You may want to look at https://bbs.archlinux.org/viewtopic.php … 28#p999328 or kdesu

I don't fully understand the relation of this with my issue. Could you please explain a bit more so I can better understand? Thanks

What surprises me is that only there doesn't seem to be a lot of info about it so that leads me to think it's a pretty rare issue. And something I've learned about pretty rare issues is that most of the time, they're your own fault.

Offline

#5 2020-09-13 19:19:08

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 5,537
Website

Re: Problems when trying to run xfce apps with sudo

The mousepad package already includes a polkit rule so you can use

pkexec mousepad /path/to/file

Or as a better alternative:

SUDO_EDITOR=mousepad sudoedit /path/to/file

Set $SUDO_EDITOR permanently for your desktop to just use sudoedit(8) for convenience.

For thunar install the gvfs package and use

thunar admin:///full/path/to/location

Offline

#6 2020-09-13 19:21:26

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 17,426

Re: Problems when trying to run xfce apps with sudo

In general, root cannot gain access to the X server session for the user.  Running as sudo that has not been specifically configured won't work (the crux of zod's post)
Running with kdesu alleviates the problem by granting access to the X server session.  The link I provided describes a different method in which you configure polkit to give root permissions to a program run as the user; which also has access to the X server.

kdesu is, in my view, the easiest solution


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Online

#7 2020-09-13 19:49:24

larsbs
Member
Registered: 2016-04-19
Posts: 3

Re: Problems when trying to run xfce apps with sudo

Ok, so I'm getting that what's happening is the correct behavior, but then, I'm really curious about how Manjaro manages to do it(if I do the same on a Manjaro installation everything works fine). Do they somehow manage to give access to X to the root account by some configuration? Thanks to everyone for their help

Offline

Board footer

Powered by FluxBB