Skip to content

[Bug]: "Permission denied" on "/storage/emulated/0/" #4486

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

Closed
eapo opened this issue Apr 8, 2025 · 15 comments
Closed

[Bug]: "Permission denied" on "/storage/emulated/0/" #4486

eapo opened this issue Apr 8, 2025 · 15 comments

Comments

@eapo
Copy link

eapo commented Apr 8, 2025

Problem description

Accessing the storage was working well before the current upgrade, but not anymore:

~ $ ls /storage/emulated/0/Documents/
ls: cannot open directory '/storage/emulated/0/Documents/': Permission denied

Steps to reproduce the behavior.

  1. Upgrade to 0.118.2
  2. ls /storage/emulated/0/Documents/

What is the expected behavior?

No response

System information

~ $ termux-info
Termux Variables:                                          TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=21280
TERMUX_APP__BUILD_DATA_DIR=/data/data/com.termux
TERMUX_APP__DATA_DIR=/data/user/0/com.termux
TERMUX_APP__LEGACY_DATA_DIR=/data/data/com.termux
TERMUX_APP__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c184,c257,c512,c768
TERMUX_APP__SE_INFO=default:targetSdkVersion=28:complete   TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.2
TERMUX__HOME=/data/data/com.termux/files/home
TERMUX__PREFIX=/data/data/com.termux/files/usr
TERMUX__ROOTFS=/data/data/com.termux/files
TERMUX__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c184,c257,c512,c768                                                TERMUX__USER_ID=0                                          Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://ftp.agdsn.de/termux/termux-main stable main
# root-repo (sources.list.d/root.list)
deb https://ftp.agdsn.de/termux/termux-root root stable
Updatable packages:                                        abseil-cpp/stable 20250127.1 aarch64 [upgradable from: 20250127.0-1]
clang/stable 20.1.2 aarch64 [upgradable from: 19.1.7]      command-not-found/stable 2.4.0-70 aarch64 [upgradable from: 2.4.0-67]
coreutils/stable 9.6-1 aarch64 [upgradable from: 9.6]
curl/stable 8.13.0 aarch64 [upgradable from: 8.12.1]
ed/stable 1.21.1 aarch64 [upgradable from: 1.21]
gawk/stable 5.3.1 aarch64 [upgradable from: 5.3.0]
glib/stable 2.84.1 aarch64 [upgradable from: 2.84.0-1]
libcompiler-rt/stable 20.1.2 aarch64 [upgradable from: 19.1.7]
libcurl/stable 8.13.0 aarch64 [upgradable from: 8.12.1]
libexpat/stable 2.7.1 aarch64 [upgradable from: 2.7.0]
libllvm/stable 20.1.2 aarch64 [upgradable from: 19.1.7]
liblzma/stable 5.8.1 aarch64 [upgradable from: 5.6.4]
libsqlite/stable 3.49.1-2 aarch64 [upgradable from: 3.49.1]
libxml2/stable 2.13.7 aarch64 [upgradable from: 2.13.6-1]
lld/stable 20.1.2 aarch64 [upgradable from: 19.1.7]
llvm/stable 20.1.2 aarch64 [upgradable from: 19.1.7]
nano/stable 8.4 aarch64 [upgradable from: 8.3]
patch/stable 2.8 aarch64 [upgradable from: 2.7.6-4]
termux-api/stable 0.59.1 aarch64 [upgradable from: 0.59.0]
termux-exec/stable 1:2.3.0 aarch64 [upgradable from: 1:1.0-1]
termux-tools/stable 1.45.0 aarch64 [upgradable from: 1.44.6]
xz-utils/stable 5.8.1 aarch64 [upgradable from: 5.6.4]
termux-tools version:
1.44.6
Android version:
15
Kernel build information:
Linux localhost 6.1.99-android14-11-gd6f926cfde54-ab12786694 #1 SMP PREEMPT Wed Dec 11 21:44:40 UTC 2024 aarch64 Android
Device manufacturer:
Google
Device model:
Pixel 7 Pro
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
@eapo eapo added the bug report label Apr 8, 2025
@agnostic-apollo
Copy link
Member

Is Android Settings -> Apps -> Termux -> Permissions -> Files permission granted? And I assume Termux;API app was not installed before (and now)?

@whiteinge
Copy link

whiteinge commented Apr 8, 2025

I had the same problem after upgrade. It seems _removing _ the Files permission and then re-granting the permission resolves the issue for me.

Edit: Samsung S22, Android 14

@agnostic-apollo
Copy link
Member

Which device and android version?

@anotherdoesnm
Copy link

Yes, re-granting permission are fixed problem

@04677

This comment has been minimized.

@eapo
Copy link
Author

eapo commented Apr 9, 2025

Perfect. Keep up the amazing work!

@eapo eapo closed this as completed Apr 9, 2025
@s-cerevisiae
Copy link

Please reopen this issue, re-granting the permission only fixes the problem temporarily. It fails again on the next day and I've reproduced this twice.

@twaik
Copy link
Member

twaik commented Apr 18, 2025

Please reopen this issue, re-granting the permission only fixes the problem temporarily. It fails again on the next day and I've reproduced this twice.

Seems like firmware related bug. Usually OS does not automatically revoke permissions day after user grants it.

@s-cerevisiae
Copy link

It's not revoked, it comes back to the old state of "permission granted but can't access anything". I ran termux-setup-storage again and let's see if that will help.

@divinity76
Copy link

divinity76 commented Apr 19, 2025

I think this issue should be re-opened.
Same problem for me.
@whiteinge's workaround did resolve the issue,
but going by @s-cerevisiae it's probably just a temporary fix.

Samsung S24 Ultra,
Android 14, not rooted,
Termux 0.118.2,
Termux:API 0.51.0.

@anotherdoesnm
Copy link

anotherdoesnm commented Apr 19, 2025

Hm, still all working for me
Android 13, not rooted
Termux 0.118.2
Termux:API 0.51.0
Upd: my phone manufacture is Oukitel, model WP23

@divinity76
Copy link

@anotherdoesnm add your phone manufacturer to the post.
Seems this may be a samsung-specific issue.

Can anyone reproduce this on a not-Samsung phone?

@s-cerevisiae
Copy link

s-cerevisiae commented Apr 20, 2025

Old Xiaomi device on Android 10 (MIUI12) here. Still happens today. But I checked permissions on Termux:API (not Termux app) this time and it's "ask me everytime". Changed it to be "always allow" and it works again. I'll see if this still works tomorrow.

For more context this happens after I upgraded both Termux and Termux:API, I believe other people in this thread did the same.

@anotherdoesnm
Copy link

@anotherdoesnm add your phone manufacturer to the post. Seems this may be a samsung-specific issue.

Can anyone reproduce this on a not-Samsung phone?

My manufacture is Oukitel, updated my post above

@s-cerevisiae
Copy link

Update: after I granted permission to Termux:API the problem seems to be resolved. I'll report back if this occurs again.

agnostic-apollo added a commit that referenced this issue May 22, 2025
…API version `0.51.0` is revoking the storage permission of Termux app after updates and sometimes later

Related issue #4486
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

8 participants