I followed the first and fourth comments of this post but I couldn't install firefox dev.

Actually I don't really know if the browser was installed, every step of the fourth comment seems to work, but when I tried use gksu gedit /usr/share/applications/firefox-dev to create the icon the terminal returned the following error:

Command 'gksu' not found

I search and found out that gksu is deprecated, so one alternative presented was pkexec, and I tried:

pkexec gedit /usr/share/applications/firefox-dev.desktop

The termonal returned this error:

Unable to init server: Could not connect: Connection refused

(org.gnome.gedit:2744): Gtk-WARNING **: 22:07:54.667: cannot open display:

  1. How I make sure that the firefox developer is installed and how do I open it from the terminal?

  2. How to create an executable icon to it?

1 Answer 1


As taliezin answered in https://unix.stackexchange.com/questions/203136/how-do-i-run-gui-applications-as-root-by-using-pkexec I tried and worked fine.

It can be done by adding custom actions to policykit.
If you want to run gedit as root with pkexec you have to create new file /usr/share/polkit-1/actions/org.freedesktop.policykit.gedit.policy for example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
 "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
    <action id="org.freedesktop.policykit.pkexec.gedit">
    <description>Run gedit program</description>
    <message>Authentication is required to run the gedit</message>
    <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/gedit</annotate>
    <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>

Finally pkexec gedit should work as expected.

Read the man pkexec which explains it examples.

  • it didn't worked, I did it but when I tried pkexec agein it returned: ** (org.gnome.gedit:4250): WARNING **: 23:21:33.186: Set document metadata failed: Setting attribute metadata::gedit-position not supported Commented Mar 5, 2020 at 2:23
  • @trayingHardFi, it is only a warning, you can hide this with: askubuntu.com/questions/798935/…
    – danilo
    Commented Mar 5, 2020 at 2:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .