[error] failed to relocate zsh (RHEL7 and CentOS 7)
gipert opened this issue · 21 comments
Hi! I'm trying to install on a remote server where I don't have root access. I'm getting the following error:
$ ./install
Choose installation directory for Zsh 5.8:
(1) /usr/local <= uses sudo (recommended)
(2) ~/.local <= does not need sudo
(3) Custom directory.
(q) Quit and do nothing.
Choice [123q]: 2
===> installing Zsh 5.8 to /home/ge28fok/.local
===> fetching zsh-5.8-linux-x86_64.tar.gz
===> verifying archive integrity
===> sha256 signature matches
===> md5 signature matches
===> extracting files
[error] failed to relocate zsh
Which comes from zsh itself, if I'm not mistaken. Have you ever seen this before? Any suggestions on what could cause the issue or how to debug it further? Thanks so much in advance for helping.
What OS is this?
Oh right, sorry for not pointing that out. It's a RHEL7 server.
Facing the same issue on CentOS 7.
Just to add: I experience the problem in all CentOS servers I usually work on. So it looks like an OS-specific issue. Would be great to know how to get around this since CentOS is such a common HPC distribution!
I cannot reproduce this in the official centos7 docker container. Here's what I've tried:
% docker run -e TERM -it --rm centos:centos7 bash
[root@a25cbb17346d /]# curl -fsSLO https://raw.githubusercontent.com/romkatv/zsh-bin/master/install
[root@a25cbb17346d /]# sh ./install -d ~/.local -e no
===> installing Zsh 5.8 to /root/.local
===> fetching zsh-5.8-linux-x86_64.tar.gz
===> verifying archive integrity
===> sha256 signature matches
===> md5 signature matches
===> extracting files
Installed Zsh 5.8 to /root/.local
To start Zsh, type:
export PATH="/root/.local/bin:$PATH"
zsh
[root@a25cbb17346d /]# export PATH="/root/.local/bin:$PATH"
[root@a25cbb17346d /]# zsh
a25cbb17346d# ls -l /proc/$$/exe
lrwxrwxrwx 1 root root 0 Oct 25 12:35 /proc/184/exe -> /root/.local/bin/zsh
If I start with the docker command as above, what do I need to run in the container before installing zsh-bin to get the same error as you?
Hi @romkatv, after some research I think I managed to pin this down. I get the error when I try to run the install wizard from within a zsh shell. With bash, the procedure works. Can you reproduce?
This works:
% docker run -e TERM -it --rm centos:centos7 bash
[root@94be1666aad7 /]# yum install -y zsh
[root@94be1666aad7 /]# zsh
[root@94be1666aad7]/# curl -fsSLO https://raw.githubusercontent.com/romkatv/zsh-bin/master/install
[root@94be1666aad7]/# sh ./install -d ~/.local -e no
===> installing Zsh 5.8 to /root/.local
===> fetching zsh-5.8-linux-x86_64.tar.gz
===> verifying archive integrity
===> sha256 signature matches
===> md5 signature matches
===> extracting files
Installed Zsh 5.8 to /root/.local
To start Zsh, type:
export PATH="/root/.local/bin:$PATH"
zsh
[root@94be1666aad7]/# export PATH="/root/.local/bin:$PATH"
[root@94be1666aad7]/# zsh
94be1666aad7# ls -l /proc/$$/exe
lrwxrwxrwx 1 root root 0 Oct 27 10:16 /proc/230/exe -> /root/.local/bin/zsh
As an additional test I've created a centos7 droplet on DigitalOcean. zsh-bin works fine there, too.
There is something on your machine(s) that breaks zsh-bin. I need to know what it is before I can do anything.
I tested this on my laptop running Arch:
$ cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://www.archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
LOGO=archlinux
And I get the same (/usr/bin/zsh
is my default shell):
$ echo $SHELL
/usr/bin/zsh
$ curl -fsSLO https://raw.githubusercontent.com/romkatv/zsh-bin/master/install
$ sh ./install -d ~/.local -e no
===> installing Zsh 5.8 to /home/gipert/.local
===> fetching zsh-5.8-linux-x86_64.tar.gz
===> verifying archive integrity
===> sha256 signature matches
===> md5 signature matches
===> extracting files
[error] failed to relocate zsh
I really have no clue what special setting (in common with remote machines running different distros and managed by other people) could be causing this. Maybe a zsh config? I've got no clue how to debug this, what can I try?
Did you install arch on your laptop yourself? If yes, how? If no, where did you get it? (I really hate remote debugging. If I cannot reproduce this, your best bet is to try to debug by yourself.)
Perhaps you are using a confined SELinux user who's not allowed to execute files in the home directory? Can you ask an admin to check /var/log/messages
on that machine after you try (and fail) to install zsh-bin?
You can run id -Z
to check whether you are logged in as a confined SELinux user.
You can run
id -Z
to check whether you are logged in as a confined SELinux user.
id: --context (-Z) works only on an SELinux-enabled kernel
Does not look like to be the case...
Sorry for the slowness but it's hard in this moment to find time to debug this by myself. I will let you know if I discover anything new. Since zsh-bin works if I use bash, for me the problem is solved. Feel free to close this issue, if you think it should be closed. Thanks!
I get the same error as well.
Choose installation directory for Zsh 5.8:
(1) /usr/local <= uses sudo (recommended)
(2) ~/.local <= does not need sudo
(3) Custom directory.
(q) Quit and do nothing.Choice [123q]: 2
===> installing Zsh 5.8 to /home/j587yang/.local
===> fetching zsh-5.8-linux-x86_64.tar.gz
===> verifying archive integrity
===> sha256 signature matches
===> md5 signature matches
===> extracting files
[error] failed to relocate zsh
OS information:
NAME="Rocky Linux"
VERSION="8.4 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.4"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.4 (Green Obsidian)"
Output of id -Z
unconfined_u:unconfined_r:unconfined_t:s0
I don't intend to do anything here until someone provides instructions that allow me to reproduce this.
I had the same issue on an HPC CentOS7 server which after some troubleshooting was due to the presence of FPATH in my environment. This caused the current value of FPATH to be used for fpath and fail the check at the end of the relocate
script. Unsetting this variable prior to running the install script allowed the installer to work and the zsh appears to be functional, as long as FPATH is not set when it is run (which I think would break normal zsh anyway).
@jgoodson Thanks a ton! I've reproduced and fixed this.
Note that you should never export special zsh parameters such as FPATH
or PS1
. I highly recommend fixing whatever code is responsible for exporting FPATH
on your system.
Absolutely. Given the common aspects of the commenters, I would bet most or all of this is due to the presence of the lmod module system. At least the version of lmod I have exports an FPATH for utility ksh functions all supported shells that aren't zsh (since that breaks zsh). If you are already using zsh when your shell is initialized, you won't have this issue, but if you use anything else on a system with lmod configured normally, you'll have FPATH exported.
Can anyone confirm that my fixed has resolved this issue?
Thanks for the verification. Closing as fixed.