Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iPhone support #1

Open
NICHOLAS85 opened this issue Mar 17, 2020 · 12 comments
Open

iPhone support #1

NICHOLAS85 opened this issue Mar 17, 2020 · 12 comments

Comments

@NICHOLAS85
Copy link

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
Copy link
Member

anki-code commented Mar 17, 2020

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 anki-code changed the title Support differing Host and Remote architectures Portable zsh fails on iPhone Mar 17, 2020
@anki-code
Copy link
Member

anki-code commented Mar 17, 2020

@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
Copy link
Author

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
Copy link
Member

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
Copy link
Author

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
Copy link
Member

anki-code commented Mar 18, 2020

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
Copy link
Member

anki-code commented Mar 31, 2020

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
Copy link
Author

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
Copy link
Member

@romkatv please take a look.

@romkatv
Copy link

romkatv commented Apr 1, 2020

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.

@anki-code anki-code transferred this issue from xxh/xxh-shell-zsh-glibc Apr 4, 2020
@NICHOLAS85
Copy link
Author

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

@anki-code anki-code changed the title Portable zsh fails on iPhone iPhone support Aug 30, 2020
@nikto-b
Copy link

nikto-b commented Nov 3, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants