-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[Bug]: termux-setup-storage does not work on Android 14 #3647
Comments
I'm getting the same issue with mpv. |
It started happening right after I upgraded to Android 14. I really want to downgrade now 😔 |
Run |
Omg thank you so much. 🙏 That worked! |
Thanks a lot @agnostic-apollo! The issue gets resolved after running this command. |
Welcome both. On related pull, the |
I see that makes more sense. Thanks |
Seems to be broken again on Android 14 QPR1. I don't get any errors but the |
Experiencing the same issue as @Kaz205 on Android 14. Running |
Same, with the latest Android 14. I tried explicitly granting the "Files" permission in App Info -> App Permissions, but no dice. |
Make sure to run Storage permissions are given in the following way.
If using GitHub action builds, then running As for |
Thanks for the detailed response! I'm on a fresh install of termux on Android 14 from f-droid. Permissions for me are : Running
|
Did you run log with |
Not sure if it helps but I see storage at /sdcard/ now instead of ~/storage/. I ran termux-setup-storage and gave file permissions beforehand but am not sure if either was necessary for this. |
I'm having the same issue on a new Pixel 8 with stock Android 14. Installed Termux and Termux:API from f-droid, ran Notably, the app has regular file permissions, but it does not show up in the "All files access" list of apps. |
Yes, thank you @bridgemsource ! Even though the Also looks like I can't just add |
I also experienced this issue and after a bit of messing around I think executing |
You may want to check
|
Here's the app permissions: Earlier I said I couldn't see inside the Although Oddly still, from Termux I can't see older files inside the shared storage root dir |
The last line of the script exists with code 255
The logcat has
After giving the correct permissions manually, it still exists with 255, and the following logcat
|
…always using `TermuxAm` to send intents instead of the socket server that is run by the app This is currently only done for Android `>= 14` and is a temporary patch until termux-app release is made with finalized support for termux-am-socket to send intents Closes termux/termux-api#638, termux/termux-app#3754 Related termux/termux-app#3647, termux/TermuxAm@8b9844ab
…on Android `>= 14` but do not wait for result and always exit with exit code 0 When `broadcastIntent()` is called with a `IIntentReceiver resultTo` to be able to get back the broadcast result, Android uses the `IApplicationThread caller` passed to get the `ProcessRecord` of the app from its internal cache (`getRecordForAppLOSP()`) based on the `caller`. Since `TermuxAm` uses a fake `IApplicationThread` that does not belong to an app, the `resultToApp` would not be found. For this, android logs the `Sending broadcast <action> with resultTo requires resultToApp` exception and terminates the process. To prevent this from happening, we do not pass the `resultTo` so that Android uses the `system_server` `ProcessRecord` instead at the cost of not being able to get back the result for the broadcast. This will trigger the following exception in `logcat`, but if broadcast was valid, then it will still have been sent. ``` java.lang.RuntimeException: BroadcastReceiver trying to return result during a non-ordered broadcast at android.content.BroadcastReceiver$PendingResult.checkSynchronousHint(BroadcastReceiver.java:351) at android.content.BroadcastReceiver$PendingResult.setResultCode(BroadcastReceiver.java:154) at com.termux.api.util.ResultReturner.lambda$returnData$0(ResultReturner.java:196) at com.termux.api.util.ResultReturner$$ExternalSyntheticLambda0.run(Unknown Source:8) at java.lang.Thread.run(Thread.java:1012) ``` - https://cs.android.com/android/_/android/platform/frameworks/base/+/a51563231919be01f2d3de53a88df70154ac8992 - https://cs.android.com/android/platform/superproject/+/android-14.0.0_r1:frameworks/base/core/java/android/content/BroadcastReceiver.java;l=350 - https://cs.android.com/android/platform/superproject/+/android-14.0.0_r1:frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java;l=14391 https://cs.android.com/android/platform/superproject/+/android-14.0.0_r1:frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java;l=15309 We cannot use `/system/bin/am` on Android `14` December security patch as `am` commands can only be run with `adb` and `root` users now. Normally, no output will be received when the command will be run and exit code will be `255`. I got the exception once, not sure how to reproduce, there is likely some AOSP bug, using subshell hack and even disabling selinux does not work, but it did get logged while selinux was disabled. - https://cs.android.com/android/_/android/platform/frameworks/base/+/3ef3f18ba3094c4cc4f954ba23d1da421f9ca8b0 ``` java.lang.SecurityException: Shell commands are only callable by root or shell at android.os.Parcel.createExceptionOrNull(Parcel.java:3057) at android.os.Parcel.createException(Parcel.java:3041) at android.os.Parcel.readException(Parcel.java:3024) at android.os.Parcel.readException(Parcel.java:2966) at android.os.BinderProxy.shellCommand(BinderProxy.java:692) at com.android.commands.am.Am.runAmCmd(Am.java:146) at com.android.commands.am.Am.onRun(Am.java:87) at com.android.internal.os.BaseCommand.run(BaseCommand.java:62) at com.android.commands.am.Am.main(Am.java:54) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:359) Caused by: android.os.RemoteException: Remote stack trace: at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:9763) at android.os.Binder.shellCommand(Binder.java:1071) at android.os.Binder.onTransact(Binder.java:888) at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:5267) at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2763) ``` Closes termux/termux-app#3754 Related termux/termux-app#3647, termux/termux-api#638
Running the below now fixes the problem. Thanks @agnostic-apollo
|
Great. You are welcome. |
I followed all the steps until the last one and it still denies my access and it still aborts in my case I have a s23u |
What's the output of |
Could this please be added to the relevant docs? |
Hitting this issue with a Samsung S23...doing "pkg install termux-am" installed a package but didn't fix it. Attempting "apt install termux-api" says no candidates. |
@rampadmin Just enable "Settings → Developer Options → Disable child process restrictions" before running |
@Fly3RC This has nothing to do with child process restrictions (phantom process killer). |
pkg install termux-am |
For me, installing |
Thank you, I was getting desperate as I couldn't find a solution, it just meant full access to the files |
Small caveat, after doing
Allowed me to run
Without errors, but with Files permissions on for Termux, I got permission errors doing:
I added photos and music permissions to Termux, after that working fine. |
@agnostic-apollo can you please make Termux ask for multimedia and all-files permissions too please (via termux-storage-setup command)? |
Does anyone find the solution????? |
@bluefox8976 - what happened when you try the solution I outlined. Could you explain the step where it failed, or any other details that might be relevant? |
(it'll be important to know how / where you installed Termux from, that you have the latest version or not, you know the drill.) @bluefox8976 |
The latest version is 0.118. Ignore these 0.120, 0.122+ currently published on Play Store. Current latest version tag can be always viewed by this permanent link: https://github.com/termux/termux-app/releases/latest |
@sylirre - thanks I should've mentioned that too. FDroid releases are not as up to date as what you can get from https://github.com/termux/termux-app/releases/latest so it's best to use no app stores for Termux |
They are equally same except signatures. Newer version can be obtained only from per-commit builds (GitHub Actions). |
@isman-rtkpd I guess that means that you are using a fork: #4000 |
…`>= 11` when running `termux-setup-storage` Requesting `MANAGE_EXTERNAL_STORAGE` should additionally grant access to unreliable/removable volumes like USB OTG devices under the `/mnt/media_rw/XXXX-XXXX` paths on `Android >= 12`, so request that if possible. Check #71 (comment) for more info. Fixes issue on Android `14`, where using `targetSdkVersion=28`, that requests the legacy `WRITE_EXTERNAL_STORAGE` will actually request the `photos, music, video, and other files` permissions (`READ_MEDIA_AUDIO`/`READ_MEDIA_IMAGES`/`READ_MEDIA_VIDEO`) and apparently access to full external storage `/sdcard` is not available for some users, maybe because `READ_EXTERNAL_STORAGE` and `WRITE_EXTERNAL_STORAGE` permissions are not granted for those device automatically in addition to `READ_MEDIA_*` permission. The issue is not reproducible on Android `13-15` avd. To solve this, we request the singular `MANAGE_EXTERNAL_STORAGE` permission instead so that full access is always available. Related: #3647 (comment) See also: - https://developer.android.com/training/data-storage/shared/media#access-other-apps-files - https://developer.android.com/reference/android/Manifest.permission#READ_MEDIA_IMAGES
On my device |
And using cpufetch throw error opendir premision deteind |
As Android restricts access to files in Nothing to do with Termux storage. It's Android, either live with it or look for devices running native Linux. |
I did the following:
|
Problem description
I get the following error logs when trying to run termux-setup-storage on my Android 14 Pixel 7A device.
Apparently, the message aborted comes even if I just run the
am
command.Could someone please help me out with this issue?
Steps to reproduce the behavior.
Run termux-setup-storage on Android 14 (preferably on Pixel 7a) device.
What is the expected behavior?
termux-setup-storage should setup a
storage
folder as usual.System information
The text was updated successfully, but these errors were encountered: