Manjaro xfce - Edit As Root in Thunar still set to use gksu instead of pkexec

Hello all,

just FYI: The Thunar filemanager installed in Manjaro xfce from the official repositories, is still configured to use gksu for editing files as root in the right-click menu.

As written here Failed to run meld as root , gksu was removed from the repos but it appears to be still there in a Manjaro install.

However, it has been disabled to some extent:

Unable to init server: Could not connect: Connection refused

(mousepad:30310): Gtk-WARNING **: 17:18:21.251: cannot open display: 

According to information on this forum, gksu should not be used but pkexec.

Fortunately, replacing gksu by pkexec in Thunar seems to work.

I am on Thunar 1.8.16 and I always had pkexec instead of gksu; I installed Manjaro on February 2019.

I installed 20.2:
pkexec thunar %f

I don’t know where you got this from - maybe from a very old iso or from a config file copied over to your installation? - because this isn’t the case, as already mentioned above.

The Xfce edition uses pkexec for the “Thunar Root” custom action for more than two years now.

The original bug report:

The commit that changed this can be found here and the default behavior of the custom action can be found here:

Doesn’t updating Thunar during the regular Manjaro updates also update its config files?
As I did not have changed anything manually yet in Thunar’s config, it should be overwritten by its newest version during an update, or am I mistaken at that point?

$ pacman -Qs Thunar
local/thunar 1.8.16-1 (xfce4)
    Modern file manager for Xfce
local/thunar-volman 0.9.5-3 (xfce4)
    Automatic management of removeable devices in Thunar

Just check the Edit as Root entry.
While Thunar Root indeed is set to use pkexec here as well, for Edit as Root there was still gksu configured.

In Thunar, inside the system’s folders, on the context menu, I don’t have Edit as Root entry. Can you provide a screenshot? Maybe I miss something.

No, package updates don’t and shouldn’t mess with the configuration files in your home directory.

What happens is this: Manjaro offers some default configurations for Thunar (and its custom actions) when you first install the distro, or when you create a new user in the system.
These defaults can be found in the /etc/skel/ directory. The default settings for the custom actions of Thunar are in the file /etc/skel/.config/Thunar/uca.xml. You can also see them online here.
These defaults are copied to your home directory (in ~/.config/Thunar.uca.xml) upon a new system installation or upon a new user creation.
Package updates don’t touch this file, only you can edit it.

There is no such action as Edit as Root in the defaults (see the link above), so to answer your question: Manjaro doesn’t set such an action by default, maybe it did in the past but not anymore.

The fact that you have this custom action in the configuration file of Thunar in your home directory ~/.config/Thunar.uca.xml means either that this configuration was part of Manjaro in the past and you keep using an old configuration file in your home directory, or that you have copied it over to your home directory from an other installation. Or maybe you manually added it to Thunar - there are some instructions here which seem to be outdated since they use gksu.

The bottom line is that after using a distribution for a long period of time, it’s the user’s responsibility to keep their home directory “clean”, or to keep up with the changes made to packages and their config files.
Just like by doing this from your side:

Hope that helps.

1 Like

[Stable Update] 2018-05-07 - | archived.forum.manjaro.org
gksu is now depreciated and therefore removed. Please use polkit.

This post from archived forum mentions Thunar Edit as Root added to Thunar by user
How to replace gksu with zensu or gksu-polkit
I think this custom action was a thing from other XFCE distributions that users would add to Manjaro

1 Like

Thanks a lot for this explanation. I can’t remember having edited Thunar’s configuration, that’s why I was asking.
Looks like this is indeed some remnant from my initial installation that happened quite some time ago :slight_smile:

Thanks also for the information that gksu is a link to gksu-polkit now.
That makes me curious: What causes the error

Unable to init server: Could not connect: Connection refused

(mousepad:30310): Gtk-WARNING **: 17:18:21.251: cannot open display: 

when invoking gksu-polkit?

1 Like

If something isnt fully polkit compatible it can have problems like that.
Besides which normally we dont want to actually start something using polkit … a text editor like kate for example is just used normally … then prompts for polkit actions if admin privileges are needed.

Same for gufw (but we patched it)
So a similar thing might work for mousepad, ie:

  • First check just editing/saving a file somewhere requiring credentials.

  • Then if this doesnt work:

pkexec mousepad
  • then maybe this will:
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY mousepad
1 Like

We don’t update user modified config files at all. It is your job to migrate to upstream changes we make.

1 Like
1 Like

I have a newer install, so Thunar Root Custom Action was already using pkexec, which I also see in /etc/skel/.config/Thuar/uca.xml.

Would it be helpful to end users (i.e., go and look and possibly take action) if there is a .pacnew when the skel file changes.

I was wondering, any tips on how to best find these changes so action can be taken?

Just think’n out loud:

  • Compare /etc/skel/.config/* with $HOME/.config/
    I realize there will be a lot of user customization, so that’ll have to be handled.
  • Read application changelog (pacman -Qc thunar # no changelog available)
  • Read changelog at application’s home page, in this case xfce
  • Read git commits
  • Read the category Announcements
  • Fix it when it breaks :slight_smile:
  • All of the above