Bug 49707 - Unable to run graphical applications when using KDM
Summary: Unable to run graphical applications when using KDM
Status: RESOLVED DUPLICATE of bug 51623
Alias: None
Product: PolicyKit
Classification: Unclassified
Component: daemon (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: David Zeuthen (not reading bugmail)
QA Contact: David Zeuthen (not reading bugmail)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-09 14:22 UTC by Daniel Richter
Modified: 2012-09-08 22:59 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
My policykit action file (769 bytes, application/octet-stream)
2012-05-09 14:22 UTC, Daniel Richter
Details

Description Daniel Richter 2012-05-09 14:22:40 UTC
Created attachment 61313 [details]
My policykit action file

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.
Comment 1 David Zeuthen (not reading bugmail) 2012-05-09 14:42:50 UTC
Not exactly sure why you think this is a problem with pkexec(1) - looks to me like KDM is busted in how it launches the X server - maybe in a way so other users, including uid 0, can't connect to it? For example, does "su -" to root and then launching a graphical program even work? Does it work if you do "xhost +" before running pkexec? I would ask the KDM developers about this.

Either way, since this works under GDM it shows that DISPLAY and XAUTHORITY is being propagated into the child process (otherwise GTK apps wouldn't work) and that your .policy file is correct. So sounds like this is NOTOURBUG...
Comment 2 Daniel Richter 2012-05-09 14:56:20 UTC
$ 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
Comment 3 Daniel Richter 2012-05-09 15:05:48 UTC
btw.: after using "xhost +": "su -" and "sudo -i" are working too
Comment 4 Daniel Richter 2012-05-09 15:12:26 UTC
all the su** combinations are running fine when using GDM (without executiong xhost + before)
Comment 5 David Zeuthen (not reading bugmail) 2012-05-09 17:19:03 UTC
Thanks for investigating. Seems like either KDM or the desktop environment need to allow uid 0 to connect to the X server then (through e.g. running 'xhost +root'). Kinda weird that it isn't set up this way already. Anyway, closing NOTOURBUG as it is not a pkexec(1) or polkit bug.
Comment 6 Peter Wu 2012-09-08 22:59:39 UTC
Hmm, I intended to post the patch from bug #51623 here, but did it the other way round. Anyway, both bugs have the same root issue so closing as dupe.

*** This bug has been marked as a duplicate of bug 51623 ***


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.