Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I performed a fresh install of Lubuntu 12.04 with minimal desktop, as described here.

To clarify, I did a command-line install from the Lubuntu alternative install disc, then I did an apt-get install --no-install-recommends lubuntu-desktop.

Everything is working fine, except that Synaptic will not run from the menu entry in the panel. I am not prompted for a password, and no window of any sort appears after clicking the menu entry. I installed lxshortcut to see what the shortcut was running, and the command is synaptic-pkexec. If I type this command into the "Run" menu, I get the same behavior (or lack thereof).

I can get Synaptic to open up just fine by typing gksudo synaptic at the "Run" menu. Also, if I run "synaptic-pkexec" from the terminal, then I am prompted for my password within the terminal, and after that Synaptic opens normally.

Can someone please suggest the right way to get Synaptic working? I could just change the menu entry to "gksudo synaptic", but I'm guessing that it's set to synaptic-pkexec for a reason. I have a vague understanding that this pkexec business has something to do with PolicyKit, but I don't really know what PolicyKit is or how to tell if something is broken with it.

share|improve this question
    
This was a bug in Ubuntu 11.10, same exact scenario... it's discussed here - ubuntuforums.org/showthread.php?t=1827093 Maybe running an update would resolve it? –  Corey Whitaker Jul 10 '12 at 14:20
    
Can you start synaptic from terminal ? If you can't , enter output in here. –  alireza.m Jul 10 '12 at 14:20
    
Thanks for the link. According to that thread, the bug was fixed in synaptic-0.75.2ubuntu6. Running "apt-cache policy synaptic" says I have 0.75.9ubuntu1 installed. "apt-get update && apt-get dist-upgrade" says I'm fully up to date. –  ven42 Jul 10 '12 at 15:05
    
Try re-installing Synaptic. –  tijybba Jul 10 '12 at 15:41
    
Just tried "apt-get install --reinstall synaptic". The process completed successfully, but it did not change the behavior of synaptic. The problem still exists, I'm afraid. –  ven42 Jul 10 '12 at 15:49
show 2 more comments

2 Answers

up vote 2 down vote accepted

It turns out that I needed to install the policykit-1-gnome package. Once I installed this package and rebooted, Synaptic worked normally.

I installed the complete Lubuntu desktop in a VM for comparison with my minimal installation, and that's how I discovered what was missing. According to the package description:

PolicyKit-gnome provides a D-Bus session bus service that is used to bring up authentication dialogs used for obtaining privileges.

Obviously, without the described functionality, I was never going to get a GUI authentication prompt to open Synaptic.

synaptic is a dependency of the lubuntu-desktop metapackage, so it was installed by default in my minimal installation. Shouldn't policykit-1-gnome be a dependency of lubuntu-desktop as well, since Synaptic won't work without it? Do you think I should report a bug?

share|improve this answer
    
Excellent work tracking down the cause of the problem! And yes, I think you should report this as a bug. My Lubuntu systems installed from the Lubuntu desktop CD don't have this problem; they probably come with policykit-1-gnome installed separately from any other packages. It's set to manually installed (and I didn't install it myself). If you report a bug, please update your answer with the bug link. –  Eliah Kagan Jul 12 '12 at 0:23
1  
I'm getting this exact same problem running a minimal install of ubuntu using standalone compiz session with Unity. Thing is, I have policykit-1-gnome installed, but its still not working. –  thelaststud Aug 17 '12 at 10:52
add comment

I had this same problem with Synaptic and GParted not launching from the lxpanel menu. The problems appeared after an upgrade to lubuntu 13.10 (Saucy Salamander) which resulted in a slew of authentication errors while logged in to vanilla LXDE (See This operation cannot continue since proper authorization was not provided). After running sudo dpkg-reconfigure gdm and selecting lightdm as my default display manager, the symptoms in this post title appeared.

I found info related to this issue to be outdated and scattered so here are some more details about this display manager issue along with some alternative solutions to suit your needs or preference. I can also confirm that the previously selected answer worked for me while testing.

Solution

This was ultimately fixed by going to the menu > Preferences > Default applications for LXSession (or run from terminal with lxsession-default-apps). In the first section "Running applications", go to the option for Polkit agent and make sure lxpolkit is selected. Click Apply and Reload.

Instead of using the package policykit-1-gnome, lxsession will use the LXPolkit for LXDE.

From LXPolkit – Simple policykit authentication agent:

Generally when one needs to use policykit, he or she needs to install policykit-gnome. Now we have our own. A new component LXPolkit was added. It’s minimal policykit authentication agent.

LXPolkit screenshot

Why Synaptic and GParted Are Not Launched or Run From the LXDE Menu

It comes down to the way apps in the X11 system are launched with pkexec.

The apps that appear in the lxpanel menu are stored and configured in either /usr/share/applications (global menus items) or ~/.local/share/applications (user specific). See LXDE Wiki - Main Menu

In these directories you will find a .desktop file for each of the applications appearing in your menu. Here is an example of /usr/share/applications/synaptic.desktop:

[Desktop Entry]
Name=Synaptic Package Manager
GenericName=Package Manager
Comment=Install, remove and upgrade software packages
Exec=synaptic-pkexec
Icon=synaptic
Terminal=false
Type=Application
Categories=PackageManager;GTK;System;Settings;
NotShowIn=KDE;
X-Ubuntu-Gettext-Domain=synaptic

Notice the line Exec=synaptic-pkexec.

Excerpt from the manual PKEXEC(1) - Security Notes

pkexec will not allow you to run X11 applications as another user since the $DISPLAY and $XAUTHORITY environment variables are not set.

Hence, why you need to make sure you are using the lxpolkit or, if using the gnome PolicyKit, install the package policykit-1-gnome which launches the login menu when pkexec is used. I have removed the package policykit-1-gnome and using lxpolkit alone appears to work well.

Alternative Solutions

Use gksudo Instead of pkexec
You could right-click applications like synaptic in the menu, click Properties, and change the Command field from synaptic-pkexec to gksudo synaptic. Or via command line, copy the original file to your user's applications directory with sudo cp /usr/share/applications/synaptic.desktop ${HOME}/.local/share/applications/synaptic.desktop

Then edit the line Exec=synaptic-pkexec and replace it with Exec=gksudo synaptic

gksudo's "primary purpose is to run graphical commands that need root without the need to run an X terminal emulator and using su directly." - GKSU(1)

And for good reason! See Running Sudo Graphically.

This of course requires that every application relying on pkexec be edited to launch with gksudo which requires more work on your part if you're using lxpanel. A nice comparison of security and usability features for gksudo and PolicyKit can be found at Comparison of privilege authorization features.

ADVANCED - Write Your Own Policy
This is more than I want to do, but it may be useful in some situations. I don't recommend doing this without a strong understanding of writing PolicyKit Actions.

The actions available to you via polkit will depend on the packages you have installed. Some are used in multiple desktop environments (org.freedesktop.), some are DE-specific (org.gnome.) and some are specific to a single program (org.archlinux.pkexec.gparted.policy). The command pkaction lists all the actions defined in /usr/share/polkit-1/actions for quick reference.

Here's an example, which I have not tested, from City-busz -Using 'pkexec' command instead of 'gksu':

E.g. if you want to run gparted as root with

$ pkexec gparted

command, then create a new file

/usr/share/polkit-1/actions/org.freedesktop.policykit.pkexec.policy

with the following content:

<?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-gparted">
    <description>Run GParted</description>
    <message>Authentication is required to run GParted</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/sbin/gparted</annotate>
    <annotate key="org.freedesktop.policykit.exec.allow_gui">TRUE</annotate>
  </action>

</policyconfig>

More actions can be added into the same file.

Hat tip to renegat at archlinux.org for compiling relevant excerpts from related LXDE and PolicyKit documentation that ultimately led me to using LXPolkit as the preferred solution.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.