holzschu / a-shell

A terminal for iOS, with multiple windows
BSD 3-Clause "New" or "Revised" License
2.69k stars 117 forks source link

Failed loading ls ... ls: command not found #477

Open hidehide55 opened 2 years ago

hidehide55 commented 2 years ago

When I run the ls command, I often get the following error

Failed loading ls from files.framework/files, cause = dlopen(files.framework/files, 0x0009): tried: '/private/var/containers/Bundle/Application/7D9DFCD1-6F01-4A8B-9041-F111E6EEBAEC/a-Shell.app/Frameworks/files.framework/files' (could not register fairplay decryption, mremap_encrypted() => -1), '/private/var/containers/Bundle/Application/7D9DFCD1-6F01-4A8B-9041-F111E6EEBAEC/a-Shell.app/Frameworks/ios_system.framework/Frameworks/files.framework/files' (no such file), '/usr/lib/swift/files.framework/files' (no such file), '/private/var/containers/Bundle/Application/7D9DFCD1-6F01-4A8B-9041-F111E6EEBAEC/a-Shell.app/Frameworks/files.framework/files' (could not register fairplay decryption, mremap_encrypted() => -1), 'files.framework/files' (relative path not allowed in hardened program), '/System/Library/Frameworks/files.framework/files' (no such file) ls: command not found

Then, when I run the ssh command, I get the similar error as below.

Failed loading ssh from ssh_cmd.framework/ssh_cmd, cause = dlopen(ssh_cmd.framework/ssh_cmd, 0x0009): tried: '/private/var/containers/Bundle/Application/7D9DFCD1-6F01-4A8B-9041-F111E6EEBAEC/a-Shell.app/Frameworks/ssh_cmd.framework/ssh_cmd' (could not register fairplay decryption, mremap_encrypted() => -1), '/private/var/containers/Bundle/Application/7D9DFCD1-6F01-4A8B-9041-F111E6EEBAEC/a-Shell.app/Frameworks/ios_system.framework/Frameworks/ssh_cmd.framework/ssh_cmd' (no such file), '/usr/lib/swift/ssh_cmd.framework/ssh_cmd' (no such file), '/private/var/containers/Bundle/Application/7D9DFCD1-6F01-4A8B-9041-F111E6EEBAEC/a-Shell.app/Frameworks/ssh_cmd.framework/ssh_cmd' (could not register fairplay decryption, mremap_encrypted() => -1), 'ssh_cmd.framework/ssh_cmd' (relative path not allowed in hardened program), '/System/Library/Frameworks/ssh_cmd.framework/ssh_cmd' (no such file) ssh: command not found

If I exit and start a-Shell, then run both ls and ssh, I get the error, but if I repeat exit - start several times, both ls and ssh work correctly. However, if I try to exit - start from that state, the error occurs again. Restarting the iPad did not help. Reinstalling a-Shell did not help. NG: a-Shell 1.9.8 on iPad OS 15.7 on iPad 9th Generation.

This does not happen on the other one so far. OK: a-Shell 1.9.8 on iPad OS 15.7 on iPad 7th Generation.

Thanks.

praksharma commented 2 years ago

The same is happening with me.

holzschu commented 2 years ago

Thanks for raising this issue; at first glance it looks like it's going to be difficult to fix (according to the documentation, this should never happen). You are on iOS 15, so I can rule out something related to the hardened mode on iOS 16, but that's about it.

Based on the error message, iOS can find the binary library that contains the commands, but it cannot open it, because something is wrong with the digital signature. Since the signature has been generated by Apple and validated by it, this should not happen. The first suspect is some corruption during the install process, but if that's the case, reinstalling over a high quality network should fix it.

praksharma commented 2 years ago

Currently I am using blink on my iPad and it works perfectly fine. May be you can find something on their repo.

holzschu commented 2 years ago

I had a look at their repo. For the key part (executing local commands like ls), it uses my library, ios_system, embedding frameworks compiled by me. Which again points more towards "an issue with the install process" than with "something with the code".

hidehide55 commented 2 years ago

I tried reinstall again. uninstall a-Shell -> iPad shutdown -> iPad startup -> install a-Shell But error occurred.

So, I installed a-Shell mini. Working fine. I repeated "start - ls - exit" about 10 times and no error occurred.

I will use a-Shell mini. Let me know if there is anything I can try about a-Shell.

Thanks.

KMcL27 commented 2 years ago

I recently found your wonderful tools and have also experienced the same type of error when attempting to run the perl, python and jq executables. Sometimes they execute but often they fail with the ‘fairplay’ issue.

Moovlin commented 2 years ago

Can confirm that this occurred for me on Early 2020 iPad Pro (A15) with iPad OS 16.1 The process is similar where I can run each command once and then have to restart a-shell/a-shell mini both on versions 1.9.9. Reading about perhaps it being an issue during install, I deleted a-shell mini, reinstalled it, and let it sit without being able to put input into the REPL. Now things are working as expected. Is there a background process I may have killed on start up the first time I did this? I did not find this process to be repeatable so it may have just been I needed to reinstall.

holzschu commented 2 years ago

Thank a lot to all of you for reporting this issue. It's the first issue where I received an actual feedback from Apple.

The feedback from Apple: are these devices jailbroken? If so, that could explain the message. If the devices are not jailbroken, then it's a weird issue (their words) which they would like to investigate. They asked to "get a sysdiagnose log from the user" (no, I don't know what that is either).

praksharma commented 2 years ago

No my iPad is not jailbroken.

Moovlin commented 2 years ago

Same for me, my iPad is not jailbroken.

On Tue, Nov 1, 2022 at 12:52 Prakhar Sharma @.***> wrote:

No my iPad is not jailbroken.

— Reply to this email directly, view it on GitHub https://github.com/holzschu/a-shell/issues/477#issuecomment-1298826100, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOYLCZPIH6YAAQHKN6NFMTWGFDGNANCNFSM6AAAAAAQ4F6I4M . You are receiving this because you commented.Message ID: @.***>

holzschu commented 2 years ago

Thanks for confirming this. I'm forwarding your answers to Apple, and I'll probably get back with instructions on how to extract a diagnosis that might help them understanding.

holzschu commented 2 years ago

I think these are the instructions to produce a sysdiagnose file: https://support.umbrella.com/hc/en-us/articles/4406646902420-How-to-capture-a-sys-diagnose-from-an-iOS-device

the goal is to have the sysdiagnose tool running while you run a-Shell, and extract the file immediately after the "command not found" bug.

hidehide55 commented 2 years ago

My iPad is not jailbroken. If I get the sysdiagnose file, how do I send it to you?

holzschu commented 2 years ago

Either attach it here or send it be e-mail to another_shell@icloud.com

holzschu commented 2 years ago

Official Apple instructions: sysdiagnose_Logging_Instructions.pdf Here, it seems to be: create the file immediately after the bug.

praksharma commented 1 year ago

I was trying to recreate the bug, but I couldn't. The app is working fine.

KMcL27 commented 1 year ago

Removed and reinstalled to reproduce the issue and use sysdiagnose, and you guessed it, everything works perfectly. Very strange, but a very happy user!

holzschu commented 1 year ago

Update: I have filed an official bug report with Apple (FB11774729). I'll keep you posted on their reply.

rectalogic commented 1 year ago

I'm frequently getting this could not register fairplay decryption error randomly, sometimes a command generates it sometimes not. I was able to trigger a sysdiagonse log. The file is over 300M compressed. Do you still need this? It contains a ton of information about my device so would rather not attach it here, and it may be too large to email.

holzschu commented 1 year ago

Thank you for this confirmation that the issue is still relevant. I haven't heard from Apple since I submitted the bug report, except that it says: "Recent similar reports: more than 10". If you can upload the sysdiagnose log, and send the link to another_shell@icloud.com, I'll add it to the bug report.