-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Storage access not working on Android 11 beta (Pixel 3) #1617
Comments
See https://github.com/termux/termux-packages/wiki/Termux-and-Android-10#additional-android-10-issues. I can't reproduce the issue on Android 11 virtual device (SDK-provided), but there is a chance that Termux will lose the full storage access after Android 10(11)+. This happens due to scoped storage being enforced which works on API level rather than file system. Unfortunately, we can't patch command line utilities (bash, ls, mkdir, etc...) to use the Android storage API over JNI. |
Behaviour where But situation with storage permission denial when it is granted belongs to https://github.com/termux/termux-packages/wiki/Termux-and-Android-10#additional-android-10-issues. |
Got it, thanks; I'll wipe my install and test again.28 черв. 2020 р. 13:31 Leonid Pliushch <notifications@github.com> пише:
See https://github.com/termux/termux-packages/wiki/Termux-and-Android-10#additional-android-10-issues. I can't reproduce the issue on Android 11 virtual device (SDK-provided), but there is a chance that Termux will lose the full storage access after Android 10(11)+.
This happens due to scoped storage being enforced which works on API level rather than file system. Unfortunately, we can't patch command line utilities (bash, ls, mkdir, etc...) to use the Android storage API over JNI.
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.
|
meanwhile, how should we expect to access termux files from other apps? shared internal storage? and is this the only way for termux to access files from outside? all this sounds very weird and that link doesn't really address this. (or does it?) 😁 |
My solution:
I set the remote to my home directory - To copy files to Termux, I connect to MiXplorer's built-in FTP server. I wanted to use SFTP, but I think it's broken on Termux's end, as I get "EOF While reading packet" when I try to connect from MiXplorer (other SFTP connections work fine). |
Oops, I accidentally closed the issue (fat fingers). |
In same way as Termux works with files on external/removable sd-card, i.e. through private directory located in "Android" folder. In case with shared storage, it is located here:
This directory doesn't require any permissions as owned by Termux user id. However third-party applications should implement SAF support (e.g. stock file manager) to access files here. |
You should be able to access Termux home directory too, with stock or any other SAF-based file manager. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I tried with MiXplorer and Google's Files app - in the first, I can only see |
It should be created by |
i see... sadly, looks like cx file explorer, which is a great app, doesn't seem to be saf based and i never noticed there was such a difference in features for what in the system a file manager can access! thanks for the hints, @xeffyr. much better than setting up an FTP for localhost! 😁 are you sure, however, termux setup storage is needed for this? since i can't unsetup, i can't be readily and easily sure, but i would guess it's not! |
With
The All emulators >9 have in common that termux data can be edited completely via the file-app and in all termux installations that SAF and proot-exec in
|
I recently upgraded my Pixel 2 to Android 11, and now get
|
Fixing may require However using such permission will require to submit a special form to Google for explicit approval. That's needed for Google Play builds only. F-Droid is more liberal for such things. If |
@dwrz Questions: did you have a real pixel 2 device and created/used termux with targetSdk=29/30 (10/11)? If so, can you access |
I'm not a In the Files app, I'm unable to find any directory for Termux. Termux is available in Hope this is helpful. Happy to provide more info. |
Even on Android 10, Termux's files don't seem to be visible by file browsers in Android/data/com.termux
This is true of both files browsers included with Android 10, "File" and "Google Files" (this one is more a weird mashup of several apps, including a file browser).
The "File" browser can see Termux's files as sort of a separate file system at the top level, but "Google Files" does not seem to include this functionality.
Unfortunately, in Android 11 Google for some reason removed the more functional "File" file browser, and only included "Google Files" which cannot see Termux files.
|
@dwrz Thanks for the information! I use Pixel 2 Emulator (and others) to check Android-10/11 (Q/R) and had there the problems with To find out the version of the |
@dwrz Could you repeat my action on top of your real pixel2 and what was the result? |
Any third-party file manager implementing SAF should be able to see Termux files. Is "Google Files" being used as file picker? On some ROMs like stock from Samsung SAF-based file manager is not available but file picker application (which look like "Files" or AOSP "DocumentsUI") still can access the Termux directory.
Android on emulated "Pixel 2" doesn't have to match variant installed on real Pixel 2 device. All virtual devices use same generic images regardless of selected skin. |
As @snogglethorpe said, there's two Files apps, and only the non-Google one can access Termux files. That app is not removed from Android 11 though (at least not for me on Pixel 3), it's just not listed in the app drawer anymore. It is stil available as a file picker, so to open it, go to Settings -> Storage -> Files -> Open with Files. Here I can access the files in Termux' internal storage, like before.
Yes, but the old Files is also available as a file picker, so I can choose between the two. Sounds like what you're describing on Samsung ROMs is basically how it is on Pixel with Android 11.
Not sure if I have to do anything more, but I tried adding this to the manifest, and ran
I tried this on my Pixel 3 with the android-10 branch (target sdk 29).
Pixels don't have SD card slots, so that's not possible. |
Ugh, after going back to
I guess it will be fixed by a reinstall, but since I don't have access to external storage in Termux, I can't backup/restore the home directory there, and Files doesn't show hidden files/directories even if I check "Show hidden files". Does anyone know how/if I can fix the environment without wiping the home directory? Edit: I fixed it by creating a tar file of my home directory, moved that out of Termux with Files, reinstalled Termux, moved it back and extracted it. |
@trygveaa Builds from |
@xeffyr: Sure, but I was just asking for a way to keep my files in the home directory. Anyways, I found one. |
Yes, as I said I do have that Files app, and can access Termux from it. It's just that the app drawer has a different Files app (Files by Google, but it's only called Files in the app drawer), so I have to launch it from Settings. I see that the play store app your talking about is a third party shortcut to this app from the app drawer (I don't have it installed, but that doesn't really matter since I can launch it from Settings).
No, |
The bootstrap sources of prefix (about 18M per arch) of the two versions differ little in terms of content, stored with b99 in
The classical 28 version a99 also contains var (131 files), 208 of 2395 more and 8 files fewer ( After a year checks my favorite would be a99 with ELF-split in |
On Android 11 (Pixel 4a), apparently I can write to but not read from storage from Termux. Is this expected?
(I can see from other Android apps that the file has indeed been written with "asdf".) |
@JohnGlassmyer Seems like Right now we have only
I guess if we append
this issue may get fixed. However that's case is strange (allowed to write but not read). Android SDK documentation states this on read permission:
which is reasonable. |
Well, still on my Pixel 4a, I tried, as someone suggested online somewhere, revoking the permission in App Info, then running I subsequently tried quitting Termux and restarting the device, and those did not cause Termux to lose the ability to read storage. If I remember correctly, Termux on this device was able to read storage for a while before it started throwing the I guess, if it starts throwing errors again, I'll try resetting the permission again. |
I can confirm the above worked with my Pixel 2. |
also working on my pixel 3 with android 11 and nokia 7.2 with android 10! both of which weren't working a few months ago, when i had tried the same procedure!! so weird. thanks again, @JohnGlassmyer 😘 (and a @danyael 😁) |
Tested on Pixel 5 (Android 11) - storage access is working right after Closing. |
Real device or emulator, target 28 or 29, with or without PiP? |
@RalfWerner Real device and build v0.104 from F-Droid, of course. However I should say that when we change to API 29, things may go very bad (total loss of access to shared storage). |
I found this article on the subject. By PiP I mean pop-up view, which is only possible to a very limited (Samsung's feature works with any application) extent on your Pixel 5. The question does not belong in this issue either :)
@xeffyr Do you think there will be a solution for this problem some time? I checked termux clones of versions 104 and 106 with gradlew and Studio. The termux source (106.zip = 265k) consists of 109 files also after
Do you still think so or can you imagine now a bootstrap loop
|
@RalfWerner Android goes towards separation of user data from application data. Since Android 11, access to directory I have not tested permission MANAGE_EXTERNAL_STORAGE. However if it works only within the scope of Storage Access Framework, that will mean Termux will lose ability to access files on any storage except internal (aka $HOME). Of course that will happen on target SDK 29+ only. |
SAF also works without adjustments from the file app to all termux paths, including So a test would show the answer - could you do that sometime? |
Yes, it is still possible to access Termux by this way. Everything exposed over SAF should work - restrictions here are not expected. However SAF is not a something that can be used by shell. |
all this technical talk makes no sense to me. there will still be file managers in every android version, which will manage files in the shared storage, right? termux might not be a specialized file manager, but it does have at least the same functions as one. so, worst case scenario, the only real issue should be with the play store. but termux isn't even officially supporting it anymore. so, what's the real issue here? |
Termux has one major difference from file managers and in general any normal (!) Android application - it is mainly a wrapper around Linux userland. Bash, coreutils, etc can't use APIs for file managers like storage access framework. If we patch them to run through JNI, there would be a lot issues (there's to say that SAF doesn't support symlinks, chmod, etc Unix features).
For now the only issue is a restricted access to "Android" folder on Android 11. Applications can access only their directories, e.g. Termux can access only In future when Termux will switch to target API 30 (the latest one currently) to be published on Play Store again, there would be a problems with storage. The only thing for full file access we can rely on is P.S. Potential issues of future Termux versions are off-topic here. No one knows when switching to a newer APIs would be done. But once we'll be ready, an announcement would be posted with all upcoming feature changes. |
@cauerego the title: "access on API 30" is correct and the technical solution is the goal! |
oof, that's still a lot more of technical things... i think this is the key i was missing:
currently, chmod, symlinks and few other linux features are already limited. so this patch could be a good thing to do. and make it more evident somehow how different the storage folder must be, due to all those android limitations. from what i could grasp, you're trying to prevent going that route because it would be a lot of new code and still no guarantees it would even be necessary, given access using api28 was finally fixed within termux. @xeffyr also said
and what i mean is that this doesn't need to be true. termux can still access shared storage files with all the reasoning i'm trying to bring in. and there's no way this could ever be fully blocked by android, because there's zero interest in android from banning file explorers. what's more... even if saf ever becomes the standard way (looks like there's still some devs fighting against this) offering only saf access to termux files might also not be ideal. because then the opposite happens, and the full fledged *nix files are now exposed to apps that can screw with their attributes. i think this is the case in which maintaing both file access or focusing on the shared storage rather than saf makes more sense... if i could make any sense to you guys! 😁😔🤔😇 |
@cauerego do you have your own experience with SAF (file app exchange with termux) and termux with target 29+? |
sorry @ralf, not at all. nothing related at all. except some 20 years coding in other things, in the past. i will definitely love to help getting my hands into code in the future if i can improve the ux (as i mentioned in a few places...). |
What I here mean:
That's at least, since SAF works only within its virtual file system addressed through URIs. Patching - that's another question. It is possible to redefine standard I/O C functions through a separate library to make them using SAF, I even seen the attempts for doing that on Github. It is not that hard, but main problem is that terminal would be mostly useless. Execution overhead will also apply as each call to |
yes, but all that would be only in the so it'd be much more limited than it is now, but that shouldn't be a big deal. it could be treated like a custom file system or whatever. |
@RalfWerner Issues are being opened only for existing application variants. Since SDK 29/30 build is not released - I even don't know if it would be available at all, there no point of opening new thread about issue on future APIs. As I wrote previously, I have not tested MANAGE_EXTERNAL_STORAGE permission. So storage issue is not only about future versions but also unproven. If I do test and see that issue really exist, then ok, I will create a new one. |
Problem description
Access to phone storage isn't working on Android 11 (RPB1.200504.020) on Pixel 3.
Steps to reproduce
termux-setup-storage
(Nothing happens)
ln -s /storage/emulated/0 ~/storage
(The first time it worked, and I had access to storage, but now I get
cd: permission denied: storage
when attempting to access the directory)Expected behavior
Access to device storage. In permissions for Termux, it says it has full access to storage.
Additional information
The text was updated successfully, but these errors were encountered: