Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Whenever I try to run screen under a Zsh shell that I compiled under my home directory, I get the following error:

> screen
Cannot exec '/my/path/to/zsh/bin/zsh'

The Z shell is perfectly functional, and I have verified that I can run screen if I invoke it using a system shell (e.g. csh). I usually get into zsh with: exec zsh. Here is some additional info about my system:

> echo $SHELL
/my/path/to/zsh/bin/zsh

> echo $ZSH_VERSION
5.0.0

> which screen
/usr/bin/screen

> screen --version
Screen version 4.00.03 (FAU) 23-Oct

My .screenrc just has two lines in it:

escape ^A^A
bind o other

In case it matters: /my/path/to/zsh/ refers figuratively to a path under my home directory.

Update

  1. Output of calling file:

    > file /my/path/to/zsh/bin/zsh
    > /~/sw/zsh/bin/zsh: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for
    > GNU/Linux 2.6.9, dynamically linked (uses shared libs), 
    > for GNU/Linux 2.6.9, stripped
    
  2. But I can successfully run /my/path/to/zsh/bin/zsh and enter zsh from my csh shell. I usually switch to zsh with exec /my/path/to/zsh/bin/zsh

  3. Below are the ls details on /my/path/to/zsh/bin/zsh

    -rwxr-xr-x 2 YYYY ZZZZ 651K Jan 3 11:58 zsh*
    
  4. Mi .login is empty (it only has comments on it)

  5. I don't have a .profile file
  6. cat/etc/*-release:

    Scientific Linux SL release 5.1 (Boron)
    

Any thoughts on what may be causing this and how to get screen to work with my local installation of zsh?

share|improve this question
    
Can you execute /my/path/to/zsh/bin/zsh otherwise (with full path)? Is /my/path/to/zsh/bin/zsh by any chance a wrapper script with no she-bang line or an invalid she-bang line? –  Stephane Chazelas Feb 20 '13 at 23:27
    
You should start screen through strace to understand what's going on: `strace -f -o screen.strace screen –  Hauke Laging Feb 21 '13 at 1:31
    
Please post the output of file /my/path/to/zsh/bin/zsh and ls -l /my/path/to/zsh/bin/zsh /usr/bin/screen. Are you setting LD_LIBRARY_PATH anywhere? Is this a 32-bit or 64-bit installation, or mixed? –  Gilles Feb 21 '13 at 1:41
    
If the path is my/path/to/zsh/bin/zsh in your home, it has to be /home/you-the-user/my/path/to/zsh/bin/zsh. If you give a path to a file starting with / that starts at /, always. If it doesn't start with /, it starts at the current directory (~ expands to the home of the user, so an alternative could be ~/my/path/to/zsh/bin/zsh. –  vonbrand Feb 21 '13 at 3:09
    
What you report for file /my/path/to/zsh/bin/zsh and ls -l /my/path/to/zsh/bin/zsh are inconsistent. Please copy-paste the real session transcripts, and provide more information about your environment: processor type, unix variant, distribution, anything peculiar about your installation; also how you configured and installed zsh, and anything relevant in your .login, .profile, .cshrc, .zshrc (if in doubt, post everything). –  Gilles Feb 21 '13 at 19:41
add comment

2 Answers

One possible reason is that screen is privileged (on some systems, it's setgid utmp, to be able to log terminal ownership to the utmp file), and that this zsh binary needs a library that isn't in the default library path. Calling a setuid or setgid program erases some environment variables, in particular LD_LIBRARY_PATH.

If you can execute /my/path/to/zsh/bin/zsh from outside screen but not from inside, and you're setting LD_LIBRARY_PATH in your .profile, that would explain your symptoms.

share|improve this answer
    
Thanks Gilles. I have updated my OP with more info. As a matter of fact, I am manually adding some paths to LD_LIBRARY_PATH both in my .zshrc and .cshrc files, and I need them to be there for other reasons, although I typically switch to zsh with exec /my/path/to/zsh/bin/zsh, so I am not sure if my definitions in .cshrc carry over to zsh. Is there anything I can do knowing this? –  user815423426 Feb 21 '13 at 16:45
add comment
up vote 0 down vote accepted

This is embarrassing: the value of of my $SHELL variable was not correct (it had a typo). I apologize - I will make sure I triple check these things before posting a question like this and wasting everyone's time. Thanks so much to all for your help.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.