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.
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...
$ 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
btw.: after using "xhost +": "su -" and "sudo -i" are working too
all the su** combinations are running fine when using GDM (without executiong xhost + before)
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.
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.