Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Have you been successful creating symbolic links on your Android phone?

3,017 views
Skip to first unread message

Arlen Holder

unread,
Dec 4, 2020, 4:28:13 AM12/4/20
to
Have you been successful creating symbolic links on your Android phone?
o Not homescreen shortcuts; but "ln -s" style file system symbolic links

I have no problem creating shortcuts, where I only use four directories,
for the most part, on Android, and where one of them ("Pictures") contains
("Screenshots") which I would like to bring to the level of my sdcard.
o <https://i.postimg.cc/Zn5g1GLz/symbolic01.jpg> filesys symbolic link
o <https://i.postimg.cc/0233BHMh/symbolic02.jpg> homescreen shortcut

Have you been successful creating symbolic links on your Android phone?
o How?

Were you successful making links on the internal & external storage?
o How?

What type of filesystem were you using when/if you were successful?
o Termux: mount | grep type

Note: I'm on Android 10, & not rooted where the "mount" command
seems to tell me my internal storage is "exfat" & external is "sdcardfs"
--
Sometimes you need help with what seems like the simplest of functionality.

Arlen Holder

unread,
Dec 4, 2020, 3:45:55 PM12/4/20
to
On Fri, 4 Dec 2020 09:28:12 -0000 (UTC), Arlen Holder wrote:

> Note: I'm on Android 10, & not rooted where the "mount" command
> seems to tell me my internal storage is "exfat" & external is "sdcardfs"

UPDATE:

Based on this 9-year old thread, the type of "file system" may matter:
o Is possible to make symbolic links in the android filesystem? (and how?)
<https://android.stackexchange.com/questions/4044/is-possible-to-make-symbolic-links-in-the-android-filesystem-and-how>
"Android does support symbolic links, but certain file systems
(e.g. FAT or RFS) do not and you cannot create symbolic links in those
partitions. If your device uses a filesystem that supports symbolic
links (e.g. ext2, ext3, ext4, yaffs2) then you should be able to use
ln -s from the Terminal Emulator."

Given this is the "ln -s" symbolic link syntax:
o Process symlink = Runtime.getRuntime().exec("ln -s /path/to/file /path/to/symlink");
<https://stackoverflow.com/questions/41384370/is-it-possible-to-create-a-symbolic-link-on-android>

I tried this in Android 10 Termux, which said:
o Failed to create symbolic link 'ss': Operation not permitted:

All these failed on my non-rooted Android 10 device using Termux:
o ln -s /storage/emulated/0/Pictures/Screenshots /storage/emulated/0data/pic/ss
o ln -s /storage/emulated/0/Pictures/Screenshots /storage/B31E-4294/1data/pic/ss
o cd /storage/emulated/0data/pic/; ln -s /storage/emulated/0/Pictures/Screenshots ss
o cd /storage/B31E-4294/1data/pic; ln -s /storage/emulated/0/Pictures/Screenshots ss
etc.

This implies it "should" work if I used the "fuse shim around /data/media":
o [Q] Not possible to create a symlink in /mnt/sdcard?
<https://forum.xda-developers.com/t/q-not-possible-to-create-a-symlink-in-mnt-sdcard.1442729/>

Where I tried this based on output from the mount command, but failed:
o mount | grep media | grep B31E-4294
Which reported: /mnt/media_rw/B31E-4294/ type sdcardfs, rw
o ln -s /storage/emulated/0/Pictures/Screenshots /mnt/media_rw/B31E-4294/1data/pic/ss
Which reported; Permission denied

That same article suggests "FolderMount" but it requires root:
o <com.devasque.fmount>

This suggests that the sdcardfs file system is problematic:
o <https://android.stackexchange.com/questions/199526/how-to-remount-sdcardfs-to-allow-setting-file-permisions-ownerships>
"You cannot change permissions and ownerships of files on sdcardfs"

"Android's internal (confusingly called external) storage which is
accessible by installed apps at /sdcard, is not an actual but virtual
/ emulated filesystem exposing /data/media (which is a real filesystem)
through sdcardfs. sdcardfs and its predecessor FUSE expose the emulated
filesystem with a fixed set of uid, gid and mask (mode). So the commands
chmod and chown have no impact, whether executed through CLI
(adb shell or terminal emulator) or GUI (file explorer).

It's possible to change permission bits of file on underlying actual
filesystem, but accessing /data/media requires root access because only
UID/GID 1023 (aid_media_rw) has read access to the directory. And still
the permissions will remain same when viewed from emulated view /sdcard."

Q: Have you been successful creating symbolic links on your Android phone?
--
See also:
o What is /storage/emulated/0
<https://android.stackexchange.com/questions/205430/what-is-storage-emulated-0/205494#205494>
"/storage/emulated/0/ is actually /data/media/0/ exposed through an
emulated / virtual filesystem, not the actual one."

Anssi Saari

unread,
Dec 9, 2020, 10:05:07 AM12/9/20
to
Arlen Holder <arlen_...@newmachines.com> writes:

> Have you been successful creating symbolic links on your Android phone?
> o Not homescreen shortcuts; but "ln -s" style file system symbolic links

If I ssh in to my phone (ssh server, shell and some command line tools
provided by SSHelper), then I'm in
/data/data/com.arachnoid.sshelper/files/home. And this is on an ext4
file system. So under /data/data/com.arachnoid.sshelper I can create
symlinks.

SSHelper includes at least one symlink itself,
/data/data/com.arachnoid.sshelper/files/home has a symlink pointing to
/storage/emulated/0:

lrwxrwxrwx 1 u0_a233 u0_a233 22 Dec 21 2018 SDCard -> /storage/emulated/0

I haven't had much use for symlinks in Android so far.

No symlinks on sdcardfs though as you discovered. Same thing on exFAT.

Libor Striz

unread,
Dec 30, 2020, 4:23:47 AM12/30/20
to
Arlen Holder <arlen_...@newmachines.com> Wrote in message:r
> Have you been successful creating symbolic links on your Android phone?

I did so several times by regular Linux commands in jail broken
termux ( fast Android emulator of Linux console ).


https://play.google.com/store/apps/details?id=com.termux

https://termux.com

https://ss64.com/bash/ln.html

Root is not required, this jail break means removing the
application sandbox limit.

I use termux for regular Bash scripting, like automation of
repeated tasks.

I am able even to run java console applications, as I have Java
installed.




--
Poutnik ( the Wanderer )

Libor Striz

unread,
Dec 30, 2020, 7:48:21 AM12/30/20
to
Libor Striz <poutnik4R...@gmailCAPITALS.com.INVALID> Wrote
in message:

> I did so several times by regular Linux commands in jail broken termux ( fast Android emulator of Linux console ).

P.S.: Note that I do so in the internal storage, for which is
used ext4 FS ( on Androids newer than 2.3, replacing YAFFS2 ) as
the native Linux FS.

For external storage, it depends on the used FS. FAT32 nor exFAT
do not support symbolic links. For NTFS, both the link source and
destination must be in a NTFS FS.

Libor Striz

unread,
Dec 30, 2020, 7:57:11 AM12/30/20
to
Arlen Holder <arlen_...@newmachines.com> Wrote in message:

>I tried this in Android 10 Termux, which said:o Failed to create symbolic link 'ss': Operation not permitted:All these failed on my non-rooted Android 10 device....

Without jail breaking, termux is allowed to write only within
its Android application space, at least in the internal
storage.

Libor Striz

unread,
Dec 30, 2020, 9:16:36 AM12/30/20
to
Libor Striz <poutnik4R...@gmailCAPITALS.com.INVALID> Wrote
in message:

> Without jail breaking, termux is allowed to write only within its Android application space, at least in the internal storage.

See
https://wiki.termux.com/wiki/Internal_and_external_storage
0 new messages