[FIX]Fix external SD Card permissions (updated 2012-02-05)

Search This thread

garyd9

Inactive Recognized Developer
Sep 13, 2006
2,643
2,732
53
Pittsburgh, PA
NOTE: Please see the following post for the original modification (as far as I'm aware) and the manual method of doing the same thing: http://xdaforums.com/showpost.php?p=20869996&postcount=7

This "update.zip" style installer simply automates the process of modifying /system/etc/permissions/platform.xml to make the tablet permissions act the same as previous versions of android.

In particular, programs with the WRITE_EXTERNAL_STORAGE permission will be able to write to the removable storage card. (Honeycomb changes this to require WRITE_MEDIA_STORAGE which very few, if any, 3rd party programs use.)

If you are having issues with programs writing to your storage card, this might fix it.

This uses 'sed' to make the edits. If this is installed twice, it won't re-modifying the file. (However, if you have manually edited the platform.xml file, and then run this script, it might make create duplicate, but harmless, <group> entries. Before making the modification to platform.xml, it will create a backup of the file (called platform.xml.backup) in the /system/etc/permissions directory (if the backup doesn't already exist.)

Instructions:

Download the file, and place on your sdcard. Reboot into recovery and install .zip from sdcard. Choose this file. Done..

(I've tested this with my CWM based recovery and it works. It _should_ work with the factory recovery as well, but I haven't tested... Please reply with your results.)

Support:

None. If you aren't familiar with using recovery to install updates, you should research the topic before continuing.

More info:

If you are curious, here is the sed command I'm sending, using busybox compiled from the cyanogenmod sources:
Code:
sed -e '/WRITE_EXTERNAL_STORAGE" >$/N;s/\n\(\([ \t]*\)<group gid="sdcard_rw".*$\)/\n\2<group gid="media_rw" \/>\n\1/' -i /system/etc/permissions/platform.xml
What that means is: do an "in-place" edit on /system/etc/permissions/platform.xml, and find the line containing "WRITE_EXTERNAL_STORAGE >", then if the next line contains some whitespace followed by "<group gid="sdcard_rw" />", replace that sdcard_rw line with two new lines, the first being "<group gid="media_rw" />" and the second being the exact line that contained "sdcard_rw". I purposely put the media_rw line before the sdcard_rw line to prevent this same sed command from finding the same match again. In other words, if you run this sed command 50 times on the same file, it'll only make the change the first time.

(I'm not fluent with sed, so if someone knows a better way to do that, please feel free to educate me.)

File is attached below...

UPDATED Feb 5th, 2012: the script will change the filesystem permissions of the platform.xml file before attempting to edit it. This MAY overcome issues people have been having with non-rooted devices, but I'm unable to test so I don't know. Okay, well, it appears that this won't work for a device that doesn't have CWM Recovery installed. Not sure why, but at least I've repeated it.


Take care
Gary
 

Attachments

  • fix_perms_20120205.zip
    683.7 KB · Views: 17,366
Last edited:

garyd9

Inactive Recognized Developer
Sep 13, 2006
2,643
2,732
53
Pittsburgh, PA
I assume this is for the 6210, but will it work for all versions?
It should, but I have no way to test. I can tell you that it won't cause any harm. Go ahead and install it, and then (using adb or a file explorer tool) copy the /system/etc/permissions/platform.xml (and platform.xml.backup) files and compare them (or send them to me and I'll compare them) to verify.
 

ringnutz

Senior Member
It should, but I have no way to test. I can tell you that it won't cause any harm. Go ahead and install it, and then (using adb or a file explorer tool) copy the /system/etc/permissions/platform.xml (and platform.xml.backup) files and compare them (or send them to me and I'll compare them) to verify.

I have the 6210 as well, just wanted to clarify to cut down on the inevitable questions that would follow. Thanks again

Sent from my Galaxy Tab 7 Plus
 

Zadeis

Senior Member
Dec 31, 2011
438
98
Absolutely fine here. Before I couldn't move files to the SD card using AirDroid now I can :D
 

guags99

Senior Member
Apr 6, 2008
63
4
Thanks for this. I started to script a fix for this but then I found yours. Thanks again!a
 

vs_infinity

Senior Member
Jun 6, 2011
59
13
Tested! It works for galaxy tab 7.0 Plus P6200,
nice work garyd9


Sent from my GT-P6200 using xda premium
 
Last edited:

garyd9

Inactive Recognized Developer
Sep 13, 2006
2,643
2,732
53
Pittsburgh, PA
It does not work on non-root P6210. :confused:
That doesn't make sense. What leads you to believe that it didn't work? Which program/option isn't working how you expect (and how do you expect it to work?) (sorry for all the questions, but if I can't repeat exactly what you are experiencing, I can't really help you.)

Do you have some kind of file explorer installed? If so, please browse to /system/etc/permissions and view the "platform.xml" file. Scroll down to find the line with "WRITE_EXTERNAL_STORAGE". There should be two lines below that that start with "<group gid". One should have the string "media_rw" and the other "sdcard_rw". If so, then the fix DID apply properly.

"root" shouldn't matter for this...
 

Brightxda

Senior Member
Dec 18, 2008
59
7
There is no change to the "platform.xml" after I installed the .zip under the recovery though it shows install completed. I even repeated it twice. It fails when I use ES file explorer to create a folder in ext. SD Card.

Then I rooted the device and manually modified the "platform.xml" (added the <group gid="media_rw" />), and it works now.
 

hokuto34

