pkexec fails to launch apps as root

Questions about software.
dclement
Posts: 32
Joined: 14 Mar 2013 10:34
Location: France

pkexec fails to launch apps as root

Postby dclement » 27 May 2019 18:00

Hi all,

I think that something has gone slightly wrong with a recent update, though I can't tell you which one right now, (I have another PC at work which lags a little behind on updates, so maybe I could be more precise tomorrow.)

I noticed --just today-- that all my launchers which run programs as super-user (e.g. synaptic, gparted...) have stopped working.

Since the command is typically program_name-pkexec, I tried from a terminal. The output is like that;

Code: Select all

daniel@e6330d:~$ gparted-pkexec
Cannot find diversion for /usr/bin/pkexec - exiting
OTTH, gksu gparted or sudo gparted do work. So I'm using these as a workaround, but is there something I could do for a global fix?

TIA for any help - best regards, Daniel

User avatar
Arjen Balfoort
Site Admin
Posts: 9223
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: pkexec fails to launch apps as root

Postby Arjen Balfoort » 27 May 2019 20:24

Please check that you have the same output as I have with the following commands:

Code: Select all

$ apt policy solydxk-system
solydxk-system:
  Installed: 3.3.2
  Candidate: 3.3.2
  Version table:
 *** 3.3.2 600
        600 https://repository.solydxk.com solydxk-9/main amd64 Packages
        600 https://repository.solydxk.com solydxk-9/main i386 Packages
        100 /var/lib/dpkg/status

Code: Select all

$ dpkg -S /usr/bin/pkexec
diversion by solydxk-system from: /usr/bin/pkexec
diversion by solydxk-system to: /usr/bin/pkexec.divert
solydxk-system, policykit-1: /usr/bin/pkexec

Code: Select all

$ ls /usr/bin | grep ^pkexec
pkexec
pkexec.divert
If not, something went wrong with your update of solydxk-system.
Try to reinstall it:

Code: Select all

apt update
apt reinstall solydxk-system


SolydXK needs you!
Development | Testing | Translations

dclement
Posts: 32
Joined: 14 Mar 2013 10:34
Location: France

Re: pkexec fails to launch apps as root

Postby dclement » 28 May 2019 05:58

Hi, thanks for replying so quickly. The 1st and 3rd commands yield the very same output as yours.

The 2nd one, however, gives a slightly different result:

Code: Select all

$ dpkg -S /usr/bin/pkexec
détournement par solydxk-system depuis : /usr/bin/pkexec
détournement par solydxk-system en : /usr/bin/pkexec.divert
policykit-1, solydxk-system: /usr/bin/pkexec
Apart from the French translation, the order of policykit-1 and solydxk-system is reversed. Could this be the culprit?

I must add 2 more things:
- reinstalling solydxk-system, unfortunately, doesn't help: the output of this 2nd command remains the same afterwards, and the pkexec error remains.
- I'm facing this pkexec error on 2 home PCs. While I remember having a problem (the one I described here) during a recent update on one of them, I'm fairly certain the update went well on the other one.

There's another PC with Solydx installed at work, I'll go and check it this morning.

User avatar
grizzler
Posts: 2139
Joined: 04 Mar 2013 15:45
Location: The Hague, NL

Re: pkexec fails to launch apps as root

Postby grizzler » 28 May 2019 07:40

dclement wrote:
28 May 2019 05:58
The 1st and 3rd commands yield the very same output as yours.

The 2nd one, however, gives a slightly different result:
Same here. And the same problem with GParted.
This bit in .xsession-errors may be relevant:

Code: Select all

localuser:root being added to access control list
/usr/bin/env: ‘--disable-internal-agent’: Bestand of map bestaat niet
localuser:root being removed from access control list
Look at line 78 of /usr/sbin/gparted.
I think the diversion of pkexec needs work.
Frank

SolydX EE 64 - tracking Debian Testing

dclement
Posts: 32
Joined: 14 Mar 2013 10:34
Location: France

Re: pkexec fails to launch apps as root

Postby dclement » 28 May 2019 08:44

Small update: I'm now in front of the desktop PC at work.

The pkexec programs work well here (Synaptic, Gparted...)

But this PC has not received these 3 latest updates yet:
- wpasupplicant-2:2.4-1+deb9u4
- solydxk-system-3.3.2
- solydxk-welcome-1.7.0

Otherwise, the set of installed packages is pretty much the same as on my home PCs.

User avatar
Arjen Balfoort
Site Admin
Posts: 9223
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: pkexec fails to launch apps as root

Postby Arjen Balfoort » 28 May 2019 10:17

Arrrrr! That was a localization issue.

I've updated solydxk-system to version 3.3.3.

Could you try that?

Code: Select all

apt update
apt install solydxk-system
Tested on SolydX 10 with French localization:
pkexec gparted: gave the error
updating solydxk-system to v3.3.3
pkexec gparted: starts normally


SolydXK needs you!
Development | Testing | Translations

dclement
Posts: 32
Joined: 14 Mar 2013 10:34
Location: France

Re: pkexec fails to launch apps as root

Postby dclement » 28 May 2019 11:04

Confirmed! With solydxk-system version 3.3.3, gparted and other apps using pkexec now start normally again.

Many thanks for your help. BR, Daniel

[edit] grizzler, is it OK for you too? Can I mark the thread as solved?

dclement
Posts: 32
Joined: 14 Mar 2013 10:34
Location: France

Re: pkexec fails to launch apps as root

Postby dclement » 28 May 2019 11:23

Humm, I spoke too fast. I was testing from command line as super-user... Without that:

Code: Select all

$ pkexec gparted
pkexec must be setuid root
and of course sudo pkexec gparted (or sudo gparted-pkexec) works.

Moreover,

Code: Select all

$ dpkg -S /usr/bin/pkexec
détournement par solydxk-system depuis : /usr/bin/pkexec
détournement par solydxk-system en : /usr/bin/pkexec.divert
policykit-1, solydxk-system: /usr/bin/pkexec
is the same as before.

And indeed, the launchers in the menu (which use "gparted-pkexec" as a command) still fail.

Sorry for being too quick on the keyboard...

User avatar
Arjen Balfoort
Site Admin
Posts: 9223
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: pkexec fails to launch apps as root

Postby Arjen Balfoort » 28 May 2019 12:21

I noticed that the launcher didn't work also.
I've updated solydxk-system again.

I don't know what happens with the setuid message. I haven't seen it.
Maybe this helps:

Code: Select all

ls -al /usr/bin/pkexec.divert
should say:

Code: Select all

-rwsr-xr-x 1 root root 23352 Dec  6 18:34 /usr/bin/pkexec.divert
Notice the 's' in '-rwsr'.
If it is not:

Code: Select all

sudo chmod u+s /usr/bin/pkexec.divert

The dpkg command looks good.

The launcher now works.


SolydXK needs you!
Development | Testing | Translations

dclement
Posts: 32
Joined: 14 Mar 2013 10:34
Location: France

Re: pkexec fails to launch apps as root

Postby dclement » 28 May 2019 13:09

I took the time to double-check everything this time, on both my home PCs for good measure. Both are back to normal, though for different reasons:

1st PC (main PC): after updating solydxk-system to version 3.3.4, the launchers resumed working straightforwardly. (Oddly enough, on this PC, the dpkg -S /usr/bin/pkexec command still gives policykit-1, solydxk-system (in reversed order)--but the result of ls -al /usr/bin/pkexec.divert is as expected.)

2nd PC (secondary PC): on this one, even after updating solydxk-system, the launchers would not work. I had tampered with them initially (replacing e.g. gparted-pkexec with gksu gparted), before restoring them to their defaults. For this reason or another, the output of ls -al /usr/bin/pkexec.divert was -rwr-xr-x etc. (missing the "s"). After executing the sudo chmod u+s /usr/bin/pkexec.divert command, everything went back to normal. And on this PC, dpkg -S /usr/bin/pkexec lists solydxk-system and policykit-1 in the proper order!

I guess I can now update the PC at work to solydxk-system v. 3.3.4 and mark this thread solved. Thanks again!

User avatar
Arjen Balfoort
Site Admin
Posts: 9223
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: pkexec fails to launch apps as root

Postby Arjen Balfoort » 28 May 2019 14:26

Well, now a user reported issues somewhere else: viewtopic.php?t=7540&p=70153

So, I reverted everything back the way it was.

We probably will find issues with some X11 applications but we will tackle them later when it comes to that.

Code: Select all

apt update
apt install solydxk-system


SolydXK needs you!
Development | Testing | Translations

User avatar
grizzler
Posts: 2139
Joined: 04 Mar 2013 15:45
Location: The Hague, NL

Re: pkexec fails to launch apps as root

Postby grizzler » 28 May 2019 14:40

Thanks. i was already looking for a way to 'tactfully' tell you diverting pkexec was a bad idea... :lol:

Seriously though, I think using an action definition file with the proper '...exec.allow_gui' line is a better solution, even if the polkit docs say this should be discouraged and only used for legacy applications. If a gui app needs root, then lets just call it a legacy app and be done with it.
Frank

SolydX EE 64 - tracking Debian Testing

User avatar
grizzler
Posts: 2139
Joined: 04 Mar 2013 15:45
Location: The Hague, NL

Re: pkexec fails to launch apps as root

Postby grizzler » 28 May 2019 15:17

And now, the package solydxk-system seems to be missing from the repository... :?:
That is, it isn't listed in the Packages files.
Frank

SolydX EE 64 - tracking Debian Testing

User avatar
Arjen Balfoort
Site Admin
Posts: 9223
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: pkexec fails to launch apps as root

Postby Arjen Balfoort » 28 May 2019 16:35

grizzler wrote:
28 May 2019 15:17
And now, the package solydxk-system seems to be missing from the repository... :?:
That is, it isn't listed in the Packages files.
This is not my day...now the repository is acting up.

Could you try again?


SolydXK needs you!
Development | Testing | Translations

User avatar
Arjen Balfoort
Site Admin
Posts: 9223
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: pkexec fails to launch apps as root

Postby Arjen Balfoort » 28 May 2019 16:39

grizzler wrote:
28 May 2019 14:40
Thanks. i was already looking for a way to 'tactfully' tell you diverting pkexec was a bad idea... :lol:

Seriously though, I think using an action definition file with the proper '...exec.allow_gui' line is a better solution, even if the polkit docs say this should be discouraged and only used for legacy applications. If a gui app needs root, then lets just call it a legacy app and be done with it.
I think it's the safest way to do so. We'll see which applications need a policy file.


SolydXK needs you!
Development | Testing | Translations

User avatar
grizzler
Posts: 2139
Joined: 04 Mar 2013 15:45
Location: The Hague, NL

Re: pkexec fails to launch apps as root

Postby grizzler » 28 May 2019 16:44

Arjen Balfoort wrote:
28 May 2019 16:35
grizzler wrote:
28 May 2019 15:17
And now, the package solydxk-system seems to be missing from the repository... :?:
That is, it isn't listed in the Packages files.
This is not my day...now the repository is acting up.

Could you try again?
Yup. Working again. Thanks.
Frank

SolydX EE 64 - tracking Debian Testing

dclement
Posts: 32
Joined: 14 Mar 2013 10:34
Location: France

Re: pkexec fails to launch apps as root

Postby dclement » 28 May 2019 16:51

Same thing here, back to normal with v. 3.3.5. Thanks.

FWIW, I had found that only 4 apps listed in the System menu wanted authentication before starting: Synaptic and Gparted of course, along with LightDM settings and SolydXK system settings. BR, Daniel

User avatar
Arjen Balfoort
Site Admin
Posts: 9223
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: pkexec fails to launch apps as root

Postby Arjen Balfoort » 28 May 2019 18:29

Reverting back and I get these problems in SolydX 10:

gedibi doesn't work from within Thunar.

Mousepad

Code: Select all

$ pkexec mousepad
Unable to init server: Could not connect: Connection refused

(mousepad:2782): Mousepad-ERROR **: 18:27:47.836: Cannot open display: 
Trace/breakpoint trap


SolydXK needs you!
Development | Testing | Translations

User avatar
grizzler
Posts: 2139
Joined: 04 Mar 2013 15:45
Location: The Hague, NL

Re: pkexec fails to launch apps as root

Postby grizzler » 28 May 2019 18:45

The mousepad issue looks like the usual display/xauthority problem.

And gdebi - in the first thread about that issue, I mentioned finding something that looked like a solution, but I wasn't sure how to implement it: viewtopic.php?f=78&t=7531#p70113
Is there any way to make thunar use sh -c "pkexec program" ?
Frank

SolydX EE 64 - tracking Debian Testing

User avatar
Arjen Balfoort
Site Admin
Posts: 9223
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: pkexec fails to launch apps as root

Postby Arjen Balfoort » 28 May 2019 19:12

grizzler wrote:
28 May 2019 18:45
The mousepad issue looks like the usual display/xauthority problem.
Yes, it is. It probably could use a policy file, but I'm not sure.
grizzler wrote:
28 May 2019 18:45
And gdebi - in the first thread about that issue, I mentioned finding something that looked like a solution, but I wasn't sure how to implement it: viewtopic.php?f=78&t=7531#p70113
Is there any way to make thunar use sh -c "pkexec program" ?
I've used the pkexec bash that caused all these troubles today and renamed it pkexec-gdebi. I'm using that in the updated gdebi package.


SolydXK needs you!
Development | Testing | Translations


Return to “Software”

Who is online

Users browsing this forum: No registered users and 2 guests