termux-app icon indicating copy to clipboard operation
termux-app copied to clipboard

[Bug]: The command "termux-setup-storage" is not working

Open Kazukkun opened this issue 9 months ago • 23 comments

Problem description

Everytime I try to use this command to get access to my files, nothing happens and the "$" disappear. Then I have to click "Ctrl + C" to make this "$" come back.

Image Image

Steps to reproduce the behavior.

Just try to run the code "termux-setup-storage"

What is the expected behavior?

The "$" disappear and then nothing happens

System information

  • Termux application version: 0.118.1
  • Android OS version: 11
  • Device model: Samsung A10

Kazukkun avatar Mar 19 '25 01:03 Kazukkun

I get this too except it's like this:

termux-setup-storage /data/data/com.termux/files/usr/bin/am: 30: exec: /system/bin/app_process: not found /system/bin/app_process bash: /system/bin/app_process: cannot execute: required file not found

I'm on aarch64 only if that matters . No 32bit (s25u)

~ $ stat /system/bin/app_process File: /system/bin/app_process -> app_process64 Size: 13 Blocks: 8 IO Block: 4096 symbolic link Device: 254,14 Inode: 258521470 Links: 1 Access: (0755/lrwxr-xr-x) Uid: ( 0/ root) Gid: ( 2000/ shell) Context: u:object_r:system_file:s0 Access: 2021-12-31 16:00:00.000000000 -0800 Modify: 2021-12-31 16:00:00.000000000 -0800 Change: 2021-12-31 16:00:00.000000000 -0800

ascendbeing avatar Mar 23 '25 03:03 ascendbeing

@ascendbeing your issue is related to https://github.com/termux/termux-exec-package/issues/31

agnostic-apollo avatar Mar 23 '25 03:03 agnostic-apollo

@ascendbeing Can you post output of termux-info?

agnostic-apollo avatar Mar 23 '25 12:03 agnostic-apollo

@agnostic-apollo any ideia how to solve my problem?🤔🤔 It's not working yet🥲

Kazukkun avatar Mar 29 '25 01:03 Kazukkun

Run apt update && apt upgrade and restart termux, then try again, if that doesn't work, let me know.

agnostic-apollo avatar Mar 29 '25 02:03 agnostic-apollo

@agnostic-apollo I tried it again but it's still not working

Kazukkun avatar Mar 29 '25 14:03 Kazukkun

Run command then ctrl+c once it hangs, then generate logcat dump and email me or post here.

https://github.com/termux/termux-packages/blob/site/site/pages/en/projects/docs/repos/main/packages/termux-tools/logcat/index.md#to-get-full-system-logs-of-other-apps-and-the-android-system

agnostic-apollo avatar Mar 29 '25 14:03 agnostic-apollo

Upload the full file as attachment instead, too long for clipboard.

agnostic-apollo avatar Mar 30 '25 00:03 agnostic-apollo

Idk if it's related, but I had permission issues accessing my symlinks in storage after the last update, even though the app had all the necessary permissions from the beginning. However, resetting the storage permissions of the app as described here solved the problem for me

CKMz17 avatar Apr 03 '25 06:04 CKMz17

Idk if it's related, but I had permission issues accessing my symlinks in storage after the last update, even though the app had all the necessary permissions from the beginning. However, resetting the storage permissions of the app as described here solved the problem for me

Same problem, and same solution

permission_denied

HashLiver avatar Apr 06 '25 18:04 HashLiver

If on Android 11, then manually disable and grant storage permission from Termux app info in android settings.

agnostic-apollo avatar Apr 06 '25 18:04 agnostic-apollo

Idk if it's related, but I had permission issues accessing my symlinks in storage after the last update, even though the app had all the necessary permissions from the beginning. However, resetting the storage permissions of the app as described here solved the problem for me

In my case termux-setup-storage didn't solve the problem. I keep getting "Permission denied" . Android 15 and Termux 0.118.2 . Any ideas?

