2

I'm trying to execute this command busybox ln -s "mydir/" "$PWD"/mylink in order to create a symbolic link from mydir; that, I am receiving the following error ln: /mnt/shell/emulated/0/mylink: Function not implemented! I've tried this in both adb shell and Android Terminal Emulator but to no avail.

Update:

Filesystem           1K-blocks      Used Available Use% Mounted on
tmpfs                   496976        64    496912   0% /dev
devpts                       0         0         0   0% /dev/pts
proc                         0         0         0   0% /proc
sysfs                        0         0         0   0% /sys
selinuxfs                    0         0         0   0% /sys/fs/selinux
debugfs                      0         0         0   0% /sys/kernel/debug
none                         0         0         0   0% /acct
tmpfs                   496976         0    496976   0% /mnt/secure
tmpfs                   496976         0    496976   0% /mnt/asec
tmpfs                   496976         0    496976   0% /mnt/obb
tmpfs                   496976         0    496976   0% /mnt/fuse
none                         0         0         0   0% /dev/cpuctl
/dev/block/mmcblk0p1    774064    420392    353672  54% /system
/dev/block/mmcblk0p2    431368     94172    337196  22% /cache
/dev/block/mmcblk0p8  59034284   5817516  53216768  10% /data
/dev/fuse             59034284   5817516  53216768  10% /mnt/shell/emulated
/dev/block/vold/179:49
                      31632380  25335912   6296468  80% /storage/sdcard1
//192.168.0.1/sdcard  30584780  23082428   7502352  75% /mnt/routersd
//192.168.0.1/sdcard  30584780  23082428   7502352  75% /mnt/shell/emulated/0/routersd
0

2 Answers 2

7

The filesystem you're trying to create the symbolic link on doesn't support symbolic links. All the native Linux filesystems (ext2-4) support symlinks, but the DOS filesystem used on SD cards doesn't, and several others don't. For a filesystem implemented with FUSE (as in this case), it's entirely up to the filesystem driver, so you can't tell whether it supports symlinks or not without trying. You won't be able to create symlinks on those filesystems.

5
  • that is not external sdcard (fat/fat32) but the internal storage; supposedly with ext2-4.
    – David
    Jan 21, 2016 at 13:15
  • @DavidDe It's different from phone to phone, but I'm pretty sure anything in /mnt/*/emulated is going to be its own filesystem, most likely using vfat or some RAM disk format. You can check by running mount and looking for that path.
    – Dan Hulme
    Jan 21, 2016 at 13:39
  • see UPDATED section; that is the output of busybox df -a
    – David
    Jan 21, 2016 at 14:00
  • e.g. busybox ln -s /mydir2/ /mylink2 works like a charm in root directory; the problem continues within the internal stroage namely /sdcard.
    – David
    Jan 21, 2016 at 14:03
  • 1
    @DavidDe FUSE (it is another filesystem now) implementation of /data/media/ at /mnt/shell/emulated doesn't support symbolic links in Android. No matter what trick you use, you won't be able to make any use of symbolic links. You can try creating one under /data/media/0/ but as said, when accessed from /sdcard, it would just fail. // You can ask a conceptual question why FUSE used by Android doesn't have such a feature and what kind of filesystem is mounted under /mnt/shell/emulated? That should be asked as a new question, of course.
    – Firelord
    Jan 21, 2016 at 14:31
0

Found a really smart workaround to bypass this issue

  • First, we have two environments(I will be referring to them later on)

    • The android environment

    • The chroot environment

  • We want to create a symbolic link from the chroot to the android environment

  • We can't do that directly so what we do instead is create a directory inside the chroot environment called sym_links. This directory will contain symlinks

  • I also gave the sym_links directory all permissions and made it owned by everybody so that we don't face any permission complications

chown 9997:9997 /PATH/TO/sym_links -R
chmod 777 /PATH/TO/sym_links -R
  • Then we will create a symlink to our desired file while being in the android environment then place that symlink we just created inside the sym_links directory.

  • Then in the android environment, we will mount bind the sym_links directory to an empty directory inside the sdcard while making sure that we are executing this from a global mountspace as root

su -mm
#execute mount commands here

And there you go, you have created a symlink inside the sdcard

How to create a mount bind

mount -o bind /PATH/TO/SOURCE_DIR /PATH/TO/DESTINATION_DIR

How to access global mountspace(using magisk's su)

su -mm

TL;DR: Create symbolic link pointing to your desirable file from within an android environment, place the symbolic link you just created in an environment that can handle symbolic links for eg: chroot environment (or any other path as long as it isnt inside sdcard). Access the global mountspace then create a mount bind from the directory containing the symlink to a directory inside the sdcard

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .