chmod failed "Unable to open FILE: invalid argument" Device-info:


Phone: Sony Xperia Z1
Model number: C6903
Android version: 5.1.1
Build Number: 14.6.A.1.236
Rooted


In order to solve another problem on my phone I want to change permissions of a folder and subfolder recursively:

chmod -R 777 /data/local/mnt in the Terminal Emulator app in su mode.

The folders under mnt are another linux system (with typical folders like dev,etc,home,mnt...)

After executing chmod (like above) I get some Error like:

Unable to open /data/local/mnt/usr/include/pnglibconf.h: No such file or directory

But pnglibconf.h exists and it is not just one File which cause the error. So if I execute chmod -R 777 /data/local/mnt/dev I get the error:

Unable to open /data/local/mnt/dev/video39: Invalid argument

So such an error Unable to open /path/to/file/ nearly happens to every subfolder I execute chmod on.

So what causes the error and how to fix it?
First, try updating BusyBox.

However, I doubt it will help you much, because you are trying to modify very internal Linux "files" that may not even be files or block devices, or be in another filesystem (like ext4 while your phone may use f2fs etc.), or be corrupted. Maybe it's problem with file owner, I don't really know.

What I know, however, is that it's not good idea to run chmod -R 777 on Linux internal files