Bug 667243 - user with zsh as shell can't easily run chroot
Summary: user with zsh as shell can't easily run chroot
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 13
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
Assignee: David Cantrell
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-04 22:14 UTC by James Antill
Modified: 2013-01-10 06:24 UTC (History)
7 users (show)

Fixed In Version: mock-1.1.10-1.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-01-17 08:43:53 UTC


Attachments (Terms of Use)

Description James Antill 2011-01-04 22:14:58 UTC
Description of problem:
 mock documentation says it runs /bin/sh with "mock shell" but it actually appears to run the users $SHELL ... which is the same if the user has bash, not so much if the user has zsh.
 Changing it to always use /bin/sh is probably the simplest thing. I guess the "best" thing might be using $SHELL iff that file exists in the chroot?

Version-Release number of selected component (if applicable):
mock.noarch                      1.1.6-1.fc13                       @updates

Comment 1 Clark Williams 2011-01-04 22:50:37 UTC
James,

mock just runs /usr/sbin/chroot; it's chroot that's picking up the value of $SHELL. 

As a work around you can specify what to run like this:

$ mock -r fedora-14-x86_64 --shell /bin/sh

which should do the "right" thing. I'll see if there's an easy way to deal with things like /bin/zsh; maybe just nuke the SHELL environment variable before we run the shell, which would force chroot to default to /bin/sh

Comment 2 James Antill 2011-01-04 23:08:58 UTC
Yeh, I eventually worked out to add /bin/sh to the end (I think previously I'd usually just done an "install zsh", which also works :) it was just annoying and took me a while.

I didn't realize this was a chroot feature though, and given that chroot also fails:

% sudo chroot /var/lib/mock/fedora-14-i386/root
chroot: failed to run command `/bin/zsh': No such file or directory

...I'm going to reassign to coreutils.

Comment 3 Clark Williams 2011-01-04 23:14:17 UTC
well, I can modify the shell invocation inside mock to include "SHELL='/bin/sh'" and that would default everyone to sh. Like so:

status = os.system("SHELL='/bin/sh' PS1='mock-chroot> ' /usr/sbin/chroot %s %s %s" % (arg, chroot.makeChrootPath(), cmd))

Would this work for you?

Comment 4 Ondrej Vasik 2011-01-10 11:38:08 UTC
James, could you please explain what exactly is the bug here? chroot expects valid shell in SHELL envvar and this is perfectly documented - see info documentation - info chroot invocation. I see no bug in chroot and I think the proper solution in mock is the one proposed by Clark in comment #3.

Comment 5 James Antill 2011-01-10 15:43:43 UTC
Ondrej, this is the bug:

% echo $SHELL
/bin/zsh
% ls -l $SHELL
-rwxr-xr-x. 1 root root 689944 Mar 22  2010 /bin/zsh
% sudo chroot /var/lib/mock/fedora-14-i386/root          
chroot: failed to run command `/bin/zsh': No such file or directory

...here $SHELL is valid for the main system, it just isn't valid for every chroot on the system. Saying that $SHELL must be valid for every possible chroot seems of dubious value (and I assume the only reason you haven't got 666 BZs already is because most people have bash, which is in almost all chroots).

Comment 6 Clark Williams 2011-01-10 16:11:19 UTC
mock-1.1.8 has added the 'SHELL=/bin/sh' to the chroot invocation, so everyone should be using /bin/sh in the chroot now.

Comment 7 Kamil Dudka 2011-01-10 17:04:32 UTC
(In reply to comment #5)
> Ondrej, this is the bug:
> 
> % echo $SHELL
> /bin/zsh
> % ls -l $SHELL
> -rwxr-xr-x. 1 root root 689944 Mar 22  2010 /bin/zsh
> % sudo chroot /var/lib/mock/fedora-14-i386/root          
> chroot: failed to run command `/bin/zsh': No such file or directory

I agree with Ondrej.  There is nothing to fix in chroot.

Comment 8 Ondrej Vasik 2011-01-17 08:43:53 UTC
Info documentation states:
"`chroot' changes the root to the
directory NEWROOT (which must exist) and then runs COMMAND with
optional ARGS.  If COMMAND is not specified, the default is the value
of the `SHELL' environment variable or `/bin/sh' if not set, invoked
with the `-i' option."

chroot utility has nothing to do with "no zsh in every chroot on the system" - this has to be covered by user. You can't use the shell binary from old chroot, as the binary could be (and many times is) dynamically linked and the .so files probably will be missing in chroot as well.

Closing NOTABUG, as this is not a bug in chroot command and current behaviour is documented.

Comment 9 Fedora Update System 2011-01-18 19:57:52 UTC
mock-1.1.8-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/mock-1.1.8-1.fc14

Comment 10 Fedora Update System 2011-01-18 19:58:32 UTC
mock-1.1.8-1.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/mock-1.1.8-1.fc13

Comment 11 Fedora Update System 2011-01-18 20:03:25 UTC
mock-1.0.15-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.15-1.el5

Comment 12 Fedora Update System 2011-01-21 23:03:20 UTC
mock-1.1.8-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Kamil Dudka 2011-01-21 23:17:17 UTC
There has been nothing changed in coreutils.  I am reassigning back to mock in order to avoid unnecessary confusion...

Comment 14 Fedora Update System 2011-02-20 02:25:34 UTC
mock-1.1.9-1.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/mock-1.1.9-1.fc13

Comment 15 Fedora Update System 2011-02-20 02:28:46 UTC
mock-1.0.16-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.16-1.el5

Comment 16 Fedora Update System 2011-02-20 02:31:43 UTC
mock-1.1.9-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.1.9-1.el6

Comment 17 Fedora Update System 2011-02-20 02:34:34 UTC
mock-1.1.9-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/mock-1.1.9-1.fc14

Comment 18 Fedora Update System 2011-03-03 08:24:03 UTC
mock-1.1.9-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 19 Fedora Update System 2011-03-03 08:33:05 UTC
mock-1.1.9-1.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 20 Fedora Update System 2011-05-13 20:33:14 UTC
mock-1.1.10-1.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc15

Comment 21 Fedora Update System 2011-05-13 20:38:07 UTC
mock-1.1.10-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc14

Comment 22 Fedora Update System 2011-05-13 20:42:25 UTC
mock-1.0.17-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.17-1.el5

Comment 23 Fedora Update System 2011-05-13 20:46:39 UTC
mock-1.1.10-1.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc13

Comment 24 Fedora Update System 2011-05-13 20:50:56 UTC
mock-1.1.10-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.el6

Comment 25 Fedora Update System 2011-05-19 04:34:42 UTC
mock-1.1.10-1.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 26 Fedora Update System 2011-05-25 02:42:06 UTC
mock-1.1.10-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 27 Fedora Update System 2011-05-25 03:16:26 UTC
mock-1.1.10-1.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 28 Fedora Update System 2011-06-02 19:06:16 UTC
mock-1.0.17-1.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 29 Fedora Update System 2011-06-02 19:16:18 UTC
mock-1.1.10-1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.