My default Desktop Environment on Arch Linux is XFCE4. It’s lightweight, fast and easy to use. I faced with many problem during working process, so I wrote them here to share how to fix it with you, hope they are useful and help you solve your issue.
Thunar doesn’t save preferences when running with root privilege
At this time,
gksudo is deprecated, so we’re using
pkexec instead. Like others, I run
Thunar with root privilege frequently for many purposes. I create a custom action to quickly run root Thunar with right-click context menu. One day, I found it’s not saved any personal settings, it’s always appeared with default settings everytime I ran it. To find the cause of that problem, I tried to run it via Terminal:
$ pkexec thunar thunar: Failed to initialize Xfconf: Error spawning command line ?dbus-launch --autolaunch=612b69cd90a747df892ae687331db46d --binary-syntax --close-stderr?: Child process exited with code 1 (thunar:9498): thunar-WARNING **: 10:27:53.857: Name 'org.xfce.FileManager' lost on the message dbus. (thunar:9498): thunar-WARNING **: 10:27:53.857: Name 'org.freedesktop.FileManager1' lost on the message dbus. ThunarThumbnailer: failed to create proxy: Error spawning command line “dbus-launch --autolaunch=612b69cd90a747df892ae687331db46d --binary-syntax --close-stderr”: Child process exited with code 1
With the debug messages above, I find the cause of this problem that was described in pkexec manual:
pkexec will not by default allow you to run X11 applications as another user since the $DISPLAY and $XAUTHORITY environment variables are not set. These two variables will be retained if the org.freedesktop.policykit.exec.allow_gui annotation on an action is set to a nonempty value; this is discouraged, though, and should only be used for legacy programs.
After spend a lot of time to look around, I found the solution below:
- Add a xml file that define how to run gui apps with root privilege at the location:
- This file above give you policykit authentication for
thunar, to make another app is runable with
pkexec, just define it into that file.
<?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/policyconfig.dtd"> <policyconfig> <action id="org.freedesktop.policykit.pkexec.run-thunar"> <description>Run Thunar</description> <message>Authentication is required to run Thunar as Root</message> <defaults> <allow_any>no</allow_any> <allow_inactive>no</allow_inactive> <allow_active>auth_admin_keep</allow_active> </defaults> <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/thunar</annotate> <annotate key="org.freedesktop.policykit.exec.allow_gui">TRUE</annotate> </action> </policyconfig>
gpg: WARNING: unsafe permissions on homedir
I got this error message after transfer all the files in the
home folder to new machine: Huawei Matebook D15. I guess the permission of files and folders in
.gnupg is the cause of this problem. After double check the source, I knew it’s right. Here is the solution to fix it.
$ chmod 700 /home/username/.gnupg && chmod 600 /home/username/.gnupg/*
By default, the gnupg directory has its permissions set to
700 and the files it contains have their permissions set to
Also check the ownership of the directory, it should be owned by the same user that will be running gpg at the command line. Only the owner of the directory has permission to read, write, and access the files. This is for security purposes and should not be changed.
Make sure that the .gnupg directory and its contents is accessibile by your user.
$ chown -R $(whoami) ~/.gnupg/
In case this directory or any file inside it does not follow this security measure, you will get warnings about unsafe file and home directory permissions.
gpg: keyserver refresh failed: General error
If you got the error message above, may be the GNUPG keyservers do not appear to work due to networking issue. Change to another keyservers is the easiest way to fix it.
$ gpg --refresh-keys --keyserver hkp://keyserver.ubuntu.com:80
These are some keyservers that are often used for looking up keys with
gpg --recv-keys. These can be queried via
https:// (HTTPS) or
hkps:// (HKP over TLS) respectively.