How do I determine required file permissions? - Android Q&A, Help & Troubleshooting

I'm working on a custom ROM, and I've been having very little trouble - very few problems are occurring, and I've written a number of scripts to automate everything for me. It's a stock-based ROM based on Samsung's KitKat 4.4.2 firmware.
The problem I'm having, is I don't know what permissions are vital. I could copy all of the permissions, and then strip out the ones I don't need after I've removed or changed files, and I could automate that, but that makes my updater-script roughly 3000 lines long - taking up unnecessary space.
I've looked at other ROMs, but what I want to know is whether there is any point having permissions set for everything. Obviously there needs to be permissions on some areas, but do all areas need permissions set?
How can I figure out what permissions I actually require? Or should I think about checking if everything in a folder has the same permissions, and then make that folder one recursive one (and keep working backwards from there until almost all permissions are conglomerated in recursive permission sets)?
Thank you very much and I hope you can help me.

furzewolf said:
I'm working on a custom ROM, and I've been having very little trouble - very few problems are occurring, and I've written a number of scripts to automate everything for me. It's a stock-based ROM based on Samsung's KitKat 4.4.2 firmware.
The problem I'm having, is I don't know what permissions are vital. I could copy all of the permissions, and then strip out the ones I don't need after I've removed or changed files, and I could automate that, but that makes my updater-script roughly 3000 lines long - taking up unnecessary space.
I've looked at other ROMs, but what I want to know is whether there is any point having permissions set for everything. Obviously there needs to be permissions on some areas, but do all areas need permissions set?
How can I figure out what permissions I actually require? Or should I think about checking if everything in a folder has the same permissions, and then make that folder one recursive one (and keep working backwards from there until almost all permissions are conglomerated in recursive permission sets)?
Thank you very much and I hope you can help me.
Click to expand...
Click to collapse
Take a look at the stock permissions and how they are set. In most updater scripts I've seen, unless there's a specific reason, individual permissions are not set, they are handled recursively through the partition or folder. I am fairly certain that all areas must have permissions set, if they weren't then the system wouldn't know what to do with the files (I have never tried to flash files with permissions not set, so I don't know if the system defaults to a permission set or not). The vast majority of files in your ROM will be rw-r--r-- (0644), so verify the permissions you need from the stock ROM and you should be ok.
Edit - Also, this is a good source of information when it comes to updater scripts.

Stryke_the_Orc said:
Take a look at the stock permissions and how they are set. In most updater scripts I've seen, unless there's a specific reason, individual permissions are not set, they are handled recursively through the partition or folder. I am fairly certain that all areas must have permissions set, if they weren't then the system wouldn't know what to do with the files (I have never tried to flash files with permissions not set, so I don't know if the system defaults to a permission set or not). The vast majority of files in your ROM will be rw-r--r-- (0644), so verify the permissions you need from the stock ROM and you should be ok.
Edit - Also, this is a good source of information when it comes to updater scripts.
Click to expand...
Click to collapse
I ended up realising that trying to recursively generate the permission script is a bit on the... scary side. So I just looked through all the permissions (thrice, to ensure correctness) and I've made a base file of permissions and a base file of symlinks for the stock ROM in question.

Related

[Q] Editing Strings

so im editing the strings in SystemUI and it decompiles and builds correctly, im using textmate as the file editor.
when i try to flash it or anything it either just says 'install complete' or i get FC
im not changing anything else, but for some reason it ALWAYS messes up
anyone got an idea?
I'm pretty sure that you just make sure it's in the right SPOT, set the correct permissions, (change back from rewritable to read-only after inserting with those permissions) and reboot WITHOUT ACTUALLY INSTALLING...(using a dalvik wipe immediately after also , I'm sure.). I've had the same issues with changing 'proprietary' system apps before, and that trick has always helped me.
Edit: This is the lazy, 'Root Explorer' method, lol.
Sent from my Evo³d

[GUIDE] Correctly using Root Explorer to manually replace modded/stock system files

Here is the correct way to use root explorer for manually replacing system files:
1. Mount the system as r/w (read/write) per the top right corner. Navigate to the file that you plan to replace (e.g., system/framework/framework.jar).
2. Copy (not move) the file and paste it somewhere on your SD card (internal or external, doesn't matter - as long as you can locate it in case you need to put it back). Rename the file you just pasted, but very subtly. For example, when renaming framework.jar, I would only throw something in front of the file name, such as "Backup - framework.jar", so I can easily distinguish it from the new file if I put them in the same spot.
3. NANDROID BACKUP!
4. Download/put on your sd card (whatever you do) the new file that you want to replace the old one with.
5. Move the new file to /system (not in a subfolder yet). Here you will change the permissions, which is crucial to avoid FCs and problems. In root explorer, you would long press the file, press permissions, and set them to whatever the old file's permissions are. This may require going to verify what they are before starting this step. For example, in a lot of cases, the permissions will be RW-R-R. In Root Explorer, this would mean checking the first two boxes on the first line and only the first box on the next two lines. In any situation, confirm that the permissions you see after you've changed them (right below the file name) match exactly what you're replacing.
6. Ensure that your new file is correctly named to exactly what it is replacing (case actually matters) and double check the permissions.
7. Move your new file to the folder, root explorer will ask if you want to replace the file. Confirm.
8. Back out of root explorer and immediately reboot.
No force closes, no problems .
It may seem like a lot to someone who doesn't do it often but for me, I actually do this method faster than any other and fly through it every time. I got tired of seeing people explain ways to use Root Explorer which result in bootloops, FCs, etc. without fail. So, I decided to put an end to it.
Great post Simba501! Thank you for this...
Obviously a "noob" thing I'm over-looking but when I try and paste the file I'm moving into /system it's prompting me that it's "read-only"?
Audiochild said:
Obviously a "noob" thing I'm over-looking but when I try and paste the file I'm moving into /system it's prompting me that it's "read-only"?
Click to expand...
Click to collapse
Toggle "Mount R/W" button at the top.
Audiochild said:
Great post Simba501! Thank you for this...
Obviously a "noob" thing I'm over-looking but when I try and paste the file I'm moving into /system it's prompting me that it's "read-only"?
Click to expand...
Click to collapse
Sounds like you need to mount \system as read-write. There is a button in the upper right corner of root explorer to mount
Sent from my SGH-I777 using XDA App
Thanks wonner and kbilly70! That was the issue
Awsome. Bookmarked!
thanks for the awesome guide. worked great for me!
Thanks, that clears things up.
I'm still wondering, though, how does one handle certificate files etc? For example, the ones found in this fix provided by zdzihu, in the META-INF folder.
kZard said:
Thanks, that clears things up.
I'm still wondering, though, how does one handle certificate files etc? For example, the ones found in this fix provided by zdzihu, in the META-INF folder.
Click to expand...
Click to collapse
Those are only for flashing purposes. Not needed if you're not flashing it. You only need to pull everything besides that folder and place them appropriately.
Using this method resulted in "app not installed" tried it with black Google search box, and just now with Mms.apk rw-r--r-- backed up old one, but method didn't work... had to nandroid last time because phone wouldn't let me install backup or market version. Looks like I'm in for it again. fudge. what went wrong?
System folder was r/w and moved apk into system/app said OK to overwrite and used hard key back button to exit root explorer. Hard key power button and selected reboot within 1-4 seconds of moving apk over system app.
Edgarhighman said:
Using this method resulted in "app not installed" tried it with black Google search box, and just now with Mms.apk rw-r--r-- backed up old one, but method didn't work... had to nandroid last time because phone wouldn't let me install backup or market version. Looks like I'm in for it again. fudge. what went wrong?
System folder was r/w and moved apk into system/app said OK to overwrite and used hard key back button to exit root explorer. Hard key power button and selected reboot within 1-4 seconds of moving apk over system app.
Click to expand...
Click to collapse
You don't install it after placing it. Placing it in the folder does install it. If you put it there, ensure the permissions are correct, and reboot, it should work.
EDIT: I don't see any mention of setting the permissions, so that was probably the issue. Again, no need to "install" it; just put it in the appropriate folder and set the permissions.
Simba501 said:
You don't install it after placing it. Placing it in the folder does install it. If you put it there, ensure the permissions are correct, and reboot, it should work.
EDIT: I don't see any mention of setting the permissions, so that was probably the issue. Again, no need to "install" it; just put it in the appropriate folder and set the permissions.
Click to expand...
Click to collapse
I did state the permissions. It's in your quote lol. Your method caused my phone to say app not installed. I had trouble getting the default app back after your method failed. Why didn't it work? I'm telling you I followed it to a T.
Sgs2, android 2.3.6, unnamed rom, December 2011 entropy kernel
Edgarhighman said:
I did state the permissions. It's in your quote lol. Your method caused my phone to say app not installed. I had trouble getting the default app back after your method failed. Why didn't it work? I'm telling you I followed it to a T.
Sgs2, android 2.3.6, unnamed rom, December 2011 entropy kernel
Click to expand...
Click to collapse
If the apk is compatible, it will work. At no point should you get an "application not installed" prompt, unless you attempted to manually install it at some point. If it wouldn't work, it just wouldn't appear in the app drawer: no prompt.
I guess this should be mentioned in the OP, but some times, clearing data of the application may be necessary after finishing. Usually a force stop at the most will allow you to see changes (which is why the steps include a reboot). You've piqued my interest. Post the files of question and I'll see if they work on my device. There was a similar issue someone else was having; I told him to redownload the apk and that was the problem. Some kind of botched file/download.
Sent from my Galaxy S II (i777)
can you edit or create new folders in the /sys directory?
mikoal said:
can you edit or create new folders in the /sys directory?
Click to expand...
Click to collapse
No. Why would you want to?
Sent from my Galaxy Tab 10.1
Simba501 said:
No. Why would you want to?
Sent from my Galaxy Tab 10.1
Click to expand...
Click to collapse
just wondering what the limitations of root explorer are.
is it only that folder? and why that folder?
mikoal said:
just wondering what the limitations of root explorer are.
is it only that folder? and why that folder?
Click to expand...
Click to collapse
You can edit and create new folders in that directory, but there's just no need to, unless you want to break the functionality of your phone.
mikoal said:
just wondering what the limitations of root explorer are.
is it only that folder? and why that folder?
Click to expand...
Click to collapse
Idk: that's the only one I've seen. I've created folders in other directories. At any rate, virtually every modification you'll ever make will be in /data or /system.
dsmboost said:
You can edit and create new folders in that directory, but there's just no need to, unless you want to break the functionality of your phone.
Click to expand...
Click to collapse
It fails if attempting to create it within Root Explorer. You could use other means though (on a PC, an edited ROM zip, or potentially another root file manager). But again, no real reason to: other than for development purposes, perhaps. I'm no developer though, so I can't say.
Sent from my Galaxy Tab 10.1
Simba501 said:
Idk: that's the only one I've seen. I've created folders in other directories. At any rate, virtually every modification you'll ever make will be in /data or /system.
It fails if attempting to create it within Root Explorer. You could use other means though (on a PC, an edited ROM zip, or potentially another root file manager). But again, no real reason to: other than for development purposes, perhaps. I'm no developer though, so I can't say.
Sent from my Galaxy Tab 10.1
Click to expand...
Click to collapse
Ah okay, I was referring to ES file explorer, which can modify other files in that directory.
thanks to you both!

(Q) extract samsung keyboard

Is it possible to extract samung keyboard (like attached photo) and use it on aosp roms?
I read about the twframework dependence, but does a way to make it work exist?
Or at least someone can advise me a very similar keyboard? Thank you
andre-83 said:
Is it possible to extract samung keyboard (like attached photo) and use it on aosp roms?
I read about the twframework dependence, but does a way to make it work exist?
Or at least someone can advise me a very similar keyboard? Thank you
Click to expand...
Click to collapse
Please refer to this thread : http://forum.xda-developers.com/showthread.php?t=1822973
That guy refers to a dead link.
However Drivingdroids' guide says:
How to install:download attachment.1) Download zip file (Samkeyboard.zip) from the link below.2) Using root explorer or same kind of tool, place these files and set the permissions -Only Deodexed. (Screenshots yet to come)Touchwiz.xml put in /system/etc/permissions and set permission to rw-r--r-- (I have attached a screenshot, see it if you dont understand the permission stuff)libdhwr.so put in /system/lib and set permission to rw-r--r--libXt9_core.so put in /system/lib and set permission to rw-r--r--T9db folder(with all files inside, copy this whole folder)*put in /system and set permission to rwxr-xr-xAxT9IME.apk put in /system /app and set permission to rw-r--r--
Before I wipe everything and test it on a KK rom, you think i can do it also without the zip file (taking the files i need from the zip of the sammy rom)?
andre-83 said:
That guy refers to a dead link.
However Drivingdroids' guide says:
How to install:download attachment.1) Download zip file (Samkeyboard.zip) from the link below.2) Using root explorer or same kind of tool, place these files and set the permissions -Only Deodexed. (Screenshots yet to come)Touchwiz.xml put in /system/etc/permissions and set permission to rw-r--r-- (I have attached a screenshot, see it if you dont understand the permission stuff)libdhwr.so put in /system/lib and set permission to rw-r--r--libXt9_core.so put in /system/lib and set permission to rw-r--r--T9db folder(with all files inside, copy this whole folder)*put in /system and set permission to rwxr-xr-xAxT9IME.apk put in /system /app and set permission to rw-r--r--
Before I wipe everything and test it on a KK rom, you think i can do it also without the zip file (taking the files i need from the zip of the sammy rom)?
Click to expand...
Click to collapse
Yeah first do a Backup of the present rom whatever you have, and try taking the files and copying them and fixing the permissions !! It should work
Dont forget to hit thanks if this helps you
Thank you, I'll give a try asap!
I've found (somewhere, I can't remember where) a zip file with all the files mentioned above. so I installed it on dirty unicorns, wipe cache, dalvik, fix permissions and it works! but it isn't the same keyboard of my old rom, it is samsungkeybord of ICS (quite old..). So I extracted NeatRom zip, but the files I need dont exist! (I extract it on windows and try to "search", so I'm pretty sure there is nothing). In preload/symlink/system/app the only apk that reminds to a keyboard is "SamsungIME.apk" but it refuses to install on KK and pushing it to system/app of the new rom seems to be useless.. Here the zip file and SamsungIME.apk, maybe can be useful.. Some advices? Thank you.

Enable EXTSD as writable on Rooted SGS4

You can fix the extsd write lock by using root explorer navigating to etc\platform\permissions.xml
You need to mount as RW and edit the file to match what I'm pasting below.
You can ignore the middle part about syscope info but change your permissions for "write_external_storage" the "access_all_external_storage" and the "write_external_storage"
Don't delete anything from the file or do this without paying attention. Do not alert the syscope permission in between the 2nd and 3rd permissions that relate to storage.
I found this method through Google but it's worked for me so fast with no problems. If you use root explorer and open the file in text editor when you save the modified file, the original file will have .bak appended to it. The guide I used only changed 2 of the 3 permissions I'm saying to edit but the sd lock fix went away after restarting but since I changed the permissions to what I changed below is been working gray even after restarting.
Remember be careful with how you edit the file, only change it in the places I showed to make sure there aren't any complications. If you type it manually make sure to match the formatting and symbols exactly. If you ate going to cut/paste make sure only to change the permissions to exactly how I show it.
I'm not responsible for any damage or issues caused by following this method incorrectly. Remember to save the file with the original name of permissions.xml and then restart the phone to check your now writable ext sd card.
Much easier to use "SDFix: KitKat Writable MicroSD":
https://play.google.com/store/apps/details?id=nextapp.sdfix
Rodger
I haven't tried that one but I've used the xposed framework app that is supposed to enable extsd write but it didn't seem to work properly for me or was at best unreliable when I tried it. I like knowing what patches or fixes are doing behind the scenes in case I need to change them or if there's a problem or an update and it stops working you can do it yourself especially when its add easy as copy and paste
rbird2 said:
Much easier to use "SDFix: KitKat Writable MicroSD":
https://play.google.com/store/apps/details?id=nextapp.sdfix
Rodger
Click to expand...
Click to collapse
This one hasn't worked for me very much on a few ROMs but I did have a little better luck using the Xposed module mentioned above.
Many thanks for the post, OP. I'll add that to my notes and try it on the next ROM that gives me write issues.
Awesome glad to be able to help. .. when I first upgrades yo NG6 I couldn't believe Google could screw up one of the best features in android phones compared to the iphone. At least we're able to workaround it in the current versions at least fornow
nj12nets said:
Awesome glad to be able to help. .. when I first upgrades yo NG6 I couldn't believe Google could screw up one of the best features in android phones compared to the iphone. At least we're able to workaround it in the current versions at least fornow
Click to expand...
Click to collapse
People wonder why Google apps which work fine are still considered "beta." It's because Google isn't done with something until they screw it up completely, preferably also changing the UI a zillion times so it's unusable on more than one level.
rbird2 said:
Much easier to use "SDFix: KitKat Writable MicroSD":
https://play.google.com/store/apps/details?id=nextapp.sdfix
Rodger
Click to expand...
Click to collapse
This one as well...
https://play.google.com/store/apps/details?id=jrummy.sdfix
Thanks for adding the app add an option but can you give an idea of how well or functions and its reliability
I just rooted my phone a few days ago. My phone decided to upgrade to NG6 by itself and it crippled the SD card almost completely. I had some work arounds, but this just made it so much harder. I downgraded to NC5, had a problem, did a full reset and redid my phone. Did Towelroot V3, SuperSU, turned SDM.apk and FWUpgrade.apk into backups. Then I did the SDFix app, rebooted and now the SD card works like it did with MK2. I'm very pleased.

build.prop on Android 8.1 new issues when editing?

Hi There
I have been a long time Hacker of largely MTK devices. So I wanted to ask a question and see if there's anything I am missing here:
I have an Android 8.1 device, I have rooted it using Magisk no problem and I have successfully changed the bootanimation.zip and also the audio files. I have been able to release the rooted OS, get the OS back to a released state with the changes as I have simply kept the removed dm-verity flags that Magisk uses on the OS.
However, I am unable to change the build.prop at all.
If I copy the build.prop file from the device, edit it on the PC, and save it back it bootloops. If I edit it, roll back all the changes and re-copy it back to the device it is fine.
I noticed the original build.prop permissions are RW (Chmod 600). I tested the above chmodding to 600 and 644 and it makes no difference. If it has changes in it, it fails, if not it works!
So something somewhere is maybe checking the build.prop against an original and not liking it.
Is there anyone on here that could help shed some light on this at all?
Bump...Anyone?
So an update to this is that I have now successfully removed DM-Verity from this device. I have also managed this on many other devices. I prove this by installing all kinds of changes on the device.
So I can pretty much do anything with this device, almost like pre-Android 5.1, however whenever I edit the build.prop at all it bootloops.
What I have tried so far:
I have tried all kinds of permissions on the file
I have duplicated the /vendor/build.prop in an attempt to get round possible build.prop variety issue.
I have removed the /vendor/build.prop
I have replaced system/prop with original build.prop but still edited (and changed back) from my PC and the device boots OK.
So it looks like somethiung is looking up the build.prop file and checking something. Almost like a DM-verity for the build.prop.
Really out of ideas now. i can literally unlock/change anything MTK now except for this issue.
Any help is much appreciated.
Oh i forgot to mention, this is a systemless and not TREBLE OS.
I usually change /system/build.prop and have never had an issue up through Android 10. I know this is elementary and no intention to offend anyone - but are you sure the file is being saved with unix-style line endings.
File-permission must be set to 644.

Categories

Resources