[FIX]Fix external SD Card permissions (updated 2012-02-05) - Samsung Galaxy Tab Plus

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://forum.xda-developers.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

I assume this is for the 6210, but will it work for all versions?
Sent from my Galaxy Tab 7 Plus

Sweet, thinking about flashing this. Will it work on non-root systems?

ringnutz said:
I assume this is for the 6210, but will it work for all versions?
Click to expand...
Click to collapse
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.

pacmanftw said:
Sweet, thinking about flashing this. Will it work on non-root systems?
Click to expand...
Click to collapse
It should, but I haven't tested it. It shouldn't cause any harm, however, so feel free to try it.

garyd9 said:
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.
Click to expand...
Click to collapse
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

Worked perfectly for me.

Absolutely fine here. Before I couldn't move files to the SD card using AirDroid now I can

Yup... its working fine with my plus...
Sent from my GT-P6200 using xda premium

Thanks for this. I started to script a fix for this but then I found yours. Thanks again!a

It's work for P6200

thank you gary it worked for me!!!

Still the same hier, it worked for me
P6200

Tested! It works for galaxy tab 7.0 Plus P6200,
nice work garyd9
Sent from my GT-P6200 using xda premium

garyd9 said:
It should, but I haven't tested it. It shouldn't cause any harm, however, so feel free to try it.
Click to expand...
Click to collapse
It does not work on non-root P6210.

Brightxda said:
It does not work on non-root P6210.
Click to expand...
Click to collapse
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...

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.

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>

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

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.
garyd9 said:
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...
Click to expand...
Click to collapse
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.

Related

Froyo Rom Manger fix permissions fix?

I have spent all morning trying to get rom manager to fix permissions and have finally tracked down the culprit. the fix_permissions script is looking for /data/system/packages.xml. At least with perception 4 it is in /dbdata/system/packages.xml
I have edited the file and attached it.
First the rename and drop the .txt. the actual name of the file is fix_permissions
Copy to sdcard.
Using root explorer copy it to /data/data/com.koushikdutta.rommanager/files
(good idea to back up the other one first.)
Issue I have is after I reboot, the file resorts back to the old file.
Not sure why.
If you want to edit the file directly in root explorer, there were 4 instances of the /data/system/packages.xml
!!All credits go to the developers of rom manager and associated programs within it!!
I for the life of me cannot figure out why the file keeps changing.
So the best thing i can think of is to load it to the sdcard.
Using terminal emulator cd /mnt/sdcard and then sh the file.
Quickest diretiest way to get it to work.
I hope it helps someone out there.
Code:
su
cd /mnt/sdcard
sh fix_*
Thank you--if it helps, I simply copied the packages.xml file into /data/system/ in order to run fix_permissions, and then just deleted the .xml file.
A temporary fix, yes, but I was just trying to fix a specific problem with ending phone calls causing an FC (see http://forum.xda-developers.com/showthread.php?p=9943863#post9943863).
Thanks, your fix worked for me as well...
jnagar said:
Thank you--if it helps, I simply copied the packages.xml file into /data/system/ in order to run fix_permissions, and then just deleted the .xml file.
A temporary fix, yes, but I was just trying to fix a specific problem with ending phone calls causing an FC (see http://forum.xda-developers.com/showthread.php?p=9943863#post9943863).
Click to expand...
Click to collapse
--Much appreciate the suggested fix. Worked like a charm.
do you have to delete the packages.xml afterwards?
what will happen if I just leave it in the data/system folder instead of copy/pasting it every time?
Oh ant thanks SO much. Really needed to be able to fix permissions after Nero v5 started to act crazy yesterday.
pushabutton said:
what will happen if I just leave it in the data/system folder instead of copy/pasting it every time?
Oh ant thanks SO much. Really needed to be able to fix permissions after Nero v5 started to act crazy yesterday.
Click to expand...
Click to collapse
I haven't played with this in awhile, but it seemed that it was overwritten every time Rom manager started.
I'll play around with this and see what I can come up with as a more permanent solution.

Root Explorer not copying

Hi,
I tried to copy an API to /system/app, but when I did that, the screen just blinks, and the file is not pasted into the directory.
I had temp root, and had remounted R/W.
I eventually was able to do the copy by using ES Explorer, but not with RE itself.
Does anyone have any idea what might be wrong?
Thanks,
Jim
Don't know if this helps but... I recently tried to do some copying of files using AndRootFile, and RootExplorer. And like you they did not "take". I finally figured out that after I selected a file to copy, I would use the back arrow button to move to the target folder. This was the problem. When I used the Parent folder icon instead to move back out of the folder, and move to the destination folder without using the back arrow button. the file copied just fine. Hope this helps.
Reggie,
Thanks for the suggestion, but, no, I wasn't using the "back" to get to the /system/app directory. I was clicking on the parent dir, etc.
Jim
I also am having that problem. I tried both the back buttons and the parent directory. Ive tried factor data reset as well. I wander if it has anything to do with the update yesterday?
Until we/someone figures why, you can use root explorer to mount, then the built in es explorer to do the copy...
Jim
I've been doing some stuff w/command line, and I noticed that my stock Gtab doesn't have a native 'cp' command, so you have to use 'busybox cp' instead. I wonder if that's why the RE copy/paste doesn't work?
Jim
SOLVED - it was no native 'cp'
jimcpl said:
I've been doing some stuff w/command line, and I noticed that my stock Gtab doesn't have a native Cp command, so you have to use 'busybox cop's instead. I wonder if that's why the RE copynpasre doesn't work?
Jim
Click to expand...
Click to collapse
Hi,
I just tried a test, where I created a softlink for 'busybox cp':
ln -s /system/bin/busybox /sbin/cp
I then was able to use RE to copy/paste into /system/app !
CAVEAT: I don't know if busybox is on Gtab by default...
Jim
At the command line us cp vs Cp. If you want to copy an entire directory, use cp -R /indirectory /outdirectory .
NMCBR600 said:
At the command line us cp vs Cp. If you want to copy an entire directory, use cp -R /indirectory /outdirectory .
Click to expand...
Click to collapse
Hi,
That was a typo on my part. The 'cp' command (lowercase c) was really missing in my Gtab .
I've been experimenting w/alternate keyboards, and keep making typos ...
Jim
P.S. I fixed the typos ...
jimcpl,
I was just working on putting Market onto my stock machine and I am having the exact same problem. So far as I can see I have set it up right and followed procedure -- but files just won't move.
Now that I have read y'all's comments, I will try again a time or two.
Rev
butchconner said:
jimcpl,
I was just working on putting Market onto my stock machine and I am having the exact same problem. So far as I can see I have set it up right and followed procedure -- but files just won't move.
Now that I have read y'all's comments, I will try again a time or two.
Rev
Click to expand...
Click to collapse
Hi,
BTW, to create the softlink (using ln), you'll need to use adb shell. Or, you could use a terminal, if one's installed (kind of catch 22, since you'd need market to get a terminal).
Otherwise, what might work is:
- z4root to get root
- root explorer to make /system R/W
- kill then restart es file explorer and use that to copy the apks to /system/app
Jim
SIGH ... softlink doesn't survive a reboot
It looks like the softlink that I created disappears after a reboot... then RE can't copy again.
Sorry...
Jim

[Q] How to copy a /data file from unrooted Nexus S [I9020XXKD1]?

Hi there,
Is there a way to temporary root my Nexus S [I9020XXKD1] or alternatively a non-root way to access /data so that I can copy a file in and out? Essentially I want to be able to backup and restore some game saves
Most posts I've read basically have folks saying "Just root it", which is good advice to most but isn't right for me - I really don't want to have to wipe my phone and I'd also like to be able to dip my toe into rooting before taking a full leap. That, and aside from needing this one file in /data my phone works exactly as I'd like it to
I only need "su" access for a brief moment to copy off a file to and from /data. I set up the android sdk but ADB didn't work because of the protection of "production builds".
VISIONary seemed like the right kind of thing, but I don't believe it works for the Nexus S or recent firmware, so while temp rooting would be nice so would any solution that allows me to backup and restore some files in /data.
At the moment I am wondering if writing an apk of my own that copies/replaces this one file is the way to go - but that seems perversely long way around!
So any help/suggestions most appreciated
There is no temporary root for the Nexus S. You're either rooted, or you're not. However, if, perchance, you are on Android 2.3.2 or earlier, you might be able to root without wiping.
Without root, you cannot see the files in /data, but you can read/write the files directly if they have the proper permissions and you know the exact path/filenames. After poking around a bit, it seems that read & write permissions vary among apps. Most apps have full permissions reserved for the parent app. Some allow other apps/user to read some files, and read+write others. (The permissions being app-specific, if it can't be done by command line, I doubt it could be done by creating an app, either.)
So, what is the game? Perhaps I can do some exploring.
If you have the old bootloader (2.3.2 i think) you can boot a recovery without flashing. From you computer use "adb boot recovery.img" and boot clockwork recovery. From there you can mount and access the filysystems.
Sent from my Nexus S using XDA App
Maximilian Mary said:
There is no temporary root for the Nexus S. You're either rooted, or you're not. However, if, perchance, you are on Android 2.3.2 or earlier, you might be able to root without wiping.
Without root, you cannot see the files in /data, but you can read/write the files directly if they have the proper permissions and you know the exact path/filenames. After poking around a bit, it seems that read & write permissions vary among apps. Most apps have full permissions reserved for the parent app. Some allow other apps/user to read some files, and read+write others. (The permissions being app-specific, if it can't be done by command line, I doubt it could be done by creating an app, either.)
So, what is the game? Perhaps I can do some exploring.
Click to expand...
Click to collapse
Thanks I figured as much. The game is Dungeon Hunter 2 and essentially I am trying to implement a simple fix to make my save game work again (the fix is here: http://forum.xda-developers.com/showthread.php?t=1042675 a few posts down) but it requires root. So I do know the exact paths and filename.
Thank you for your helpful answer
Ok, I'm not having any luck here, and it's pissing me off. FYI, I don't have that game, so I'm testing it with Angry Birds. I can read and copy the file just fine, but I can't modify it without using root. The data file itself has read/write access, but the containing folder (files/) is read-only, so I can't overwrite the file after I've modified it. Since the file itself has r/w access, I wonder if it would work to modify the file directly, instead of using an outside program to modify it then overwriting it. (I'm a bit ignorant of the finer points of linux permissions.) This would require an app that would allow you to open and modify a file by typing the full path & filename, instead of just browsing the directory tree. You could also try < adb pull /data/data/com.gameloft.android.TBFV.GloftD2HP.ML/files/dh2_000.savegame dh2_000.savegame > (using the correct path, if that's not it). Then see if < adb push dh2_000.savegame /data/data/com.gameloft.android.TBFV.GloftD2HP.ML/files/dh2_000.savegame > works. The fact that you can copy the file out is promising, anyway. So even if you had to root, you could backup the file before rooting wipes everything, then fix it & back it up after you had root.
Btw, what version of Android are you on?
Edit: I think I'm getting somewhere. While you can't modify the file itself, you can modify the file contents. So something like this might work: < adb shell >
< more /sdcard/dh2_000.savegame > /data/data/com.gameloft.android.TBFV.GloftD2HP.ML/files/dh2_000.savegame >
So the next step is to get some help from someone who has the game and is rooted as to the exact path to the savegame file. Once we have that, I think we're golden. (Or, let me know if adb pull works with the path I guessed at.)
wow! Thank you for your help
In answer to your questions: my Nexus s is running 2.3.4 and you are correct about the file path (many other kind xda users died to bring us those paths ) is /data/data/com.gameloft.android.TB with the filename being dh2_000.savegame
I don't want to drive you to distraction! If I could back it up I probably would go ahead then and root the phone given how complexplaying with a non-rooted phone is!
I will try the adb pull method and let you know how I get on.
Thank you again for your help and for showing me why I probably do want to root!

[Q] Can't delete Mms.odex, "No such file or directory"

I'm trying to use my new Sensation with the SIM from my Japanese iPhone, which requires replacing the stock Mms.apk with one that works with Softbank. That much I managed to do. Now when I try to open the Messaging app it crashes immediately, which is apparently normal and means I need to delete the old Mms.odex. But when I try, the command prompt window tells me:
rm failed for /system/app/Mms.odex, No such file or directory
I've made sure the folder isn't read-only (I managed to copy the new Mms.apk to it after all). Not sure what else could be going wrong. Thanks in advance for any help.
Its not a good idea to push files into the system directory of an odexed ROM like that. You usually need to push the appropriate .odex file with the .apk file.
Also could be a permissions problem. You need to make sure the permissions for the new file the are same as what's already in the directory.
Sent from my Sensation using Cyanogenmod
dr.m0x said:
Its not a good idea to push files into the system directory of an odexed ROM like that. You usually need to push the appropriate .odex file with the .apk file.
Click to expand...
Click to collapse
I know it's not ideal, but this method seems to work just fine; I've read a bunch of Japanese blogs that explain this is how to get MMS working with Softbank, and people on forums elsewhere say it's worked for them.
dr.m0x said:
Also could be a permissions problem. You need to make sure the permissions for the new file the are same as what's already in the directory.
Click to expand...
Click to collapse
How do I do that? I'm pretty new to all this, two days ago I was Googling where to find my Sensation's settings menu
If you want to ensure the mms.apk has correct permissions you can simply run:
adb shell chmod 644 /system/app/mms.apk
This will set the correct permissions for apps in the /system/app folder, although its worth reading up on linux permissions to understand what the command is actually doing.
Permissions didn't help, but I've managed to track down another Mms.apk file that works well enough - messages don't integrate properly with HTC's Messaging app, but I can send and receive MMS. I'm going to keep looking for a better apk but at least this one functions!

[DEAD][Script][4.4.2] How to make all apps read External SD Card

This fix Requires ROOT and Busybox installed to /system/xbin
Context: I have been looking for a way to make an app that hides files to read/write files on my external SDcard, The way I found was to edit the platform.xml file to add that missing line as guided here: LINK this is just one of the many articles saying the same thing. which helped some apps work, but not the one i was looking for.
Reason: the point of this script is to make it so you do not have to set permission to the "media_rw" folder after every reboot manually.
Steps:
1) Follow and complete guide linked above, or any other similar guide, if you have not done so already.
*NOTE* some custom ROMs have already implemented this fix
2) After reboot use an app that allows you to make scripts (Ex. Rom Toolbox) this guide will use Rom Toolbox app
- create new script, name it whatever you want. I named it "sdcard permission"
- input this line and save:
Code:
chmod 777 /mnt/media_rw
*NOTE* you do not need to put it as 777 but it is what worked for me as it gave full read/write/execute permissions
3) Set script to run at boot
4) Run script manually then check app to see if it worked
-Alternatively go check /mnt/media_rw to see if it has the new permissions
Now you should be able to access the external SD card after every boot.
NOTE: you may need to redo the guide in the first step after switching ROMs as the new ROM may not have the fix implemented.
Reserved just in case
Buddyjohn said:
This fix Requires ROOT and Busybox installed to /system/xbin
Context: I have been looking for a way to make an app that hides files to read/write files on my external SDcard, The way I found was to edit the platform.xml file to add that missing line as guided here: LINK this is just one of the many articles saying the same thing. which helped some apps work, but not the one i was looking for.
Reason: the point of this script is to make it so you do not have to set permission to the "media_rw" folder after every reboot manually.
Steps:
1) Follow and complete guide linked above, or any other similar guide, if you have not done so already.
*NOTE* some custom ROMs have already implemented this fix
2) After reboot use an app that allows you to make scripts (Ex. Rom Toolbox) this guide will use Rom Toolbox app
- create new script, name it whatever you want. I named it "sdcard permission"
- input this line and save:
Code:
chmod 777 /mnt/media_rw
*NOTE* you do not need to put it as 777 but it is what worked for me as it gave full read/write/execute permissions
3) Set script to run at boot
4) Run script manually then check app to see if it worked
-Alternatively go check /mnt/media_rw to see if it has the new permissions
Now you should be able to access the external SD card after every boot.
NOTE: you may need to redo the guide in the first step after switching ROMs as the new ROM may not have the fix implemented.
Click to expand...
Click to collapse
I have a Samsung Galaxy S3 and been trying all kind of things to get to media_rw folder to keep its read writable and nothing worked so far. I did everything in you post to see if it would help/work but script not working. I can only keep permissions if I set manually set permission using root browser and then it working until I reboot the phone and I tried adding the script using ROM Toolbox pro but its not even changing the media_rw permission when run it.
This my first time using the script tool but to me seems to be setup properly. If needed I will get some screenshots of the script windows to show how I set it up. I am just posting this now to see if anyone can help or wants to ask some questions.
I know how permissions work in Windows and getting up to speed with Android. I been trying to make the media_rw folder r/w to be able to able to path it to my Titanium Backup folder on my external SD.
This looks similar to setting boot bat files in Windows so I know it should work but no go so far.
Heres the screenshots of my script that failed to run and the output file hoping to get some advice why script did not work.
Is this thread dead? Should I seek answers elsewhere?
techmanc said:
Is this thread dead? Should I seek answers elsewhere?
Click to expand...
Click to collapse
yes this thread is dead, lots of apps are updating compatibility finally, also there are some xposed modules that essentially does what i did on here. so this is dead.
Buddyjohn said:
yes this thread is dead, lots of apps are updating compatibility finally, also there are some xposed modules that essentially does what i did on here. so this is dead.
Click to expand...
Click to collapse
can yuo point me to some threads that are still working cause I still not been able to get RW access to media_rw folder.
techmanc said:
can yuo point me to some threads that are still working cause I still not been able to get RW access to media_rw folder.
Click to expand...
Click to collapse
try these three xposed modules, i recommend enabling one at a time to see which works, reboot after enabling one.
http://forum.xda-developers.com/xposed/modules/app-handleexternalstorage-t2693521
http://forum.xda-developers.com/xposed/modules/kitkat-sd-card-access-t2790992
http://forum.xda-developers.com/xposed/modules/xposed-disablesignaturecheck-t2789267
also i just realized why it was failing on yours. make sure you have busybox installed to system/xbin
that will make the script work. or atleast should.
Buddyjohn said:
also i just realized why it was failing on yours. make sure you have busybox installed to system/xbin
that will make the script work. or atleast should.
Click to expand...
Click to collapse
Looked s Busybox says installed to /system/bin heres the screenshot do I click install to move or use smart install. Never did much with app just know it was needed for rooting.
techmanc said:
Looked s Busybox says installed to /system/bin heres the screenshot do I click install to move or use smart install. Never did much with app just know it was needed for rooting.
Click to expand...
Click to collapse
Install it to /xbin
Buddyjohn said:
Install it to /xbin
Click to expand...
Click to collapse
What the difference between installing to /xbin vs /system/bin might I ask?
techmanc said:
What the difference between installing to /xbin vs /system/bin might I ask?
Click to expand...
Click to collapse
Honestly I am not to sure, I just assumed xbin was the right one as a lot of older mods and roms required busybox on xbin. so i tried it and it worked.

Categories

Resources