You are not logged in.

#1 2013-06-28 15:46:50

KairiTech
Member
From: Toronto, Canada
Registered: 2011-06-04
Posts: 275

[Solved] zsh and pkexec

[Synopsys] Edit /etc/shells manually, and add /bin/zsh to the list of shells and specify the full path to the app in the policy file. i.e. /usr/bin/leafpad and NOT just leafpad. The policy file for gparted serves as a good one to model your own policy files after.

My environment variable SHELL is still being set to /bin/zsh even though binaries have been moved to /usr/bin/zsh making pkexec complain and fail to run apps in privileged mode.

Where is SHELL set and where would be the most appropriate place to fix it globally for all users?

Last edited by KairiTech (2013-06-29 20:53:49)

Offline

#2 2013-06-28 15:57:45

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,594

Re: [Solved] zsh and pkexec

SHELL is /bin/zsh for me, too, and pkexec is just fine

Online

#3 2013-06-28 19:00:09

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] zsh and pkexec

/bin is a symlink to /usr/bin

$ ls -l /bin
lrwxrwxrwx 1 root root 7 05-31 20:40 /bin -> usr/bin

so everything should be OK.


What exactly does pkexec say?

Offline

#4 2013-06-29 17:39:27

KairiTech
Member
From: Toronto, Canada
Registered: 2011-06-04
Posts: 275

Re: [Solved] zsh and pkexec

karol wrote:

What exactly does pkexec say?

The value for the SHELL variable was not found the /etc/shells file

This incident has been reported.

...but if I set SHELL like so...

export SHELL=`which zsh` ; pkexec gnome-system-monitor                                                                                                                                                  !

...after I enter a password the error message changes to...

(process:9562): GLib-WARNING **: GChildWatchSource: Exit status of a child process was requested but ECHILD was received by waitpid(). Most likely the process is ignoring SIGCHLD, or some other thread is invoking waitpid() with a nonpositive first argument; either behavior can break applications that use g_child_watch_add()/g_spawn_sync() either directly or indirectly.
==== AUTHENTICATION COMPLETE ===

(gnome-system-monitor:9562): Gtk-WARNING **: cannot open display: 
 

Last edited by KairiTech (2013-06-29 17:40:34)

Offline

#5 2013-06-29 18:30:40

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,594

Re: [Solved] zsh and pkexec

That's because, for some reason, the maintainer of zsh removed the part of the install script that adds /bin/zsh to the shells file. It's fine on my machine because it only affects new installs of zsh.

Bug report: https://bugs.archlinux.org/task/35724

Online

#6 2013-06-29 18:39:32

KairiTech
Member
From: Toronto, Canada
Registered: 2011-06-04
Posts: 275

Re: [Solved] zsh and pkexec

Okay thanks. I'll not mark this solved until, well..., it's solved.

Offline

#7 2013-06-29 19:03:51

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [Solved] zsh and pkexec

Edit /etc/shells manually, and add /bin/zsh to the list of shells.  You should never use /usr/bin/* in /etc/shells.  I think this is because the shebang in scripts needs to match what is in /etc/shells, so in order to maintain compatibility with all scripts, we need to keep using /bin/* despite the fact that it is a path through a symlink.  This topic came up with the filesystem /usr merge on the mailing list.  It was proposed that all install scripts should be changed to /usr/bin/bash, and one of the devs (I think it was falconindy) gave reasons why this was a bad idea.  I'm sure you could find it with a quick google.

Offline

#8 2013-06-29 20:14:11

KairiTech
Member
From: Toronto, Canada
Registered: 2011-06-04
Posts: 275

Re: [Solved] zsh and pkexec

WonderWoofy wrote:

Edit /etc/shells manually, and add /bin/zsh to the list of shells.

That seems to work for ...

pkexec leafpad

but I still have the display issue...

==== AUTHENTICATION COMPLETE ===
leafpad: Cannot open display: 

Offline

#9 2013-06-29 20:21:36

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,594

Re: [Solved] zsh and pkexec

That's because pkexec doesn't allow GUI apps by default. Google will turn up all of the info you need, also see the polkit policy file for gparted.

Online

#10 2013-06-29 20:21:51

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] zsh and pkexec

Are you running 'pkexec leafpad' in X or from a tty?

Offline

#11 2013-06-29 20:23:13

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] zsh and pkexec

Not an Installation issue, moving to Apps & DEs...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#12 2013-06-29 20:29:57

KairiTech
Member
From: Toronto, Canada
Registered: 2011-06-04
Posts: 275

Re: [Solved] zsh and pkexec

Gparted works perfectly but modifying its policy file for leafpad still give the display error.

Is it that leafpad itself needs to be compatible with pkexec?

Offline

#13 2013-06-29 20:32:34

KairiTech
Member
From: Toronto, Canada
Registered: 2011-06-04
Posts: 275

Re: [Solved] zsh and pkexec

karol wrote:

Are you running 'pkexec leafpad' in X or from a tty?

From terminator. And for gparted, running it from there works perfectly.

Last edited by KairiTech (2013-06-29 20:34:48)

Offline

#14 2013-06-29 20:40:25

KairiTech
Member
From: Toronto, Canada
Registered: 2011-06-04
Posts: 275

Re: [Solved] zsh and pkexec

What an idiot I am.

I need to specify the full path to the app in the policy file. i.e. /usr/bin/leafpad and NOT just leafpad. Duh!!!

Last edited by KairiTech (2013-06-29 20:45:54)

Offline

#15 2013-06-29 20:43:17

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] zsh and pkexec

KairiTech wrote:

What an idiot I am.

I need to specify the full path to the app in the policy file. i.e. /user/bin/leafpad and NOT just leafpad. Duh!!!

It's /usr/bin/leafpad - /usr, not /user.

I'm not sure we're on the same page wrt tty v X, but as you've solved it, it doesn't really matter :-)

Offline

#16 2013-06-29 20:47:39

KairiTech
Member
From: Toronto, Canada
Registered: 2011-06-04
Posts: 275

Re: [Solved] zsh and pkexec

karol wrote:
KairiTech wrote:

What an idiot I am.

I need to specify the full path to the app in the policy file. i.e. /user/bin/leafpad and NOT just leafpad. Duh!!!

It's /usr/bin/leafpad - /usr, not /user.

I'm not sure we're on the same page wrt tty v X, but as you've solved it, it doesn't really matter :-)

Yep. That was a typo in my post. Thanks everyone for walking me through my own stupidity...LOL

Offline

Board footer

Powered by FluxBB