• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root /data/data

TehJibba

Android Enthusiast
Feb 10, 2013
294
98
On A Boat
So in my quest to make a nice rom ive hit a small snag. Im trying to use the saved app data for the launcher layout and some other basic settings from /data/data folder in the rom. Ive also got one app in /data/app that needs to be installed on flash also (wont work from /system/app already tried)

What id like to happen is flash the rom and boom its was like using a cwm backup(sorta) my widgets and desktop layout is intact.

This is what i have for the /data partiton in my updater script so far.
mount("ext4", "EMMC", "/dev/block/mmcblk0p18", "/data");
package_extract_dir("data", "/data");
set_perm(1000, 1000, 0771, "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/data");
run_program("/sbin/busybox", "umount", "/data");
Its partially working as it does extract the /data folder from the rom. But the app in /data/app is not installed on boot and indeed is not even in the /data/app folder once booted. The stuff from /data/data is installed however the settings and widgets are reset like when you first flash any rom.

A little assistance from someone that knows more then i do would be greatly appreciated
 
basically, zte made some weird partition shifting thing happen. you installed it to cache

outside of cwm, you are correct mmcblk0p18 is data, but if you take a look at /proc/partitions in a text editor you will see that the 2.7gb partition mmcblk0p19 cant possibly actually be carrier, and data is obviously not 300mb

179 16 57344 mmcblk0p16
179 17 8192 mmcblk0p17
179 18 311296 mmcblk0p18
179 19 2736128 mmcblk0p19

cwm however uses the ACTUAL partition layout
carrier in cwm is 16, in rom its 19
data in cwm is 19, in rom its 18
cache in cwm is 18, in rom its 17
 
Upvote 0
its not your fault, you actually had the right block number for in rom use, but zte tricked you as they have many others. had us all fooled for a while, till superr and i were working on cwm and shinru noticed something odd, dont remember what it was but luckily it led to me manually checking all the partitions and figuring all that crazy shit out lol
 
Upvote 0
Ah ok gotcha. so i changed it in the updater-script and YAY /data/app installed correctly. Im still having trouble with the /data/data bit loding up properly. Or am i doing it wrong for trying to get the launcher widgets and layout the way i want them after flashing.

Does /data/data get formated on boot? Or how else can i maintain the custom desktop layout/widgets after flashing?
 
Upvote 0
on first boot maybe, not really sure about that. but if its not holding settings its either that or the programs themselves are taking over then rejecting the manually created files or you didnt get ALL the programs files so it assumes it has to create its settings

for instance, say there is a main.conf and a secondary.conf
the program looks for main.conf when started, if it doesnt find it, it hasnt been run before obviously then proceeds to make its own default settings files
the presence of secondary.conf is irrelevant if main.conf isnt there because that isnt what the program was looking for

if you didnt copy absolutely everything from data/data on a fresh install without inputting any passwords or personal info, try doing that. it may be a file outside of there that tells it whether its been set up yet or not though, or it may just format it all as you said
 
  • Like
Reactions: TehJibba
Upvote 0
Ok gotcha. Ill run a few more tests to see if i can track it down. If it dont work then meh ill scrap the idea for now and just move on to other things that need attention

*edit* I do wonder if that is the case, needing to copy over all of /data/data to trick the system. Seems messy tho to do it that way. Wonder if theres an xml file that i could edit the defaults of, will look around some more
 
Upvote 0
that works too. but yea if you want to put in the work and track it down just use the whole data partition and remove one folder from /data/ at a time, then once you know which ones are needed and which ones arent from there, say you needed /data/misc/, you can go inside there and delete one folder at a time, see which ones you can eliminate from that, then keep going deeper till you get rid of all the bloat
 
Upvote 0
good point. though im pretty sure its set up to be at least readable by everyone, might not be able to write over them but that would just mean the settings would be stuck for good

you know how much i love linux though... lol, so i dont remember what a permission setting of 1 actually is like at the end of 771. i know that root is what is being given full access, thats the two 7s, but everyone else gets a 1 which i assume is read only access?
 
Upvote 0
i could just use root browser and find out what the perms need to be, that very well could be it too. I will try all of these suggestions and go from there. I know it can be done ive seen roms that do it so its gotta be possible :D Will report back after more tests thank you guys for helping debug this bit

*edit* Perms at the moment are rwxrwx--x

will flash the stock b11 rom and see what they are
 
Upvote 0
also, make sure you check the owner and group setting. kuz right now youre setting it to root if im not mistaken
the first 1000 is the owner identifier
the second is the group

should give you a couple drop down lists with the name and reference number you need

rwxrwx--x owned by root is much different than if it was owned by system or user
 
Upvote 0
**EDIT**
the data/data dir on b11 is rwxrwx--x like you said, but the app dirs inside are rwxr-x--x
and the shared_prefs inside that are -rw-rw----

hmm everything is the same on mine right now with the exception of shared prefs mine are rwxrwx--x

or just say screw it and 666 or 777 it all lol. thats probably what i would do but i tend to be rather destructive at times so doing it the right way might be better in the end
Lol im usually the same way but since i bricked my hydro (1 day after rooting it) ive become way more cautious
 
Upvote 0
**EDIT**


hmm everything is the same on mine right now with the exception of shared prefs mine are rwxrwx--x


Lol im usually the same way but since i bricked my hydro (1 day after rooting it) ive become way more cautious

yeah i bricked my hydro less then a month after getting it, locked bootloader didnt help. looking forward to your rom.
 
Upvote 0
So after many attmepts and tweaking today ive managed to get the default launcher setup and widgets the way i wanted. the only issues is that /data/data just does not want to stick for some reason ive tried various perm settings and same result. so i might just keep it as is for now and work on the rest of it later. thank all of you for the suggestions and help
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones