FS#55053 - [mksh] pkexec fails because $SHELL is not listed in /etc/shells

Attached to Project: Community Packages
Opened by Matthew T. Hoare (Head_on_a_Stick) - Sunday, 06 August 2017, 18:16 GMT
Last edited by Eli Schwartz (eschwartz) - Thursday, 17 May 2018, 16:04 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Alad Wenter (Alad)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

If /usr/bin/mksh is not added to /etc/shells then pkexec will not work because $SHELL is set to that value.

Error message:

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

This incident has been reported."

Additional info:
* package version(s)
55-1

* config and/or log files etc.
Stock /etc/skel/.mkshrc copied to $HOME

* kernel version
linux-hardened 4.12.4.a-1

Steps to reproduce:

`gparted_polkit` (or `pkexec foo`)
This task depends upon

Closed by  Eli Schwartz (eschwartz)
Thursday, 17 May 2018, 16:04 GMT
Reason for closing:  Fixed
Additional comments about closing:  mksh 56.c-3
Comment by Doug Newgard (Scimmia) - Sunday, 06 August 2017, 18:20 GMT
How are you even logging in if your shell is set to /usr/bin/mksh? It should be /bin/mksh.
Comment by Matthew T. Hoare (Head_on_a_Stick) - Sunday, 06 August 2017, 18:23 GMT
It is set to /bin/mksh in /etc/passwd, I can login fine.

The problem is that pkexec expects to find $SHELL listed in /etc/shells but /etc/skel/.mkshrc sets this to $MKSH, which is /usr/bin/mksh in Arch.

My mksh AUR packages now add /usr/bin/mksh to /etc/shells and do not suffer this error.
Comment by Antonio Rojas (arojas) - Sunday, 17 September 2017, 20:12 GMT
"$MKSH, which is /usr/bin/mksh in Arch"

where is this set? Can't reproduce here.
Comment by Matthew T. Hoare (Head_on_a_Stick) - Monday, 18 September 2017, 11:14 GMT
$MKSH is set by the provided example .mkshrc, this file also contains many useful functions (such as pushd & popd) and will probably be used by many.

It is probably also worth noting that Arch's zsh package does add /usr/bin/zsh to /etc/shells in it's install script, presumably for this reason.
Comment by Antonio Rojas (arojas) - Friday, 13 October 2017, 20:17 GMT
Still can't reproduce here. The .mkshrc line that sets $MKSH is

\: "${MKSH:=$(\\builtin whence -p mksh)}${MKSH:=/bin/mksh}"

which returns /bin/mksh.
Comment by Antonio Rojas (arojas) - Friday, 13 October 2017, 20:26 GMT
Is /bin in you PATH?
Comment by Matthew T. Hoare (Head_on_a_Stick) - Saturday, 14 October 2017, 12:40 GMT
"Is /bin in you[r] PATH?"

No, it is not:

`empty@Xanadu:~ $ echo $PATH
/home/empty/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/plan9/bin`

Adding /bin to PATH does not change the error.

I have just reproduced the problem with a fresh user, here are my exact steps:

Create user with: `useradd -m -s /bin/mksh test && passwd test`

Log in with user "test" and run `pkexec gparted` to produce the error.

From the new user, `echo $MKSH` produces "/usr/bin/mksh" and /bin is not in PATH.

The error does not occur if I switch to my usual mksh-static-git package from the AUR, that package adds /usr/bin/mksh to /etc/shells (as does the Arch zsh package with /usr/bin/zsh).
Comment by Eli Schwartz (eschwartz) - Thursday, 17 May 2018, 16:04 GMT
> Comment by Antonio Rojas (arojas) - Friday, 13 October 2017, 16:26 GMT-4
> Is /bin in you PATH?

Not since filesystem 2013.05-2 which removed it: https://git.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/filesystem&id=3566438bf5174d9ac71432d59c248da08f70c7ac

Are you using a non-default setup that adds this "redundant entries" for unreproducible effects? :p

$ arch-nspawn /path/to/new/chroot pacman -Syu mksh
[...]
$ arch-nspawn /path/to/new/chroot mksh -c 'whence -p mksh'
/usr/bin/mksh
$ type -a bash
bash is /usr/bin/bash # but nothing does $SHELL lookup like that, since bash sets it internally, mksh doesn't


I'm unsure why this is controversial anyway, fixed in mksh 56.c-3

Loading...