Senior Member
Oct 10, 2010
159
20
Agde (France)
Yes I done the same after root, but I have to change the attribut ( sorry I' french) of "platform.xml" with Root explorer to write before (long press on the name), then I access to "platform.xml" with es file explorer to add the code line, save the file and reboot. and it works now (for model 6210)

"platform.xml" is at system/etc/permissions/

add

</permission name=android.permission.WRITE_EXTERNAL_STORAGE" >
<group gid="media_rw" />
</permission>
 

garyd9

Inactive Recognized Developer
Sep 13, 2006
2,643
2,732
53
Pittsburgh, PA
Okay, if the attributes of the file aren't allowing writing, then I'm obviously not allowing for that in the package. It seemed like a reasonable assumption that the file was writable, being that it worked for so many people...

I wonder why samsung isn't being consistant with the file permissions. Well, that's something I can probably fix in an update. Not a big deal to change perms on a file. :)

(It's also not a high priority, as this is working for the majority of people without me tinkering with file permissions.)

take care
Gary
 

Mochan

Senior Member
May 18, 2007
131
0
Manila
I have a P6200, no root and using stock recovery as of this writing.

I had a P6210 and I was able to fix External SD Card writing on it manually.

I tried the .zip in this thread and it didn't work on my P6200.
I am thinking it didn't because my device is either rooted, or using stock recovery.

I will root and perhaps install CWM, and test further.


My test was using ES Explorer to create a new directory in the SD card. It couldn't, so I'm pretty sure the fix didn't work with my particular configuration.

That doesn't make sense. What leads you to believe that it didn't work? Which program/option isn't working how you expect (and how do you expect it to work?) (sorry for all the questions, but if I can't repeat exactly what you are experiencing, I can't really help you.)

Do you have some kind of file explorer installed? If so, please browse to /system/etc/permissions and view the "platform.xml" file. Scroll down to find the line with "WRITE_EXTERNAL_STORAGE". There should be two lines below that that start with "<group gid". One should have the string "media_rw" and the other "sdcard_rw". If so, then the fix DID apply properly.

"root" shouldn't matter for this...

Wait... how can you get into /system/etc/permissions if you haven't rooted the device? I was of the impression that you can only access that directory if you are rooted. I certainly can't get there.

I was able to on my P6210 when it was rooted.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 26
    NOTE: Please see the following post for the original modification (as far as I'm aware) and the manual method of doing the same thing: http://xdaforums.com/showpost.php?p=20869996&postcount=7

    This "update.zip" style installer simply automates the process of modifying /system/etc/permissions/platform.xml to make the tablet permissions act the same as previous versions of android.

    In particular, programs with the WRITE_EXTERNAL_STORAGE permission will be able to write to the removable storage card. (Honeycomb changes this to require WRITE_MEDIA_STORAGE which very few, if any, 3rd party programs use.)

    If you are having issues with programs writing to your storage card, this might fix it.

    This uses 'sed' to make the edits. If this is installed twice, it won't re-modifying the file. (However, if you have manually edited the platform.xml file, and then run this script, it might make create duplicate, but harmless, <group> entries. Before making the modification to platform.xml, it will create a backup of the file (called platform.xml.backup) in the /system/etc/permissions directory (if the backup doesn't already exist.)

    Instructions:

    Download the file, and place on your sdcard. Reboot into recovery and install .zip from sdcard. Choose this file. Done..

    (I've tested this with my CWM based recovery and it works. It _should_ work with the factory recovery as well, but I haven't tested... Please reply with your results.)

    Support:

    None. If you aren't familiar with using recovery to install updates, you should research the topic before continuing.

    More info:

    If you are curious, here is the sed command I'm sending, using busybox compiled from the cyanogenmod sources:
    Code:
    sed -e '/WRITE_EXTERNAL_STORAGE" >$/N;s/\n\(\([ \t]*\)<group gid="sdcard_rw".*$\)/\n\2<group gid="media_rw" \/>\n\1/' -i /system/etc/permissions/platform.xml
    What that means is: do an "in-place" edit on /system/etc/permissions/platform.xml, and find the line containing "WRITE_EXTERNAL_STORAGE >", then if the next line contains some whitespace followed by "<group gid="sdcard_rw" />", replace that sdcard_rw line with two new lines, the first being "<group gid="media_rw" />" and the second being the exact line that contained "sdcard_rw". I purposely put the media_rw line before the sdcard_rw line to prevent this same sed command from finding the same match again. In other words, if you run this sed command 50 times on the same file, it'll only make the change the first time.

    (I'm not fluent with sed, so if someone knows a better way to do that, please feel free to educate me.)

    File is attached below...

    UPDATED Feb 5th, 2012: the script will change the filesystem permissions of the platform.xml file before attempting to edit it. This MAY overcome issues people have been having with non-rooted devices, but I'm unable to test so I don't know. Okay, well, it appears that this won't work for a device that doesn't have CWM Recovery installed. Not sure why, but at least I've repeated it.


    Take care
    Gary
    2
    how does work this fix?i install this fix and now ,,,i can change sd subfolder from mount r/w to r/o in root explorer but nothing changes.i cant change installations pathway to ext sd card yet.....
    no guide????

    Have you read the first post in this thread? That's the entire guide.

    Sent from my GT-N7000 using Tapatalk
    2
    Hi guys, I don't know why but my P6200 manually modified with

    <permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
    <group gid="media_rw" />
    <group gid="sdcard_rw" />
    </permission>

    isn't able to move apps on sd using app2sd.:(
    I've alway the msg that that the sd is emulated.
    The sd mounted works with the file mgr.

    Suggestion?:confused:
    Thank you all. :)