Bug 299718 - Unable to run graphical applications from policykit
Summary: Unable to run graphical applications from policykit
Status: RESOLVED DOWNSTREAM
Alias: None
Product: kdm
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR major
Target Milestone: ---
Assignee: kdm bugs tracker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-10 06:21 UTC by Daniel Richter
Modified: 2012-05-10 18:27 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Richter 2012-05-10 06:21:13 UTC
My application needs administrative permissions to run (it's a tool to modify
the grub 2 settings). 6 month ago or so I decided to switch from su-to-root (a
script runs the best matching graphical sudo agent) to policykit. I've set up
an action for my application containing the key
"org.freedesktop.policykit.exec.allow_gui".

When using GDM as display manager everything works well, but when using KDM I
got the message:

No protocol specified
No protocol specified

(grub-customizer:2002): Gtk-WARNING **: cannot open display: :0


…when trying to launch it using `pkexec grub-customizer`. I just had to install
and run GDM -> login (still using KDE as desktop environment), then it works
well.

Also I saw some workaround of the ubuntu devs to make synapic runnable on
kubuntu. They solved it by setting the flag "X-KDE-SubstituteUID=true" as
option into the .desktop to use the KDE specific authorization method. I did
the same as it's an easy change, however I think this cannot be the final way
to fix this problem. The problem is not Kubuntu specific as I saw the same
problem on magaia.

Also I tried theese commands:
$ su -
# grub-customizer

doesn't work (same error like when using policykit)

$ sudo -i
# grub-customizer

doesn't work (same error like when using policykit)

$ sudo -s
# grub-customizer

works

$ xhost +
$ pkexec grub-customizer

works

initial bug: https://bugs.freedesktop.org/show_bug.cgi?id=49707

Reproducible: Always

Steps to Reproduce:
1. create a policykit action containing <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate> and the path to the graphical application you want to try
2. run this applicatiion using `pkexec YOUR_APPLICATION`
3. run GDM and login from this display manager (session type KDE is ok). Then try step 2 again.
Actual Results:  
on KDM I get the errors, GDM works well

Expected Results:  
KDM should work well too ;-)
Comment 1 Oswald Buddenhagen 2012-05-10 06:35:56 UTC
it works with gdm (unless you use su -), because it always sets the XAUTHORITY environment variable and root can simply read the pointed-to file. but that's not the right answer.
what you really want is adding
   session    optional   pam_xauth.so
to your /etc/pam.d/ su and sudo. modern distributions do that for you.
Comment 2 Simple 2012-05-10 18:27:04 UTC
In Mageia the file /etc/pam.d/su contains "session optional pam_xauth.so" and the problem remains when runing grub-customizer as a regular user, polit it asks to enter a password but then does not run grub-customizer.

The only way to run it is to "su" or "su -", still when running with "su" it says cant connect to dbus but does run it:

]# grub-customizer 

(grub-customizer:7672): GVFS-RemoteVolumeMonitor-WARNING **: cannot connect to the session bus: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
 *** initializing (w/o specified bootloader type)…