[Titanium Backup] Failed to protect backup - Moto E Q&A, Help & Troubleshooting

Tried every method...but I'm unable you protect my backups in titanium backup

To protect*

How I solved this problem on my Moto G LTE
Shantanu Baviskar said:
Tried every method...but I'm unable you protect my backups in titanium backup
Click to expand...
Click to collapse
I carefully read this thread: [Help] Titanium Backup PRO - protected archive not working.
So I modified file /system/etc/permissions/platform.xml according http://jrummy-apps.com/fix-sdcard-on-kitkat/ and make new file /data/local/userinit.sh with this content:
Code:
#!/system/bin/sh
busybox mount -o remount,rw /
chmod 770 /mnt/media_rw
See the attached archive root.zip which I made for you it is pretty straightforward.
You should have move your TiB backup folder on this path: /mnt/media_rw/sdcard1/TitaniumBackup
You will be able to protect backup archives in Titanium Backup Pro then.
PS: If /data/local/userinit.sh doesn't start automatically in your ROM you can use for example Scripter feature in ROM Toolbox Pro and import userinit.sh script and set it as Start at boot.

_jis_ said:
I carefully read this thread: [Help] Titanium Backup PRO - protected archive not working.
So I modified file /system/etc/permissions/platform.xml according http://jrummy-apps.com/fix-sdcard-on-kitkat/ and make new file /data/local/userinit.sh with this content:
Code:
#!/system/bin/sh
busybox mount -o remount,rw /
chmod 770 /mnt/media_rw
See the attached archive root.zip which I made for you it is pretty straightforward.
You should have move your TiB backup folder on this path: /mnt/media_rw/sdcard1/TitaniumBackup
You will be able to protect backup archives in Titanium Backup Pro then.
PS: If /data/local/userinit.sh doesn't start automatically in your ROM you can use for example Scripter feature in ROM Toolbox Pro and import userinit.sh script and set it as Start at boot.
Click to expand...
Click to collapse
Although in the case of Note 4 it didn't work right off the bat, I made it work a little different thanks to your idea. For some weird reason the script just doesn't get executed at boot (neither the *.sh file, nor as a script, through ROM Toolbox) but I was able to use the 2 lines in the script and made a task (in Tasker) which executes the shell command at boot. Everything else is straight forward and TiBu can now protect backups.
As a mention for those interested in replicating all these: the suggested SD card fix made by rummy applies EXACTLY the same changes as the SDFix so you can use either of them. Again, thanks for your reply and the great idea! :good:

nacos said:
I was able to use the 2 lines in the script and made a task (in Tasker) which executes the shell command at boot. Everything else is straight forward and TiBu can now protect backups.
Click to expand...
Click to collapse
Great, this is another example how to execute script at boot
I solved this problem on all my phones (Moto G LTE and Samsung Galaxy Note 2 and Samsung Galaxy W) but not on my tablet Nexus 7 2013 nor on internal emulated SD card nor on attached OTG USB flash disk. This is example where pure Stock Google Android ROM sucks

_jis_ said:
Great, this is another example how to execute script at boot
I solved this problem on all my phones (Moto G LTE and Samsung Galaxy Note 2 and Samsung Galaxy W) but not on my tablet Nexus 7 2013 nor on internal emulated SD card nor on attached OTG USB flash disk. This is example where pure Stock Google Android ROM sucks
Click to expand...
Click to collapse
This update addresses the issue mentioned before about init'd scripts not executing at boot. OK, here is the issue (specific to Qualcomm's Snapdragon) and the working solution - thanks to alexndr. I've tested it and it's working, however it doesn't work directly with <X.sh> text files, instead the script must be packaged in a flashable zip and flashed from recovery. Once I did that, it worked like a charm! The 98mediarw file in the screenshot uses the same script as previously mentioned; The 98 before the file name assigns a higher execution priority - I used 98 for testing purposes, it clearly doesn't need that. :good:

nacos said:
OK, here is the issue (specific to Qualcomm's Snapdragon) and the working solution - thanks to alexndr.
Click to expand...
Click to collapse
Oh, at first I thought that you post something what helps me with my tablet:
_jis_ said:
I solved this problem on all my phones but not on my tablet Nexus 7 2013 nor on internal emulated SD card nor on attached OTG USB flash disk.
Click to expand...
Click to collapse
But this is just another example how to execute script at boot

none of these methods are working. Is it because I'm using a Custom ROM?

What are you trying to achieve? What exactly is your environment?

nacos said:
What are you trying to achieve? What exactly is your environment?
Click to expand...
Click to collapse
I have Motorola Moto E (CM11 Stable build by percy_g2) and I'm trying to protect my backups in TiB but I'm getting error "Sorry, the operation failed." It used to be the same in stock ROM. And one more question, is this bug fixed in Lollipop versions of Android?

To answer you questions, no, this is not a bug, it's by design, also it's not happening because you're using a custom ROM, but rather because all OEM's (Google being probably the worst of all) are pushing towards more and more restrictive software & hardware environments, also supported by laws meant to discourage the users from modifying original configurations. Why? Dirty politics, I won't get into that but if you keep your eyes wide open you'll see and understand A LOT! Oh, by the way...to expect for Lollipop to be less restrictive and more fun (to customize) would be naive! Nuff said, let's have some fun!
There are multiple parts to this fix/diagnostic. Don't skip any point and follow these instructions rigorously, otherwise it won't work!!! Let's take them one by one:
Is you platform.xml file (under system/etc) modified to allow read/write access to media_rw (mnt/media_rw)? If not, apply the patch using SDFix from Google Store.
TiBu backup folder must be set to mnt/media_rw/externalSD/Titaniumxxx (if you don't have externalSD than use your internal storage instead, pointing to TiBu folder) - but, for right now, you won't be able to set this path because currently TiBu doesn't have access to media_rw, due to media_rw not being given the right permissions by the system. That's exactly what mediarw script does.
In order for init.d to execute the mediarw script at every boot, you need to insure that you do have init.d support AND it's working. This is how you verify:
(3a) Do you see the folder system/etc/init.d? If yes, go to (3b), if no, you don't have init.d support! That's another fix entirely.
(3b) If you see the 00test file in the init.d folder navigate to /data and open up the file called Test.log - that tells you that init.d is installed and working. If you have a Qualcomm's Snapdragon and you do have the init.d folder but it doesn't execute any script at boot, see the fix in post #6.
(3c) If you don't care about setting up init.d support, you can still run the script at boot, as a shell command using Tasker - see post #4
Once you're sure that all the above are set correctly, flash the attached file from recovery. Reboot, navigate to system/etc/init.d and confirm the presence of the mediarw script in the init.d folder
Reboot again, then navigate to mnt/media_rw and check that permissions for media_rw have been set to 770 - :fingers-crossed: mission accomplished, my friend! :fingers-crossed: If, on the other hand, the permissions for media_rw are still set at 700, then something went wrong. Go back and check every step again, otherwise...
Open up TiBu, set the backup folder path as instructed in #2 and verify that your backups can be protected. Voila!!

nacos said:
To answer you questions, no, this is not a bug, it's by design, also it's not happening because you're using a custom ROM, but rather because all OEM's (Google being probably the worst of all) are pushing towards more and more restrictive software & hardware environments, also supported by laws meant to discourage the users from modifying original configurations. Why? Dirty politics, I won't get into that but if you keep your eyes wide open you'll see and understand A LOT! Oh, by the way...to expect for Lollipop to be less restrictive and more fun (to customize) would be naive! Nuff said, let's have some fun!
There are multiple parts to this fix/diagnostic. Don't skip any point and follow these instructions rigorously, otherwise it won't work!!! Let's take them one by one:
Is you platform.xml file (under system/etc) modified to allow read/write access to media_rw (mnt/media_rw)? If not, apply the patch using SDFix from Google Store.
TiBu backup folder must be set to mnt/media_rw/externalSD/Titaniumxxx (if you don't have externalSD than use your internal storage instead, pointing to TiBu folder) - but, for right now, you won't be able to set this path because currently TiBu doesn't have access to media_rw, due to media_rw not being given the right permissions by the system. That's exactly what mediarw script does.
In order for init.d to execute the mediarw script at every boot, you need to insure that you do have init.d support AND it's working. This is how you verify:
(3a) Do you see the folder system/etc/init.d? If yes, go to (3b), if no, you don't have init.d support! That's another fix entirely.
(3b) If you see the 00test file in the init.d folder navigate to /data and open up the file called Test.log - that tells you that init.d is installed and working. If you have a Qualcomm's Snapdragon and you do have the init.d folder but it doesn't execute any script at boot, see the fix in post #6.
(3c) If you don't care about setting up init.d support, you can still run the script at boot, as a shell command using Tasker - see post #4
Once you're sure that all the above are set correctly, flash the attached file from recovery. Reboot, navigate to system/etc/init.d and confirm the presence of the mediarw script in the init.d folder
Reboot again, then navigate to mnt/media_rw and check that permissions for media_rw have been set to 770 - :fingers-crossed: mission accomplished, my friend! :fingers-crossed: If, on the other hand, the permissions for media_rw are still set at 700, then something went wrong. Go back and check every step again, otherwise...
Open up TiBu, set the backup folder path as instructed in #2 and verify that your backups can be protected. Voila!!
Click to expand...
Click to collapse
(Please ignore that screenshot. I didn't properly read your msg in blue text)
I couldn't understand post #4 so can you please describe it more deeply? :crying: btw I don't have 00test but a file named 00banner. And can you tell me how to use tasker properly?

Sorry for butting in on this thread. I found it by searching because I too can no longer protect a backup in my tibu Pro. I used to be able to but not anymore and I'm not sure why.
I'm on a rooted nexus 5 running stock 4.4.4.
Reading your instructions I went looking for platform.xml and found it. When I checked its properties I got, see screenshot. Don't know what to modify to mount it as you say. I'm in ES Explorer.
Can you help?
Thanks.

And here is a screenshot in root Explorer

Update your tb to 7.0.1 and now you can protect backups ? this thread should get closed now

Closed? Why? Just because a shortcut is available doesn't mean there is nothing to learn from wondering around, my friend!
After all, this is exactly what XDA is: a huge data base available to those who are willing to learn and dare to wonder around, wouldn't you agree?

Related

[New ROOT METHOD] No PC Quick ROOT!!! MT 3G SLIDE

J Ok so in my never ending struggle against the Evil Eclair/T-Mo/HTC NAND Protection and the Futility of Trying to flash a ROM With the "Supposed AndRoot QuIck Root Method" As well as a fine point from Nbetcher that the Engineering build must be flashed because Android has NAND protection while running. I have devised my own "No PC ROOT Method!!!"
Required Files (Tested For MT3G SLIDE Latest OTA Unrooted Stock)
1.Download Androot From Location of Choosing (I'm Using Version 1.6.2)
2.Download ESPRIMG.zip (ENG build)
3.Download SlideEng-Package.zip
4.Download Custom Rom Of Your Choosing(Mine Is CM 6.1.1 Stable)
5.Download Android Terminal Emulator(From Market)
6.Download Root Explorer Android (Requires Root) (From Market Or Some Place Online)
7.Download File Explorer (Dev:Adao Team)(From Android Market)
8.Download Latest Clockwork Recovery(I Used 2.5.0.1)
*Updated* 1/09/2011 (Thanks to dbzfanatic for links)
dbzfanatic said:
Universal Androot http://forum.xda-developers.com/attachment.php?attachmentid=391774&d=1283202114
ESPRIMG.zip www.4shared.com/file/OsmF_ZD7/ESPRIMG.html
SlideEng-Package.zip http://www.4shared.com/file/sz0VO2TL/SlideEng-package.html
Cyanogen 6.1.1 Stable http://mirror.teamdouche.net/get/espresso/update-cm-6.1.1-Slide-signed.zip
Clockwork Recovery (may be old but will work) http://www.4shared.com/file/KzYHr4U_/update.html
Now people can stop *****ing about links. Everything else can be found on the android market.
Click to expand...
Click to collapse
Please Note I Am NOT The DEV Behind these Apps nor am I Resposible For Any Damages You May Incur To Your Device or Warranty by using this Method! Also Before anyone says I repped someone off remeber I accidentally discovered this using 2 failed methods because they essentially cancel each other out.(The Latter Nbetchers works just not after the AndRoot One)!!!
So...
1st Download/Install all needed files from market( File Manager Android Terminal Emulator)
2nd Download all zip images, Recoveries, Roms, apps from phone browser Directly To SD ROOT(Google em until I get links up on Dev Forum)
3rd. Unzip SlideEng-Package.zip To Root using File Manager or Other Zip Program for android(Andro-Zip Works Well)
4th Change Name of Clockwork to Update.zip(Case Sensative)
5th Install AndRoot And Run Root Me With Install Su & Temp Root/Unroot After Reboot Selected(Or Else You Will Boot Loop)
6th Install And Run Root Explorer then Copy and paste flash_img and mtd0.img to /data/local on android device by multi-select copy then RM R/W in program in upper left on data local folder.
7th IMPORTANT!!! Long Press and hold each copied file and set permissions to allow read and write on both user and the lowest option (I Think Dev or system)
8th Run Android Terminal Emulator and type the following commands verbatim spaces included Pressing enter after each line($ n # will be there provided you follwed all steps if not go back to androot and root again):
$ su
# cd /data/local
# chmod 04755 flash_image
# ./flash_image misc mtd0.img
Now power off and reboot using VOL-DOWN + POWER
It'll reboot into the HBoot Screen and ask if you want to Check ESPRIMG.zip after Verifying it will ask you to flash Select Yes (VOL-UP) And Wait DO NOT POWER DOWN OR TAKE OUT BATTERY!!!
Once its Completed it will ask you to Reboot select no Instead and Go To Recovery
Now Select APPLY Update.zip to flash CLOCKWORK RECOVERY YAY!!! :-D Now We Can Flash a Custom Rom With Root and Even Go As Far As S-OFF!!! But Please Be Sure Its Already On Your Micro SD...
Select Wipe Data Factory Reset by Scrolling with VOL- UP/DOWN or Track Pad and Use Power/Trackpad TO Select.
Now Use Install Zip from SD Card to Install Custom Rom(Flash GApps Second if downloaded and desired if using CM Mod 6.1.1) Now Reboot And Enjoy!!! If you Wanna Flash Anything Else Use Rom Manager From Market and Som Custom Roms to Boot into Clockwork!!! Thanks to all the Devs and their tools and immense knowledge for Making this Possible! Thanks To All The ROM Chefs Too!!!
DeezyFn'Baby said:
6th Install And Run Root Explorer then Copy and paste flash_img and mtd0.img to /data/local on android device by multi-select copy then RM R/W in program in upper left on data local folder
Click to expand...
Click to collapse
Edit:nvm, ill try it when i get my replacement slide.
I don't think the slide needs S-OFF to write to data but I do think it needs root beforehand, or at least shell root.
just to make it easier to anyone flashing this, i would put links to DL's of those files. first thing i noticed when i read. put me off to this method.
btw, this is me trying to help, not ripping on you
dbzfanatic said:
I don't think the slide needs S-OFF to write to data but I do think it needs root beforehand, or at least shell root.
Click to expand...
Click to collapse
I don't think so? If /data couldn't be written to without root or s-off, how would people install apps who never rooted their phones? Where is the system data stored and modified? /data is fully modifiable I'm pretty sure.
I'm willing to admit I could be wrong on that but I thought apps were installed in /data because it was the system calling the package installer not the user.
dbzfanatic said:
I'm willing to admit I could be wrong on that but I thought apps were installed in /data because it was the system calling the package installer not the user.
Click to expand...
Click to collapse
In terms of read/write permissions, the system has the same permissions as the user. The system can't write to /system if the user can't, and vice versa. /data and /cache have no nand protection
MusicMan374 said:
In terms of read/write permissions, the system has the same permissions as the user. The system can't write to /system if the user can't, and vice versa. /data and /cache have no nand protection
Click to expand...
Click to collapse
In the post I did add if I had the time I would post links if not ill do it later to whomever above stated their statement. If you don't want to "Try" it don't and don't comment. It was an accident I found it and I have since replicated my process on 3 slides and it works. The Reason it does is because gaining temporary root inside android even without gaining full being blocked by nand or S-Off can be can be used to modify the permissions of system files while the memory is running tho not the actual NAND itself which I believe S-OFF does... So when I said 6th mount the drive as R/W in root explorer there is an option to remount the drive R/W to allow you to long press the items in that folder and change their permissions then I said unmount to save the permission fix that's what the Temp Root Gained from AndRoot Does.... Now I'm gonna try and update my Original post with links for people who want an esier time doing this like I would have liked and for the. Sarcastic ones so then you can just press the Thumbs Up button ok?
DeezyFn'Baby said:
In the post I did add if I had the time I would post links if not ill do it later to whomever above stated their statement. If you don't want to "Try" it don't and don't comment. It was an accident I found it and I have since replicated my process on 3 slides and it works. The Reason it does is because gaining temporary root inside android even without gaining full being blocked by nand or S-Off can be can be used to modify the permissions of system files while the memory is running tho not the actual NAND itself which I believe S-OFF does... So when I said 6th mount the drive as R/W in root explorer there is an option to remount the drive R/W to allow you to long press the items in that folder and change their permissions then I said unmount to save the permission fix that's what the Temp Root Gained from AndRoot Does.... Now I'm gonna try and update my Original post with links for people who want an esier time doing this like I would have liked and for the. Sarcastic ones so then you can just press the Thumbs Up button ok?
Click to expand...
Click to collapse
Your instructions don't have anything to do with /system I don't know what you are babbling about. I'm not disproving your root method, I was just trying to explain that /data is not nand protected. /system IS nand protected, and without s-off or a r/w overlay you wouldn't even be able to modify the permissions of files in /system, but since your root method has to do with /data it works.
MusicMan374 said:
Your instructions don't have anything to do with /system I don't know what you are babbling about. I'm not disproving your root method, I was just trying to explain that /data is not nand protected. /system IS nand protected, and without s-off or a r/w overlay you wouldn't even be able to modify the permissions of files in /system, but since your root method has to do with /data it works.
Click to expand...
Click to collapse
I'm not babbling I was referring to the first reply but ur probably right about the sys files as I didn't mess with them. But I did obtain root anway all of the files can easily be found by doing a search on the XDA forums and ill add the links when I get to a pc doing this from the android browser is painful...
DeezyFn'Baby said:
I'm not babbling I was referring to the first reply but ur probably right about the sys files as I didn't mess with them. But I did obtain root anway all of the files can easily be found by doing a search on the XDA forums and ill add the links when I get to a pc doing this from the android browser is painful...
Click to expand...
Click to collapse
Yeah, that's why you don't need s off for this to work, which others were saying
Sent from my T-Mobile myTouch 3G Slide
Thanks for posting this method! It worked flawlessly! Had the files and rooted it in about a half hour. Thanks again for this nice work around!
Sent from my ROOTED myTouch 3G Slide using the XDA App
This would make it easier for new folks if you had links next to the items needed for this... you can't just tell others they need this and that with at least a link on where to find it or download it... like having me find a treasure chest without clues or a map just saying haha. good guide though and yes I did read you'll be adding links soon =p
Agreed links would help but if people google the files he mentioned they are all easy to find. Even new folks know how to google =D
Sent from my ROOTED myTouch 3G Slide using the XDA App
Universal Androot http://forum.xda-developers.com/attachment.php?attachmentid=391774&d=1283202114
ESPRIMG.zip www.4shared.com/file/OsmF_ZD7/ESPRIMG.html
SlideEng-Package.zip http://www.4shared.com/file/sz0VO2TL/SlideEng-package.html
Cyanogen 6.1.1 Stable http://mirror.teamdouche.net/get/espresso/update-cm-6.1.1-Slide-signed.zip
Clockwork Recovery (may be old but will work) http://www.4shared.com/file/KzYHr4U_/update.html
Now people can stop *****ing about links. Everything else can be found on the android market.
dbzfanatic said:
Universal Androot http://forum.xda-developers.com/attachment.php?attachmentid=391774&d=1283202114
ESPRIMG.zip www.4shared.com/file/OsmF_ZD7/ESPRIMG.html
SlideEng-Package.zip http://www.4shared.com/file/sz0VO2TL/SlideEng-package.html
Cyanogen 6.1.1 Stable http://mirror.teamdouche.net/get/espresso/update-cm-6.1.1-Slide-signed.zip
Clockwork Recovery (may be old but will work) http://www.4shared.com/file/KzYHr4U_/update.html
Now people can stop *****ing about links. Everything else can be found on the android market.
Click to expand...
Click to collapse
The only thing about 4shared is that it doesn't work right on the stock HTC web browser, since javascript is kinda glitchy on that one. Works fine on froyo/cm6.1.1 with the aosp browser, but for a TRUE pcless method you need direct or mediafire links I think.
I post links because everyone *****es and yet someone still *****es. Those aren't my uploads, I simply posted them so people would stop *****ing. I personally haven't had issues with 4shared even with the stock browser back before I rooted my phone. If you want to reupload them to another hosting site be my guest but like I said, they aren't my uploads.
Stop whining
Here are some direct links for those who complain about the 4Share site.
Oh, and Ill put a gapps link up in thar too. It has the new market, and it works as long as you don't install anything until it finishes restoring. At least it did for me.
That Clockwork link is broken. I'm just sayin' :3
ESPRIMG.zip: http://db.tt/kEvPIyu
SlideEng-package: http://db.tt/n57yN2a
Gapps: http://db.tt/L0SNLhj
EDIT: Clockwork on next page.
supermario12312 said:
Here are some direct links for those who complain about the 4Share site.
Oh, and Ill put a gapps link up in thar too. It has the new market, and it works as long as you don't install anything until it finishes restoring. At least it did for me.
That Clockwork link is broken. I'm just sayin' :3
ESPRIMG.zip: http://db.tt/kEvPIyu
SlideEng-package: http://db.tt/n57yN2a
Gapps: http://db.tt/L0SNLhj
Click to expand...
Click to collapse
thank you for that, not only if that direct link better there mate.. but man the download speed is better ahaha... I already have root but I'm rooting a friends phone ;P then soon a warranty exchange phone for me.
Once I reach recovery... it just sits there with no options or anything...

[TOOL] System apps update.zip auto creator

Hi all
I have created for my first java program a update.zip creator for the nexus one.
This will create a flashable update.zip for updating the system apps on your choice.
I created it for my self to save me time making them every time I wanted to save memory on my phone by moving apps from /data to /system partition (could just of written a script), so thought I would share it.
This is a console tool written in java and only for linux, it will only work on a rooted nexus one running clockwork mod recovery (have not tried any other recovery).
Tested on: nexus one, clockwork mod, CM 7
Programs you can choose to add to the update.zip:
Amazon mp3
Maps
Facebook
Gmail
Rom manager
Android market
Twitter
Youtube
Voice search
Super user
Read the README on how to use it.
Don't forget to run the adb server as root!
Download: http://www.mediafire.com/?pekm9ehswe49x
Any questions,problems,suggestions let me know.
README
Code:
This is a tool I have created for my self to speed up making update.zips for my nexus one and am now sharing.
It is my first java program so it's not perfect but it will improve over time as I learn.
This program will create and sign an update.zip file that will move apps you choose from the /data/app patition to the /system/app partition
It has only been designed to work with the nexus one using Cyanogen mod.
How it works
First it pulls all apps from the /data/app partition on your phone into a created directory with in the PWD
it then scans all the apps for key names of the apps
then if it finds certain apps, it will then ask you if you would like to add it to the update.zip
it then creates the update-script with the commands to delete the apps from the /data/app and copy them to the /system/partition
then it zips the contents and finaly uses the testsign.jar to sign the package.
In the PWD the following programs are needed to run updater-creator:
adb
testsign.jar
update-binary
**** RUNNING THE PROGRAM *****
You must download the apps from the market that you want to update
Leave updater-creator.jar in the directory with ADB and other programs, moving it will prevent the program from finding the programs it needs to run.
You must enable USB debugging on your phone as this program uses ADB.
To run updater creator:
*unzip the file and contents into a directory .
*cd to the dir you unzipped the files to.
*Plug phone in
*Run 'sudo ./adb kill-server' then 'sudo ./adb start-server'
*run the updater-creator.jar file using the following command: java -jar updater-creator.jar
This will create folders and files needed with in the PWD.
Each time you run updater-creator it will over write all previously created files.
I'll give it a try, thank you for sharing your hard work any chance of adding the "read me instructions" to your first post?
Thanks again
Gr8 work,definitely will try it once I get back home
Sent from my Nexus One using XDA App
tina333 said:
I'll give it a try, thank you for sharing your hard work any chance of adding the "read me instructions" to your first post?
Thanks again
Click to expand...
Click to collapse
README now added. Let me know if it works ok or if there are any problems with it, I have tested it my self and had a friend test it with out any problems
If there are any more common apps or features you would like me to add let me know and I will see what I can do.
thank you!! I think this would be pretty useful for myself

[SCRIPT/FIX] Internal sdcard permissions (/data/media/)

This should be applicable to any ROM on devices which share internal storage for applications and the internal "sdcard" (Note II, SGS3, probably others). Symptoms may include inability to take screenshots and other failures, and will usually show a "Permission denied" in logcat for files under /data/media/. The underlying problem is that permission is denied to the filesystem, even by the root user when the ROM is booted (this is strange and I still don't understand why). Running "Fix permissions" did not fix this issue for me (that script doesn't change any permissions on the sdcard).
When booted into recovery (ClockworkMod was tested in my case), root has the ability to reset the permissions properly. To fix the problem, connect with adb while booted in recovery and run the following commands to correct the permissions:
Code:
chown -R media_rw:media_rw /data/media/
find /data/media/ -type d -exec chmod 775 {} ';'
find /data/media/ -type f -exec chmod 664 {} ';'
UPDATE (Credit to @Quinny899) If that does not work, you may also want to reset the SELinux contexts for the media partition with this command:
Code:
restorecon -FR /data/media/
Hope this helps! :victory:
I recently restored a Nandroid backup of my old Nexus 7 on a replacement Nexus 7. Most everything worked okay, but screenshots, deleting certain files and directories, and other basic operations weren't really working, and "Fix permissions" didn't help.
Running the commands here worked like a charm! I used TWRP and I have JellyBeer 4 on my Nexus 7. Thanks!
skoshy,
I'm glad this helped you. JellyBeer is a fantastic ROM. Cheers!
xak944 said:
skoshy,
I'm glad this helped you. JellyBeer is a fantastic ROM. Cheers!
Click to expand...
Click to collapse
Well, I created a ZIP of this for people to flash in Recovery, ADB sideload or in an App like Fashify... Only to realize that XDA superstar @osm0sis had already done pretty much the same thing with his sdcard Fix Permissions Script Found here. His script uses pure edify whereas mine uses linux commands.. Both work but his Was First so I will only leave the link for his.
Cheers!
Yeah it's kinda funny. I had that script posted up in the ADBsync thread back in February because I noticed things could start acting funny when I restored an entire sdcard backup to one of my devices. But hey, great minds think alike! Good work all around!
Thanks @TheByteSmasher for bringing another use for the zip to my attention! I didn't know those things had a tendency to go awry on their own as well!
Edit:
Here's the edify script equivalent of the above, plus the proper original perms for /data/media itself, and the special perms that CWM likes its subfolder to have (root + all). TWRP keeps its backups under the primary user subfolder (/data/media/0) and doesn't seem to care as much.
cwm-sdcard.Fix.Permissions.zip/META-INF/com/google/android/updater-script:
Code:
ui_print("");
ui_print("sdcard Fix Permissions Script");
ui_print("by osm0sis @ xda-developers");
show_progress(1.34, 0);
ui_print("");
ui_print("Mounting...");
run_program("/sbin/busybox", "mount", "/data");
set_progress(0.2);
ui_print("");
ui_print("Setting /data/media to media_rw and fixing...");
set_perm_recursive(1023, 1023, 0775, 0664, "/data/media");
set_perm(1023, 1023, 0770, "/data/media");
set_progress(0.8);
ui_print("");
ui_print("Setting /data/media/clockworkmod perms...");
set_perm_recursive(0, 0, 0775, 0777, "/data/media/clockworkmod");
set_progress(1.0);
ui_print("");
ui_print("Unmounting...");
unmount("/data");
set_progress(1.2);
ui_print("");
ui_print("Done!");
set_progress(1.34);
Available over in my Odds and Ends thread as TheByteSmasher mentioned before.
Nice. Good to know this is a well known issue, I thought I was nearly alone (and it drove me up the wall for a while until I figured it out).
Does anyone know what is technically causing even the root user not to be able to write? I'm curious.
Probably because even root apps only run root commands when they need to, so for simple stuff could run into the same issue. Just a guess, but makes sense.
I'm not talking about root apps. When I had the issue I couldn't modify any files with a shell over adb as the root user. Write operations always resulted in 'permission denied' errors. Generally in Linux, the only way this can occur is with filesystem permissions (root user bypasses this), the immutable bit (not set), or if it's a read-only filesystem (didn't appear to be based on the output of 'mount').
xak944 said:
I'm not talking about root apps. When I had the issue I couldn't modify any files with a shell over adb as the root user. Write operations always resulted in 'permission denied' errors. Generally in Linux, the only way this can occur is with filesystem permissions (root user bypasses this), the immutable bit (not set), or if it's a read-only filesystem (didn't appear to be based on the output of 'mount').
Click to expand...
Click to collapse
Osm0sis actually states in the description of his zip, that when you use ADB push to put some stuff on the SD it can mess with the permissions... that's what did it for me.. but I guess a nandroid restore can cause it too depending on how it performs the action.
Sent from my Nexus 4 using Tapatalk 4 Beta
I'm ditching the idea of editing fix_permissions. The way they do all the system files is extremely intelligent and done on-the-fly based on the contents of certain system files to trace through. Adding something specifically for internal sdcards, even with the appropriate checks, would be a hack compared to all the really great work they've done to make the script device-nonspecific.
Deleted
1990mustafa said:
Deleted
Click to expand...
Click to collapse
Could somebody point me in the direction of how to do this for the Note 3 SM-9005 please?
I have an internal SD permissions issue and the flashable zip doesn't work, I presume because the directories are located slightly differently.
Many thanks
i m also stuck in same boat as none of scripts work for note 3... need some help / guidance here ..
You saved me, i was playing with ubuntu touch and i forgot that symbolic links and chown always modify the original directory and twrp could not fix the permissions!
Thank you! Works like a charm! :highfive:
Following using this, I found that the internal SD wouldn't be mounted
Googling the logcat output's lines, I found this, specifically:
[email protected] said:
use for fixing access
su
restorecon -FR /data/media/0
Click to expand...
Click to collapse
Worked a dream, might be useful for anyone else
Quinny899 said:
Following using this, I found that the internal SD wouldn't be mounted
Googling the logcat output's lines, I found this, specifically:
Worked a dream, might be useful for anyone else
Click to expand...
Click to collapse
worked perfectly!
Hey, big THANKS to everyone who contributed to this thread. I restored by SD a different way than I used to do it and had this issue. I figured it was a permissions issue but couldn't get the 'Fix Permissions' function in TWRP or ROM Manager to fix it (now I know why). This saved me, much appreciated!
Quinny899 said:
Code:
su
restorecon -FR /data/media/0
Click to expand...
Click to collapse
Oh man, so it was SELinux causing these issues all along!? I wonder why my original fix worked then since it didn't reset the SELinux context... Oh well, good to know.
Thanks @TheByteSmasher for leading me to the right solution
TheByteSmasher said:
Well, I created a ZIP of this for people to flash in Recovery, ADB sideload or in an App like Fashify... Only to realize that XDA superstar @osm0sis had already done pretty much the same thing with his sdcard Fix Permissions Script Found here. His script uses pure edify whereas mine uses linux commands.. Both work but his Was First so I will only leave the link for his.
Cheers!
Click to expand...
Click to collapse
Thanks again
osm0sis said:
osm0sis' Odds and Ends -- Misc./Batch Tools, Flashable Zips, Scripts, etc.
General Information
In a nutshell, I just wanted a single thread to gather links to some of my other, larger projects, but also serve as a spot I could put some smaller scripts and zips I've created that I don't think merrit their own separate threads. This is partially for my own sanity and will hopefully make it easier for others to find some things as well. A lot of the stuff here was developed with the GN or N7 (my devices) and Windows in mind, but could generally be applicable to most devices either out-of-the-box or with some slight modification. If you see something that inspires you, go ahead and mod it, just let me know and give me some credit somewhere. If anyone would like to know the specifics of what's in a particular script that I haven't already linked to more information on, just let me know and I'll post that in here as well. Thanks!
Misc./Batch Tools
AnyKernel 2.0 (many devices) - link
AnyKernel was a simple template for an update.zip that could apply any kernel to any ROM, regardless of ramdisk to reduce the chance of any issues arising from the custom kernel pairing. The drawback to this is that some kernels require modifications to the ramdisk to enable/set up kernel features, and in the old AnyKernel format there was no way to do this. AnyKernel 2.0 pushes the format even further by allowing kernel developers to modify the underlying ramdisk for kernel feature support easily using a number of included command methods along with properties and variables to customize the install experience.
Android Image Kitchen (many devices) - link
A collection of Windows/Android ports of the necessary Linux utilities for Android image (kernel+recovery) mod work, and my own automation script to unpack, edit and repack the ramdisk. Other guides/scripts exist but none of them are universal for target device, compression and/or developed for Windows/Android. Now also Linux builds to bring my improved featureset back to where it came from. Has been extremely useful for me in my messing around with kernel ramdisks.
ADB Screenshot (all devices) - attached
Take screenshots while in recovery. Useful for development of recovery apps or error reporting. Original method had lots of different threads around with the general method for various devices but I figured out a couple tricks required for getting it working on the Galaxy Nexus and then automated the process. Tested and confirmed working with both pixel formats of CWM and TWRP. More information in this GN Q&A FFmpeg thread. New method uses fb2png and should work on all devices.
ADBsync sdcard Backup (many devices) - attached
Backs up the entire sdcard so that you can have a complete snapshot of your device when you make periodic backups, and be able to restore things exactly as they were. Automates the sync process of Renate NST's great ADBsync utility which makes only newer files get pulled, significantly decreasing backup time for the sdcard compared to "adb pull". Original version posted in the old ADBsync thread. Defaults for devices with /data/media/ internal sdcards (Nexus devices, etc.), but is easily customizable to backup other mountpoints.
Flashable Zips
Nexus BootUnlocker script (GN, N4, N5, N7 '13, N10) - attached
I don't know about everyone else but sometimes I find I've rebooted into the bootloader only to realize I've forgotten to unlock it in segv11's excellent BootUnlocker App beforehand. Well, I decided to make a BootUnlocker Script for my Galaxy Nexus so I could just boot to recovery quickly, unlock, then adb reboot-bootloader (or use my Reboot To Bootloader script below) to get back without having to fully boot the OS to make the change. Also extremely useful in the case you aren't able to boot. As with the app there is no data loss like there would be with fastboot, allowing you to relock for safety. Originally posted in the GN EDIFY Scripting thread. Modified for the newer Nexus devices and combined into a single Nexus BootUnlocker zip with tamperbit reset support added using information from the BootUnlocker App Dev thread.
N7 BootUnlocker script (N7 '12) [creation guide] - link
The Nexus 7 2012 is a special case. Per-device encryption of an entire partition makes it impossible to support the N7 '12 in a simple root app, or flashable zip as above, however using my guide and included script you can now create a working BootUnlocker Script Zip for your specific device. As with the above scripts there is no data loss like there would be with fastboot, allowing you to relock for safety.
Flashify script (many devices) - attached
This script zip makes flashing boot.img (kernel), recovery.img, and radio.img/modem.img (baseband) files via recovery simple. Inspired by cgollner's powerful and visually stunning Flashify App, it aims to save the average user the hassle of repacking their own image zip, or using the command-line or fastboot to flash it. Place an appropriately named file in the same directory as the zip and flash away! Should work on all emmc devices with normal partition naming ("boot", "recovery" and "radio" or "modem") which accept Android standards-compliant images. Extremely handy when used with amarullz' brilliant AROMA Filemanager, and/or my Android Image Kitchen: Mobile Edition (linked above).
Kernel Emergency Reset script (many devices) - link
Basically a go-to cure-all for custom kernel users experiencing issues after an upgrade due to old settings left over in a kernel control app (eg. franco.Kernel updater, Trickster, etc.), or problematic init.d/userinit.d scripts. It's also useful if you just want to make sure you're running clean defaults without conflicts.
Reboot To Bootloader script (all devices) - attached
Those who prefer using CWM may have noticed a couple of things missing that the other popular custom recovery, TWRP, has built-in. One of these is a file explorer/manager, which is answered by amarullz' brilliant AROMA Filemanager. Another thing I found myself wanting is a way to reboot back to the bootloader once I'm in recovery, so I created this very very simple flashable zip script. (No longer required on CWM >=6.0.3.5). Note: Once in the bootloader, "Start" will boot you back to recovery. Not sure why, but it's not a big deal, just reboot normally from recovery at that point.
sdcard Fix Permissions script (many devices) - attached
A little flashable zip script to fix ownership and permissions of files and directories on the sdcard to what they would be if Android OS had put them there itself, since some apps can't access pushed files that have root.root as owner/group. This is useful when restoring to your sdcard backup, as with my ADBsync sdcard Backup batch script above, since generally, pushed files get root.root from adb shell and higher permissions than usual. Also a solution for a bug where sdcard files get lower permissions somehow, resulting in similar access problems. Currently written for devices with /data/media/ internal sdcards (Nexus devices, etc.), but could easily be modified for other mountpoints.
nano Terminal Editor v2.2.6 Installer (all devices) - attached
A simple installer to push bgcngm's great Android port of the nano editor binary to /system/xbin/ along with the required files in /system/etc/terminfo/. It can then be used from Terminal while booted from that point on. Each time you flash it also temporarily enables use in recovery by pushing a script to /sbin/nano with the required environment variables, so you can then trigger it from recovery shell or the console in amarullz' brilliant AROMA Filemanager. Makes it extremely easy and worry-free to tweak and mod on the go, knowing you can edit the faulty build.prop or init.d script if something goes wrong. This script could also be added to recovery to make the functionality permanent.
odex Script Installer (all devices) - attached
Based on the great work and binaries from this thread, a simple installer to push my odex script along with the required dexopt-wrapper and zip binaries to /system/xbin and set the appropriate permissions. Automates the procedure to odex any apk or jar from the commandline to potentially improve performance. Dalvik runtime only. Also uses cut from busybox.
Kernel init.d Support Injector (many devices) - attached
Following from great ideas by Captain_Throwback in my AnyKernel2 thread and using script from my Flashify script above, this AK2 zip will inject basic init.d bootscript support into any kernel ramdisk on any emmc device with normal partition naming and using the Android bootable image standard, without having to bloat a ramdisk using a busybox binary. This zip is also signed, so could potentially be used with stock recovery on a locked bootloader, but that depends on the stock recovery supporting grep, etc. for the zip script to perform the required file changes.
Dev Team init.d Pack Installer (all devices) [see "950iosettings, etc." below] - link
A simple installer I wrote to create the /system/etc/init.d/ directory, extract the latest init.d scripts as published by the "Franco's Dev Team" tuning collective (of which I'm a member), then set correct owner, group and permissions to the entire init.d directory. Link points to my Dev-Host since these may still be subject to change from time to time. If you are a developer and would like to include these tunables/scripts in your kernel or ROM please provide credit. A lot of time and effort has gone into this project and that's all we ask.
Credits & Thanks: All authors of any included binaries and libraries for their amazing work. Anyone who's helped me with these projects along the way.
Disclaimer: Naturally, you take all the responsibility for what happens to your device when you start messing around with things.
XDA:DevDB Information
osm0sis' Odds and Ends -- Misc./Batch Tools, Flashable Zips, Scripts, etc., Tool/Utility for the Android General
Contributors
osm0sis
Version Information
Status: Stable
Created 2013-11-13
Last Updated 2015-03-30
Click to expand...
Click to collapse

Read/write file access

Hello
Some of application such as Sygic, Aptoid, Waze and others cannot access to sdcard unless I reboot.
When verffying with Root Explorere I have noticed that the default access to Sdcard is R/O. As soon as I change that to Read/Write every thing goes right.
The problem is R/O keeps come back and apps cannot run until I do modification again.
Anyone can help please as to fix permenantly this issue.
Thanks
samaliset said:
Hello
Some of application such as Sygic, Aptoid, Waze and others cannot access to sdcard unless I reboot.
When verffying with Root Explorere I have noticed that the default access to Sdcard is R/O. As soon as I change that to Read/Write every thing goes right.
The problem is R/O keeps come back and apps cannot run until I do modification again.
Anyone can help please as to fix permenantly this issue.
Thanks
Click to expand...
Click to collapse
There are two ways
1 the easy way is an app from playstore to do that at every boot
Are many can do this
2 the hard way is a script
You can paste it to init.d folder or script manager execute at every boot
Do you have gtab?
And sd card should not have sysrw option
Something wrong with install of rom
samaliset said:
When verffying with Root Explorere I have noticed that the default access to Sdcard is R/O. As soon as I change that to Read/Write every thing goes right.
The problem is R/O keeps come back and apps cannot run until I do modification again.
Click to expand...
Click to collapse
Peculiar problem. Will have to do some tests and look at some logs to find out the cause.
1. Can you create or delete files/dirs. on the SDcard, and do these changes persist after a reboot? Or do they vanish--like the changes never happened?
2. What's the output of this command right after a reboot?
Code:
$ [B]mount[/B]
rajeevvp said:
Peculiar problem. Will have to do some tests and look at some logs to find out the cause.
1. Can you create or delete files/dirs. on the SDcard, and do these changes persist after a reboot? Or do they vanish--like the changes never happened?
2. What's the output of this command right after a reboot?
Code:
$ [B]mount[/B]
Click to expand...
Click to collapse
Thanks for your reply,
1- I realy need some more details about this point. Some more explaination will be highly appreciated.
2- After typing this line and enter, the output is : /system/bin/sh:
Code:
$: not found. Moreover,after reboot, wh
ile launching Waze, I get the message : "Wazecan't access your sd card. Make sure it isn't mounted".
geowolf1000 said:
There are two ways
1 the easy way is an app from playstore to do that at every boot
Are many can do this
2 the hard way is a script
You can paste it to init.d folder or script manager execute at every boot
Do you have gtab?
And sd card should not have sysrw option
Something wrong with install of rom
Click to expand...
Click to collapse
Thanks fro your reply.
1- May know which app I should use.
2- Sure it looks hard for me to do that.
Yes I do have a Gtab 7.7 with JB.
The rest of the message needs more explaination if possible.
samaliset said:
Thanks fro your reply.
1- May know which app I should use.
2- Sure it looks hard for me to do that.
Yes I do have a Gtab 7.7 with JB.
The rest of the message needs more explaination if possible.
Click to expand...
Click to collapse
Sd card always alow read/write permission is not part of root
Type mount to terminal and post the result so rajeevvp give you his knowledge
samaliset said:
Yes I do have a Gtab 7.7 with JB.
Click to expand...
Click to collapse
There is no such device as a gTablet 7.7. Is this the tablet you have?
1. Use the standard file manager app and create or delete some files and directories on the SDcard. Reboot the gTablet. Verify that the changes you made remain after the reboot.
2. The $ character is just a prompt, used to indicate that the commands that follow can be executed by any user. Don't type that into the Terminal emulator app. Type in only the stuff shown in bold.
3. Setup adb (see the sticky threads) to make entering commands and collecting logs easier.
4. From now on post the exact error or diagnostic messages that you see. Or, make screenshots and post them.
I am very sorry to post my message here by mistzke.
Anyway I would like to thank all for your help and would like to inform you that the probme had been solved in installing a new tom.
Thanks znd sorry again

KPPD - Configure post-processing settings of your display! [2015/08/09]

Hello all! If you're familiar with KCAL and suffer from symptoms such as a locked bootloader or non-loadable kernel modules then you may be interested in KCAL Post-Processing Daemon, or KPPD - the all-in-one display tuning tool that you can use to customize your color calibration on the fly!
This does NOT require an unlocked bootloader, custom kernel, or even a kernel that supports module loading, just run the daemon and you're good to go!
To install on a device with a locked bootloader, you'll need to download the kppd release below, and unpack it to prep for some adb fun... (If you have TWRP, you can also flash this in recovery)
Code:
adb push /path/to/kppd /data/local/tmp/
adb push /path/to/postproc.conf /data/local/tmp/
adb shell
su
mount -o rw,remount /system
cp /data/local/tmp/kppd /system/bin/
cp /data/local/tmp/postproc.conf /system/etc/
chmod 0755 /system/bin/kppd
chmod 0644 /system/etc/postproc.conf
reboot
Now at this point, you can use any scripting app to start the daemon on boot, I use ROM Toolbox... http://i.imgur.com/0juzfug.png
And you're done! To edit your display settings, just edit the postproc.conf file... http://i.imgur.com/pjOPbIr.png
Download KPPD
Thanks, works great. Now we need some custom configs
any chance you can update your KCAL Color Control app to support KPPD? Easy way to set the values
Thanks Savoca! I have followed all of your work fairly closely and am very glad we have you around the forums!
This is amazing. Would it work for other LG tablets such as the LG X8.3 with the snapdragon 610?
My G4 is pretty decent but my tablet is super red. Once you get it setup, you constantly have to have Rom Toolbox installed to make this work or do you only need the app for the initial setup?
I think I can answer the second part of this. The rom toolbox thing is just one of many ways to run this script on boot. But you will need SOMEthing to start it no matter what. This could be init script (I think that's what its called, which some roms have built in) Or any custom rom could include it by default.
So no, Rom toolbox isn't really necessary, its just the way he recommended to get it running on boot if you don't know another way.
I am more curious to seen if it will work on my LG tablet. I'll just have to test it out. I guess worst case scenerio is you dont have it auto start on boot. If you mess it up you just reboot.
player911 said:
I am more curious to seen if it will work on my LG tablet. I'll just have to test it out. I guess worst case scenerio is you dont have it auto start on boot. If you mess it up you just reboot.
Click to expand...
Click to collapse
Yes it should work, however it depends on each device's version of the MDSS (Qualcomm display driver). If it doesn't work, let me know so I can add support for it.
I'm wondering if this would work on my G Flex 2 ? Is there any chance that it can break anything if it doesn't work?
---------- Post added at 03:37 PM ---------- Previous post was at 03:05 PM ----------
I've just installed it on my G Flex 2 and it works great. Thanks a lot!
how control this mod with KCAL apk???
armsar1978 said:
how control this mod with KCAL apk???
Click to expand...
Click to collapse
You can't (yet?). Only via the config.
New version uploaded significantly reduces CPU load and removes any delay between modifying the postproc.conf and applying the display settings.
I've read a little and I remember making rgb adjustments regularly with my old gnex years ago...
Wondering if there are suggested settings/values one can recommend for use with the G4 please.
I second this g4 question, any recommended values?
dontbeweakvato said:
I second this g4 question, any recommended values?
Click to expand...
Click to collapse
I'm using these right now: http://imgur.com/UKkOt7x
If you're editing the file at runtime, I recommend you use either FX File explorer or ES File Explorer to edit the config, root explorer and ROM toolbox editors delete the original file and rewrite a new one for some reason (maybe they can fix this in their apps) and kppd looses the original from the kernel.
Does this have an option for sharpness?
"su" doesnt work -> not found
Z900 said:
"su" doesnt work -> not found
Click to expand...
Click to collapse
You need to root your device.
savoca said:
I'm using these right now: http://imgur.com/UKkOt7x
If you're editing the file at runtime, I recommend you use either FX File explorer or ES File Explorer to edit the config, root explorer and ROM toolbox editors delete the original file and rewrite a new one for some reason (maybe they can fix this in their apps) and kppd looses the original from the kernel.
Click to expand...
Click to collapse
"Error occurred while trying to save file. File will not be saved." - using es file explorer. I seem to not have issues with rom toolbox. What's the deal with it not saving after editing?
dontbeweakvato said:
"Error occurred while trying to save file. File will not be saved." - using es file explorer. I seem to not have issues with rom toolbox. What's the deal with it not saving after editing?
Click to expand...
Click to collapse
Sounds like an issue with the app. You could always move the config file to somewhere on /data where you would have write access. Just point kppd to the config location in the init script.

Categories

Resources