Skip to content
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

[Feature]: Move Termux To Micro SD Card #3190

Closed
abridgesmm opened this issue Jan 15, 2023 · 5 comments
Closed

[Feature]: Move Termux To Micro SD Card #3190

abridgesmm opened this issue Jan 15, 2023 · 5 comments

Comments

@abridgesmm
Copy link

Feature description

I have a Samsung Tab S8+ with only 128GB Internal storage and I run out of storage rather quick when trying to setup LAMP with VSCode inside Termux. Could we add a way to allow the core of Termux to be on a micro sd card or move the package files to the micro sd card.

Additional information

Not that i am aware of, no further info.

@agnostic-apollo
Copy link
Member

agnostic-apollo commented Jan 15, 2023

Its not possible without root.

  • sd cards are mounted with noexec flag which doesn't allow direct execution.
  • sd cards are usually formatted with fat/exfat filesystems that don't provide the features of ext4/f2fs filesystems like symlinks and file permission/ownership/selinux context, etc. You could format sd card as ext4, but it should still be mounted as noexec and would create lot of permission issues.
  • Direct file access is not available to sd cards on many phones and requires android SAF apis, so termux won't work. Samsung devices often do provide it, so may be possible on the tab.

One way would to create an ext4 image inside sd card and mount loop it and then bind mount it inside termux, which would require root access.

Second way is converting sd card to adoptable storage and installing termux on it, but that would assign /mnt/expand/<volume_id>/0/com.termux as app data directory, instead /data/data/com.termux, which is required by termux since packages are hardcodedly compiled for it. To fix that would require bind mounting /mnt path at /data path in termux app process mount namespace, which would also require root, inbuilt support will be provided in next release.

https://github.com/termux/termux-packages/wiki/Termux-file-system-layout

@agnostic-apollo agnostic-apollo closed this as not planned Won't fix, can't repro, duplicate, stale Jan 15, 2023
@levone1
Copy link

levone1 commented Mar 11, 2024

Its not possible without root.

* sd cards are mounted with `noexec` flag which doesn't allow direct execution.

* sd cards are usually formatted with `fat`/`exfat` filesystems that don't provide the features of `ext4`/`f2fs` filesystems  like symlinks and file permission/ownership/selinux context, etc. You could format sd card as ext4, but it should still be mounted as `noexec` and would create lot of permission issues.

* Direct file access is not available to sd cards on many phones and requires android SAF apis, so termux won't work. Samsung devices often do provide it, so may be possible on the tab.

One way would to create an ext4 image inside sd card and mount loop it and then bind mount it inside termux, which would require root access.

Second way is converting sd card to adoptable storage and installing termux on it, but that would assign /mnt/expand/<volume_id>/0/com.termux as app data directory, instead /data/data/com.termux, which is required by termux since packages are hardcodedly compiled for it. To fix that would require bind mounting /mnt path at /data path in termux app process mount namespace, which would also require root, inbuilt support will be provided in next release.

https://github.com/termux/termux-packages/wiki/Termux-file-system-layout

I have root, and tried your first method, ("create an ext4 image inside sd card and mount loop it and then bind mount it inside termux"), but get permission denied. One post I read of a similar situation said it's likely SELinux issue. I can't change SELinux mode, (kernel)...

Does that sound right to you? Any way around it?

ext4 partition on sd card is mounted, and loop0 is bind-mounted to directory on sd card. "ls" command shows contents. But, I can't get Termux to have permissions to access.

I guess I could just use the second method, but I'm curious... (unless the same issue would happen there - I'll test)

@levone1
Copy link

levone1 commented Mar 11, 2024

update - second method working fine. Guess I'll just go with that.... Still curious, if any ideas

Thanks

@agnostic-apollo
Copy link
Member

If adoptable storage for external sd card is supported on the device, then should be able to use https://www.reddit.com/r/termux/comments/12hty88/comment/jfuv5mg/ without root.

For ext4 image issues, check mpartel/bindfs#124 (comment)

@levone1
Copy link

levone1 commented Mar 11, 2024

If adoptable storage for external sd card is supported on the device, then should be able to use https://www.reddit.com/r/termux/comments/12hty88/comment/jfuv5mg/ without root.

For ext4 image issues, check mpartel/bindfs#124 (comment)

Thanks

I did see the first link, but since I have root, and no problem using it, I figured I'd go that route.

Second link is helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants