SD Card no writing permission in FP2

How do I get root access on the FP2?

There are some ways to get it and they are all listed here:

https://forum.fairphone.com/t/living-with-root-and-google-on-the-fp2/11944?u=paulakreuzer&source_topic_id=11841

when I try to re-push after modifying the platform.xml adb says:

cannot stat ‘permissions.xml’: No such file or directory

So I tested the “adb devices”-command an my phone is displayed as

e503c01f device

Now I tried the “adb remount”-command but the system says:

remount of system failed: Permission denied

So how do I get my edited xml-file back?

Do you have your phone rooted?
This is necessary.

Are you on stock ROM? Then you need to

adb shell

Into your phone and continue as root, by typing

su

Then you should be able to remount your /system partition by using

mount -o rw,remount /system

Finally, exit the shell (type “exit” twice). Now it should be possible to push the file back. Note that you want to push the file platform.xml and not permissions.xml (there is a small mistake in the guideline above).

For a more detailed description of this approach you can also have a look at the bottom of the wiki here.

2 Likes

Thank you for helping a beginner!

Yes! Since today!

I think so because I didn’t create my own image. I used 2.B) :slightly_smiling:

When I did that it went like this:
E:\ProgrammeAuf_E\Kommunikation\Minimal ADB and Fastboot>adb push platform.xml /
system/etc/permissions/platform.xml
failed to copy ‘platform.xml’ to ‘/system/etc/permissions/platform.xml’: Permiss
ion denied

E:\ProgrammeAuf_E\Kommunikation\Minimal ADB and Fastboot>adb shell
shell@FP2:/ $ su
root@FP2:/data/data # mount -o rw,remount /system
root@FP2:/data/data # exit
shell@FP2:/ $ exit

E:\ProgrammeAuf_E\Kommunikation\Minimal ADB and Fastboot>adb push platform.xml /
system/etc/permissions/platform.xml
failed to copy ‘platform.xml’ to ‘/system/etc/permissions/platform.xml’: Permiss
ion denied

Where is my mistake?

I see.

This most likely because you’ll need su rights also for copying the file to the system partition, so after logging out you are no longer “su” on the phone.

If you have a sdcard in your phone, you can copy the file there first, and then to the /system partition.

so it would be first:

adb push platform.xml /storage/sdcard1/platform.xml

then

E:\ProgrammeAuf_E\Kommunikation\Minimal ADB and Fastboot>adb shell
shell@FP2: su
root@FP2: mount -o rw,remount /system
root@FP2: cp /storage/sdcard1/platform.xml /system/etc/permissions/platform.xml

An other option would be: If you have busy box installed, you could edit the file directly on the phone. A description how to do that is at the very end of the wiki in the “how to root” thread.

3 Likes

I have my FP2 now 7days and tried 3 mirco SDs - I formated them several times in the FP2 and all of them are working perfectly on my FP1 - but I can not write on any of them in my FP2.
When I try to create a folder on the micro SD with amaze e.g., amaze informs me “unfortunately, amaze has stopped”…and stops. When I try it with other explorers (I tried 3 of them by now) they inform me that I have no writing permisson.
Not enough, the external SD vanishes at least 4 times/day and I have to mount it again, and with “mount” I mean I have to open the phone and physicaly get it out mount it back in, the promt “mount SD” won’t work.

Are there solutions without rooting?
I am using my FP1 again, because it is realy getting my nerves now :frowning:

As I understood it is an Android security measure which does not allow to write to the SDcard by default. For changing this and granting general write permissions apparently su rights are necessary (i.e. the device needs to be rooted).

That the SDcard unmounts/disappears has been reported before, though I don’t know what the cause was or how to solve the problem.

Wouldn’t an adb root before pushing suffice ?

I think on the stock ROM adb root unfortunately doesn’t work, it gives you the error message “adbd cannot run as root in production builds”.

1 Like

Ok, I tried:

since I couldn’t see “cp” in the entered string after execution I entered the command again and executed again. Is that a critical mistake?

After that I did a reboot and launched K9 trying again to store an attachement on my sdcard1.
But it didn’t work: “Anhang konnte nicht auf die sd-Karte gespeichert werden”.

Also I had a few error-messages saying that youtube, google-play dienste an google maps were terminated and so Threema isn’t working any more too!

Now I try to push back the originally pulled platform.xml (I am so glad that I stored it for security reasons…) in order to have my phone working again…

Maybe I try that busybox thing afterwards but I couldn’t find it at the end of the topic that you have mentioned.
Do you mean that app http://busybox.net/downloads/busybox-1.24.1.tar.bz2 ???
Can my phone install such a file? I don’t use google play any more.

Thanks very much for helping me!

I see. I guess the problem with that approach also was that - what we are trying to solve - you have no rights to write to the SD.

However, if you still have the mail in K9, just save it to the default directory, which for me is /storage/sdcard0/Download - which is just the regular Download folder on the internal storage. Then you could take the file from there (or wherever else K9 is saving your file to; you would then just need to change the file location in the cp command below).

So after storing the file there, the steps would be:

E:\ProgrammeAuf_E\Kommunikation\Minimal ADB and Fastboot>adb shell
shell@FP2: su
root@FP2: mount -o rw,remount /system
root@FP2: cp /storage/sdcard0/Download/platform.xml /system/etc/permissions/platform.xml

About busy box: there are several apps that provide busy box. I currently use this one.
Many apps that need root rights actually also need a busy box installed. Basically it brings many features from a linux terminal (small programs, like vi, wget etc.) onto an Android device. In this case, vi is the key fetaure (a simple text editor for the terminal).
This would work like this:

adb shell
su
mount -o rw,remount /system
vi /system/etc/permissions/platform.xml

edit the file as suggested above and exit vi by typing

:x

and exit su & shell.

First of all I want my phone to work again.
Therefore I tried to repush the originally pulled platform.xml like this:

So that didn’t work. I thought to manually erase the platform-file on my sdcard hoping that the push would work afterwards. But there insn’t any any more! Also amaze doesn’t show sdcard0 any more. Giving root to amaze it shows me at least the root.
So how do I get my phone working again ak how do I get back the original platform.xml?

ah, ok, now I understand your advice- ok I try!

  • as expected K9 can’t receive mails any more. So I should try a push to the root-folder, I guess?

Are you sure the original platform.xml is gone from the phone?
The adb pull command should only have copied the file to the computer, but not cut it.
In any way, we’ll get the modified version to the right place :slightly_smiling:

I am just not sure what happens if the platform.xml is missing, i.e. where else you could push the file to, since I think it contains necessary information on how to mount some drives.

Actually, I just figured out that with Amaze it is possible to edit the files in place :grinning:

So the easiest thing would be to point Amaze to /system/etc/permissions, mark the platform.xml, click “open with”, and choose the Amaze text editor. Then you can edit the file easily there!

In case you have lost the file, you can also point Amaze to /system/etc/permissions and create a new platform.xml file (You can copy the content from the platform.xml you have edited).

Haven’t figured that earlier, but I guess that it might be the simplest solution. Just make sure that you have granted superuser rights to Amaze.

2 Likes

This worked for me while the push command did not go through either.

Thanks for still searching a solution for me!
OK, I did open it with amaze and I am surprised:

Seems like the edited file is actually there where we tried to send it. Was my editing correct? Because my phone is still not properly working…

I’d say the file is corrupt that way. You probably used an editor that tried to be clever and substituted (at least) < and> with escape notation.

Sounds like an explanation. I still got the original not modified file on my pc. So I should try to get that back again?