xxh / xxh-shell-zsh

Use zsh wherever you go through the SSH without installation on the host.
BSD 2-Clause "Simplified" License
32 stars 14 forks source link

iPhone support #1

Open NICHOLAS85 opened 4 years ago

NICHOLAS85 commented 4 years ago

Is your feature request related to a problem? Please describe. I am currently attempting to connect to a Jailbroken iPhone but am greeted with the following error: Something went wrong while running zsh on host: ./zsh.sh: line 11: ./zsh: cannot execute binary file: Exec format error ./zsh.sh: line 12: ./zsh: cannot execute binary file: Exec format error

Describe the solution you'd like If it were possible to detect the correct architecture and use the correctly built zsh executable to run I believe this issue would go away.

For community: ⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

anki-code commented 4 years ago

Hi @NICHOLAS85 ! Thank you for report! The problem is that portable zsh is using glibc now. Right now we're working on new zsh portable version which could resolve this issue. I'll back to you soon.

anki-code commented 4 years ago

@NICHOLAS85 try this please. Here is statically linked portable zsh:

pip install --upgrade xxh-xxh   # to xxh 0.6.1
xxhp install xxh-shell-zsh-romkatv
xxh myhost +s xxh-shell-zsh-romkatv +if

Is it working for you?

NICHOLAS85 commented 4 years ago

After upgrading and installing the *romkatv zsh I, unfortunately, run into the same issue:

Something went wrong while running zsh on host:
./zsh.sh: line 24: /private/var/mobile/.xxh/xxh/shells/xxh-shell-zsh-romkatv/build/zsh-5.8-linux-x86_64-static/bin/zsh: cannot execute binary file: Exec format error
./zsh.sh: line 24: /private/var/mobile/.xxh/xxh/shells/xxh-shell-zsh-romkatv/build/zsh-5.8-linux-x86_64-static/bin/zsh: cannot execute binary file: Exec format error
anki-code commented 4 years ago

Thank you for test! Do you know any ways to repeat the issue without having Jailbroken iPhone? Short search for dockerized solution gives not so enough info.

I see the one way: build zsh on iPhone. You could try to do it using similar instructions as in zsh-portable Dockerfile for ubuntu or alpine or in zsh-bin with musl. The first way is more simpler than second. If you'll get success share the result and I add it as xxh-shell-ios.

NICHOLAS85 commented 4 years ago

I’ll try to build a portable binary at some point in the future. At the moment I am limited in space on my Phone and may not be able to install all the build requirements. Alternatively there is a compiled Zsh package I could install via my package manager on my iPhone. It’s not portable or self contained like the binaries you linked so I don’t think it’d be useful for xxh but I’d like to know if I would still be able to connect to this device and have a familiar Zsh environment provided by xxh using the locally installed Zsh.

anki-code commented 4 years ago

As I understand you want to install zsh on iPhone manually and then you want to connect using xxh? Am I right? In this case you can just fork xxh-shell-bash-zero and rename to xxh-shell-zsh-zero with appropriate changes. This allows you to create xxh-plugins (call it xxh-plugin-zsh-<anyname>) and just connect to the iphone using preinstalled zsh on the host with xxh-plugins (may be xxh-plugin-zsh-ohmyzsh will work without changes).

The second way is to fork xxh-shell-zsh and rename to xxh-shell-zsh-iphone with replacing zsh archive to your zsh build for iphone. It will be your own xxh-shell for iphone and you will be connect ordinary with xxh iphone +s xxh-shell-zsh-iphone.

anki-code commented 4 years ago

Hey @NICHOLAS85 ! You can try new portable zsh build for darwin:

mkdir -p /tmp/zsh && cd /tmp/zsh
curl -fSLO -- "https://github.com/romkatv/zsh-bin/releases/download/v3.0.1/zsh-5.8-darwin-x86_64.tar.gz"
tar -xzf zsh-5.8-darwin-x86_64.tar.gz
mv zsh-5.8-darwin-x86_64 zsh
./zsh/share/zsh/5.8/scripts/relocate
./zsh/bin/zsh

It it works for you we can pack it as xxh-shell.

NICHOLAS85 commented 4 years ago

I get a Bad CPU type in executable when trying to run relocate or the Zsh executable. Here’s the output of uname -a if it helps:

Darwin Nicks-iPhone 19.0.0 Darwin Kernel Version 19.0.0: Wed Oct  9 22:42:11 PDT 2019; root:xnu-6153.42.1~1/RELEASE_ARM64_T8015 iPhone10,6 arm64 D221AP Darwin
anki-code commented 4 years ago

@romkatv please take a look.

romkatv commented 4 years ago
mkdir -p /tmp/zsh && cd /tmp/zsh
curl -fSLO -- "https://github.com/romkatv/zsh-bin/releases/download/v3.0.1/zsh-5.8-darwin-x86_64.tar.gz"
tar -xzf zsh-5.8-darwin-x86_64.tar.gz
mv zsh-5.8-darwin-x86_64 zsh
./zsh/share/zsh/5.8/scripts/relocate
./zsh/bin/zsh

This will install zsh-bin for Darwin x86_64. Naturally, it'll only work on x86_64. Given that iPhone has ARM CPU, it won't work there.

Note that these instructions aren't from https://github.com/romkatv/zsh-bin#installation. Here's what you would get if you follow the official instructions on a jailbroken iPhone:

$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/romkatv/zsh-bin/master/install)"

[error] there is no prebuilt binary for your architecture
See https://github.com/romkatv/zsh-bin#compiling if you'd
like to build it yourself.

There is no released binary for jailbroken iPhone.

NICHOLAS85 commented 3 years ago

Here is a repo which let's you build Zsh for iOS: https://github.com/ProcursusTeam/Procursus It may be useful if you all are interested in packaging an iOS version

nikto-b commented 3 years ago

The message moved to #4

There is not only an iPhone issue - I have an issue while connecting into Ubuntu Server 20.10 running on Raspberry Pi 4 Model B Rev 1.2 (aarch64) ``` Something went wrong while running zsh on host: ./zsh.sh: 28: /home/ubuntu/.xxh/.xxh/shells/xxh-shell-zsh/build/zsh-bin/bin/zsh: Exec format error /home/ubuntu/.xxh/.xxh/shells/xxh-shell-zsh/build/zsh.sh: 28: /home/ubuntu/.xxh/.xxh/shells/xxh-shell-zsh/build/zsh-bin/bin/zsh: Exec format error ```