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: 636

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: 20,393

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
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#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: The Wirral
Registered: 2014-02-20
Posts: 8,842
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

Jin, Jîyan, Azadî

Offline

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

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,393

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
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#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

#8 2025-05-30 10:07:40

tornandbroken
Member
Registered: 2025-05-30
Posts: 1

Re: Problems when trying to run xfce apps with sudo

I also don't know what's going on but sudo pacman -S xorg-xhost solved that problem

You can activate that service with the command xhost + after every reboot everything is like before if you want to activate it permanetely you must add to any autostart config

byebye

Offline

#9 2025-05-30 14:21:22

seth
Member
Registered: 2012-09-03
Posts: 64,243

Re: Problems when trying to run xfce apps with sudo

I also don't know what's going on but sudo pacman -S xorg-xhost solved that problem

No, it only created more.
Don't do that. The proper approach here is sudoedit. Don't run GUI stuff as root.

Offline

#10 2025-05-30 17:31:36

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,806
Website

Re: Problems when trying to run xfce apps with sudo

seth wrote:

Don't run GUI stuff as root.

Quoting for emphasis.

Also closing for necromancy.

https://wiki.archlinux.org/title/Genera … bumping%22


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB