I have mounted an ISO at /mnt. The ISO is android's system.img. At the root it has a folder etc that is linked to /system/etc:

lrw-r--r--  1 root root    11 Dec 31  2008 etc -> /system/etc

But it seems that my linux system does not identify that this symbolic link actually points to a directory INSIDE /mnt, but not to my system root directory.

In the /system/etc/ folder there's a standard hosts file:

$ cat /mnt/system/etc/hosts       localhost
::1             ip6-localhost

I expect cat /mnt/etc/hosts to output the same, but in reality it output:

$ cat /mnt/etc/hosts
cat: /mnt/etc/hosts: No such file or directory

I created a stub file at /system/etc/hosts in my system root and tried again:

$ sudo mkdir /system
$ sudo mkdir /system/etc
$ echo "STUB" | sudo tee /system/etc/hosts
$ sudo mkdir /system/etc
$ cat /mnt/etc/hosts

As expected, it printed contents of /system/etc/hosts instead of /mnt/system/etc/hosts, as I wanted.

I want all symbolic links in the mounted folder /mnt to be resolved as if it was mounted at root /, so all symbolic links are resolved correctly. Is there any way I can do that without actually changing anything in the mounted filesystem (redefining symbolic links to point to /mnt{ACTUAL LINK})?

  • 2
    That's how symbolic links with absolute link targets work. It should be etc -> system/etc to work as you want. You could use a chroot environment.
    – Bodo
    Apr 12, 2023 at 18:19
  • 1
    I highly doubt that it's actually an ISO. It just doesn't make sense to use the ISO9660 filesystem for Android system image.
    – gronostaj
    Apr 12, 2023 at 18:24
  • @gronostaj It's probably not. See the previous question from this user. Apr 12, 2023 at 18:28
  • @Bodo, can I use chroot if there is no executable shell in the mounted folder? The image is android arm32 image, so it has only arm executables, so I get error chroot: failed to run command ‘/system/bin/sh’: Exec format error when I try to use chroot
    – g00dds
    Apr 12, 2023 at 19:12
  • @gronostaj, yeah, sorry, it's not an iso, just a android's .img image file
    – g00dds
    Apr 12, 2023 at 19:14


You must log in to answer this question.

Browse other questions tagged .