Page 1 of 1

Unable to edit files in /system

Posted: 2017-04-18, 13:40 UTC
by benboggart
I am unable to save changes to /system/etc/media_paths.xml, always getting
Fehler beim Schreiben in Datei
Temporarily, access rights of the file - and for good measure also those of /system and /system/etc - are all set to 777.
/system is rw-mounted via the dedicated button in TC, or via the respective automatic dialoge - both being followed by "Re-Mount erfolgreich"

I'm quite the noob regarding android, but familiar with other linuxes. This is a first, and I'm running a stable but unofficial Lineage OS (Nougat 7.1.1) with root access being enabled via the developer option tick. (For reference, the bloated ES File Explorer is capabable of editing the file in question. And TC is capable of, e.g., creating a new folder in /system/etc))

When trying to figure out what's not working, I stumbled across something which may or may not have something to do with it. In a terminal emulator, and before enabling rw, the response to mount is
as user:
/dev/block/platform/msm_sdcc.1/by-name/system/ on /system type ext4 (ro,seclabel,relatime)
as su:
/dev/block/mmcblk0p21 on /system type ext4 (ro,seclabel,relatime)
After enabling rw via the TC button, the response is
as user:
/dev/block/platform/msm_sdcc.1/by-name/system/ on /system type ext4 (ro,seclabel,relatime)
as su:
/dev/block/mmcblk0p21 on /system type ext4 (rw,seclabel,relatime)
Disabling rw via TC set me back to the initial state. And a mount -o remount,rw /system from the terminal emulator gives me the same results.

I have no clue, whether these dual (?) mount points are default android behvaiour, and whether this may disturb TC, but I'll be grateful for any hints on how to solve the problem at hand. Thanks!

Posted: 2017-04-18, 13:56 UTC
by ghisler(Author)
Try the latest beta. Android 7 doesn't accept the usual remount command, it requires a slightly different parameter:
mount -o rw,remount /system

Posted: 2017-04-18, 14:15 UTC
by benboggart
Thanks for the quick reply!
Are you sure about the parameter order change? Because when entered via Terminal Emulator, -o remount,rw or -o rw,remount do not produce different results for either su or user - and thus the exact same result as the released TC. At least it appears so from the output of mount. Where should differences become visible?

ps: In the meantime I try to figure out, how a beta can be installed. I gues Play Store isn't the way to go, right?

Posted: 2017-04-18, 14:33 UTC
by ghisler(Author)
It may depend on the manufacturer and ROM, but in general Android 7 only accepts the new parameter order.

To get the beta from play store, click here:
https://play.google.com/apps/testing/com.ghisler.android.TotalCommander

Posted: 2017-04-18, 15:57 UTC
by benboggart
I've just installed the beta. As tested in the Terminal Emulator command line before, for TC too, the behaviour remains exactly as described in the initial post.

I don't think this is an issue of the command itself. It does mount with rw privileges for su as it's supposed to. These privilege changes are just not extended to the user/editor who apparently sees /system via a different mount point where it remains read-only.

Is this "dual" mount point approach standard for android?

Posted: 2017-04-20, 08:57 UTC
by benboggart
Sorry to bother you - but do you agree with my explanation or do you suspect something else?

If this will be adressed in the forseeable future, I'm absolutely willing to wait this out and install/deinstall ES File Explorer whenever I need to edit system files, but otherwise I'd try to get comfortable with some alternative.

Thanks!

Posted: 2017-04-20, 12:52 UTC
by ghisler(Author)
Which editor do you use? The built-in editor does request root rights too to write to such a system file. What you can try is check and (if necessary) change the file permissions (via properties). If this file is set to read only, saving it will fail.

Posted: 2017-04-20, 19:55 UTC
by benboggart
This is not the issue here; please see to my initial post:
access rights of the file - and for good measure also those of /system and /system/etc - are all set to 777.
The editor (yes, the built-in) cannot save despite all rights being set to 777.

Fact is, the TC rw-button does only provide su with rw-access to /system, while the user (and thus the editor) remains with ro-access. As detailed above, my guess is this occurs due to the dual mount points, but I know too little about android to be certain.

Posted: 2017-04-23, 21:21 UTC
by benboggart
Hi! Again, I'm sorry to bother you, but I still very much like to know whether you agree with my explanation or suspect something else.

I am in no way pushing for you to solve anything; at this point I'd just like to know whether you're aware of and understand the actual issue, and whether this will be adressed in the forseeable future of TC.

Posted: 2017-04-24, 12:38 UTC
by ghisler(Author)
I don't know why it fails for you. Maybe the parent directory is set to read only...

Posted: 2017-04-24, 21:48 UTC
by benboggart
Actually, I would really appreciate if you could just for once give your opinion on my explanation with the dual mount points.

I've addressed your last suggestion "Maybe the parent directory is set to read only" as well as the previous one "change the file permissions" already in the opening post, so you have me feel a bit stupid now. Assuming, you are really in a hurry and just skimming through the respective last post of this thread I could once more reply with that quote
access rights of the file - and for good measure also those of /system and /system/etc - are all set to 777
but again, I would really appreciate if you'd just take the time to consider my explanation and give your opinion on it.

I'll reurgitate said explanation to make is as easy as possible:
  1. We're talking /system/etc/media_paths.xml (example only). Access rights of file and complete path-dirs are set to 777.
  2. Per default, su has /system mounted via /dev/block/mmcblk0p21, whereas user has /system mounted via /dev/block/platform/msm_sdcc.1/by-name/system.
  3. TC's RW-button initiates the remount command with su-rights. The rw-remount of /dev/block/mmcblk0p21 onto /system is successful, and su gains write access.
  4. The remount does not affect the mount point /dev/block/platform/msm_sdcc.1/by-name/system, and thus the user does not gain write access to /system.
  5. TC's editor does not gain write access, since it is operating with user rights.
Please let me know if you want me to detail any of the points, or if you find them plausible and agree the remount does not work as intended.