ralmcruz avatar Apr 07 '25 08:04 ralmcruz

If it hangs, then do https://github.com/termux/termux-app/issues/4440#issuecomment-2763395482

If does not hang and succeeds but still no permission, then grant All Files Access from Android settings -> Apps -> Additional -> Special app access.

agnostic-apollo avatar Apr 07 '25 09:04 agnostic-apollo

If does not hang and succeeds but still no permission, then grant All Files Access from Android settings -> Apps -> Additional -> Special app access.

The Special Access lists Termux:API and enabling the all files access for that entry fixes the issue.

alensiljak avatar Apr 07 '25 10:04 alensiljak

from Android settings ->

If does not hang and succeeds but still no permission, then grant All Files Access from Android settings -> Apps -> Additional -> Special app access.

The Speciall Access lists Termux:API and enabling the all files access fixes the issue.

It does fix the issue with permission. Thanks.

ralmcruz avatar Apr 07 '25 16:04 ralmcruz

From v0.118.2 onwards "Special access" is required to access files under ~/storage for some reason.

If you're on Samsung: Settings > Apps > Click 3 dots on top right corner > Special access > All files access > Enable Termux

scrazzz avatar Apr 08 '25 09:04 scrazzz

From v0.118.2 onwards "Special access" is required to access files under ~/storage for some reason.

If you're on Samsung: Settings > Apps > Click 3 dots on top right corner > Special access > All files access > Enable Termux

I upgraded Termux from v0.118.1 and termux does not display in All files access. How to fix it?

hoang-rio avatar Apr 10 '25 23:04 hoang-rio

If you're on Samsung: Settings > Apps > Click 3 dots on top right corner > Special access > All files access > Enable Termux

I have v0.118.2 but Termux is not listed in Special access > All files access

woheller69 avatar Apr 12 '25 10:04 woheller69

Solved by revoking permission and granting it again

woheller69 avatar Apr 12 '25 10:04 woheller69

v0.118.2 does not request All files access permission, and only Termux app info -> Permissions -> Files permission. If you are seeing All Files Access permission, then it is coming from Termux:API 0.51.0 being installed, which is likely the cause of the issue, but I can't reproduce it myself.

agnostic-apollo avatar Apr 12 '25 11:04 agnostic-apollo

Something weird happened indeed, had "all files" permission setup for a long time (all working fine), just noticed termux can't reach anymore anything in the subdirectories in ~/storage. termux-setup-storage works but isn't prompting for more permissions, and I can't grant "all files" anymore to termux but somehow I can give it to Temux:API and weirdly enough this fixes it.

Apart from that probably the changes come from something similar to what happened to Nextcloud at the beginning of 2025 (note that issue spans almost 5 years by now, Google is always changing something) https://github.com/nextcloud/android/issues/6248

vb0 avatar Apr 26 '25 06:04 vb0

I had to downgrade most previous version are working fine until version 0.118.2 . You can downgrade to a different release temporarily

FrankMutuma avatar Jun 02 '25 16:06 FrankMutuma

@FrankMutuma try 0.118.3. Make sure you enable the "All Files Access" for Termux (and Termux API for good measure). Maybe even flip it back and forth, even if enabled already. Weirdly enough on the latest Pixel the permission returned now for Termux but popped up enabled (though earlier it started working anyway by enabling it for Termux API). On an older Android 12 I still had the permission for (simple) Termux, but it got disabled, enabled it and it worked fine. However, it got disabled with the last update, enabled it and works fine. There's some reason for sure, but a bit weird when I enabled it for Termux it flipped it for Termux API too, even if they're different apps and versions.

Meanwhile NextCloud's issue with being denied this permission for the Play Store version made the tech news. Last year this killed Syncthing, they couldn't push any update with no explanation from the beginning of the year and at some point they just decided to kill the Android app completely (there's a syncthing-fork, but it's a third party, very nice, useful, open source and all but not from the Syncthing Foundation).

vb0 avatar Jun 03 '25 07:06 vb0