chmod in a Root Shell Fails On A File in /data/data - Java for Android App Development

I hope I am getting this is the right place. If not, please respond with a suggestion of where to place it. Thanks!
First some background. I have written a root app that, to accomplish its work, must chmod some files located under /data/data. This app works as expected on my 3 test devices - all JB or KK and has been published to Play Store where comments from users indicate that it works on other devices including those with Android 5 and 6.
The other day, a user contacts me and says the app doesn't work on his device. Here is some of the device info my app captures:
Linux Version: 3.10.40-perf-g90ddf4a
Android SDK Version: 22
Maker: motorola
Brand: motorola
Product: quark_verizon
Device: quark
Model: XT1254​
My app confirms that the device is indeed rooted and that there is a recent SuperSu app installed. My app is able to chmod directories and some other files. But it cannot manage certain others. I get a result code of 10 but am not sure what exactly that means except some form of failure.
I should add that trying to change the permissions on the file using Root explorer also seems to fail (silently) since right after doing so, the user ran my app and its log shows the file's permissions unchanged.
I wondered if it was an SeLinux issue - something about the files' contexts - but having my app perform ls -Z shows that the contexts (other than the user id - as expected) are identical to those on my 3 devices. Plus there are no context violation warnings in dmesg as I understand there should be were SeLinux the issue.
I have read about extended file attributes and there is one for marking a file immutable. I don't know if this would case a chmod to fail but maybe. I doubt this is the case with these files since I know they are being changed by the file's owning app. But there is no way to confirm this unless the user installs busybox which contains the lsattr command. And he isn't keen on doing that.
Can anyone suggest what might be causing this problem and why it might be restricted to this particular device? I am just completely stumped.
Thanks

Related

[SCRIPT] Adblock Script and Updater

I put together a small shell script to make it easy for anyone rooted to block ads and check to see if they have the latest version I keep of adhosts. If after checking you do not have the latest, it will download it for you automatically.
What does this script do (in a nutshell):
1) Checks to see if you have the latest version of ad hosts for adblocking from me
2) If you do not have the latest, it will download it for you
3) If you have the latest, it just exits out, no changes
4) Installs the script to your /system/xbin directory so the next time you just have to type:
Code:
su
blockads
and it will run the script for you
How to run this?
Get this if you are using an AOSP ROM:
1) Download it from http://dl.dropbox.com/u/24904191/blockads
Try this if you are using a SENSE ROM (thanks chrootz for the fixes):
1) http://dl.dropbox.com/u/24904191/sense/blockads
*** If you have troubles getting the script to work, try updating your system to the latest version of busybox (stick it in /system/xbin and overwrite the current version of busybox, then change the permissions to 755 and owner and group to root) ***
2) Move it to /data/local/tmp (if you dont have it, create it) from a file explorer with root permissions (must set the system in r/w mode) or from the terminal shell
3) make sure the script has the right permissions by typing:
Code:
su
chmod 755 /data/local/tmp/blockads
in the terminal shell (in the emulator or whatever you use to get to it)
4) run the script by typing
Code:
/data/local/tmp/blockads
5) let it do its thing
After its done you can run it again anytime from the terminal by typing
Code:
su
blockads
as already mentioned.
I'm working on making it a GUI app next (with more features), but this should tie anyone who wants it over until then
Anyone who finds any adservers and wants me to add them to the list, feel free to list them here and I will add them.
Latest updates:
2011-12-01: Updated to block carrieriq
Tried this out and got this:
sh-3.2# su
sh-3.2# /data/local/tmp/blockads
Fetching host file via hostname
wget: bad address 'dl.dropbox.com'
update could not be completed, sorry
sh-3.2#
newter55 said:
Tried this out and got this:
sh-3.2# su
sh-3.2# /data/local/tmp/blockads
Fetching host file via hostname
wget: bad address 'dl.dropbox.com'
update could not be completed, sorry
sh-3.2#
Click to expand...
Click to collapse
I forgot some ROMs and such have a busybox version that doesn't work right with hostnames in wget. I'll see if I can work around that and update the script
EDIT: updated to work around by using the IP for those that their busybox wget does not work correctly with hostnames. Only issue with that is the IP may change.
Ok. I am stuck. I actually don't have a hosts file under "etc", only a hosts.bak. With root explorer mounted as r/w I am still not able to rename the "host.bak" file to "hosts" - error message "read-only file/directory". I created a blank "hosts" text file, put in on the sdcard and with terminal emulator still can't cp to "etc" because of "read-only directory" error message. Any other suggestions?
GermanGuy said:
Ok. I am stuck. I actually don't have a hosts file under "etc", only a hosts.bak. With root explorer mounted as r/w I am still not able to rename the "host.bak" file to "hosts" - error message "read-only file/directory". I created a blank "hosts" text file, put in on the sdcard and with terminal emulator still can't cp to "etc" because of "read-only directory" error message. Any other suggestions?
Click to expand...
Click to collapse
Top right corner of Root Explorer .... Mount RW.
Sent from my A05PTH3ORY using XDA App
Does this do anything differently then AdFree, from the market?
yareally said:
I forgot some ROMs and such have a busybox version that doesn't work right with hostnames in wget. I'll see if I can work around that and update the script
EDIT: updated to work around by using the IP for those that their busybox wget does not work correctly with hostnames. Only issue with that is the IP may change.
Click to expand...
Click to collapse
Updated blockads script to test this am and:
sh-3.2$ export PATH=/data/local/bin:$PATH
sh-3.2$ su
sh-3.2# blockads
Fetching host file via hostname
wget: bad address 'dl.dropbox.com'
The busybox version of wget on your system does not work correctly with
hostnames. Trying workaround with latest known IP to the hostname...
Connecting to 184.73.229.87 (184.73.229.87:80)
hosts 100% |***********| 641k 00:00:00 ETA
backing up old host file and updating
failed on 'hosts' - Cross-device link
md5sum: can't open '/system/etc/hosts': No such file or directory
/system/xbin/blockads: line 38: [: 8172d35d1b72871f7e1ef4e709920f0e: unary operator expected
Unable to chmod /system/etc/hosts: No such file or directory
Unable to chmod /system/etc/hosts: No such file or directory
remounting filesystem in r/o mode...
Cleaning up files...
rm failed for -f, No such file or directory
update complete!
sh-3.2#
The end result is the existing hosts file being renamed hosts.bak and obviously no new hosts filebeing being created.
EDIT.... The above is testing on my inspire running busybox 1.19. Tried using the script on my sensation running bb 1.18.4 and it works fine.
Edit edit... Installed bb 1.18.4 on inspire and result is the same as posted above.
DroidTh3ory said:
Top right corner of Root Explorer .... Mount RW.
Sent from my A05PTH3ORY using XDA App
Click to expand...
Click to collapse
That's what I did, but it does not work - still does not let me modify read-only files.
After reading over the code and seeing the comments, I can only guess you had the modified version of wget on your device during testing, which does support host names. Before I continue, I am not trying to rain on your parade, but... By downloading the file, checking the md5, comparing it to the existing file, replacing if needed, and then cleaning up... you went about 5 steps beyond what just doing an "if server file is newer" check would do by including a custom wget. Even though you have to put in the code to install and verify the wget, the trade is that you no longer have to download the file every time, check it every time, and worry about making sure the md5 matches.
If you decide you want to switch over to that method, you can check out the option already included in http://forum.xda-developers.com/showthread.php?t=1092128 by downloading the live install version to view the actual script. Just a recommendation to optimize the process. Nice work, though, you definitely found a way to get the job done.
As for the difference between this and Adfree. There is no real difference. Adfree checks the server, does a callback, and prompts the user with updates. Adfree just requires an entire shell to turn it into an app, but will automatically run on boot.
twistedumbrella said:
As for the difference between this and Adfree. There is no real difference. Adfree checks the server, does a callback, and prompts the user with updates. Adfree just requires an entire shell to turn it into an app, but will automatically run on boot.
Click to expand...
Click to collapse
So, for those of you not comfortable running ADB, or Terminal Emulator, just install AdFree, and let it do everything for you.
spotmark said:
So, for those of you not comfortable running ADB, or Terminal Emulator, just install AdFree, and let it do everything for you.
Click to expand...
Click to collapse
Well, you also have the option of most included ROM toolkits, ScriptFusion, and a lot of preinstalled adblock scripts, but the big difference is the hosts file itself. Sounds like this one is custom, whereas mine takes bamf and adfree and merges them. This one may end up blocking more ads, but the only way to know would be to sit down and compare them all.
Sent from my ADR6400L using Tapatalk
twistedumbrella said:
Well, you also have the option of most included ROM toolkits, ScriptFusion, and a lot of preinstalled adblock scripts, but the big difference is the hosts file itself. Sounds like this one is custom, whereas mine takes bamf and adfree and merges them. This one may end up blocking more ads, but the only way to know would be to sit down and compare them all.
Sent from my ADR6400L using Tapatalk
Click to expand...
Click to collapse
Ah, I see.
Thank you for your comments everyone . I'll refine the script a bit more and also deal with a permanent workaround for not having a wget that checks hostsnames by testing with a ping and getting the IP first, using that and then doing wget. This started as a way for me to deal with having to move my ad host file each time I update it on my phone to just giving it out to everyone.
The only other difference than what was mentioned between my script and adfree as far as I know is I include a wider range of adhosts according to those that have used both. I have never used adfree, but people that have said I blocked more ads than they do and I also use an invalid IP address to block (0.0.0.0) instead of the loopback address (127.0.0.1) so it kills them a bit faster.
If anyone is still having problems that weren't resolved with it from above, let me know as well. I tested it against busybox 1.16.2 on my own phone, but it seems no 2 busybox version are alike
I havent tried this, but this one does include busybox 1.19 for those that don't want to manually install it. https://market.android.com/details?id=com.jrummy.busybox.installer&feature=related_apps
yareally said:
Thank you for your comments everyone . I'll refine the script a bit more and also deal with a permanent workaround for not having a wget that checks hostsnames by testing with a ping and getting the IP first, using that and then doing wget. This started as a way for me to deal with having to move my ad host file each time I update it on my phone to just giving it out to everyone.
The only other difference than what was mentioned between my script and adfree as far as I know is I include a wider range of adhosts according to those that have used both. I have never used adfree, but people that have said I blocked more ads than they do and I also use an invalid IP address to block (0.0.0.0) instead of the loopback address (127.0.0.1) so it kills them a bit faster.
If anyone is still having problems that weren't resolved with it from above, let me know as well. I tested it against busybox 1.16.2 on my own phone, but it seems no 2 busybox version are alike
I havent tried this, but this one does include busybox 1.19 for those that don't want to manually install it. https://market.android.com/details?id=com.jrummy.busybox.installer&feature=related_apps
Click to expand...
Click to collapse
Hit me up if I can be any help. It's good to have a better list available. Adfree has never been very thorough.
Sent from my ADR6400L using Tapatalk
+1 I exam yareally's hosts, This is much faster killing them and I glad you finally developing the script update for the hosts. I am going test your script update on 2 of the roms A05PTH3ORY and Gengeritis 3D VII. Thanks - Keep it up
yareally said:
The only other difference than what was mentioned between my script and adfree as far as I know is I include a wider range of adhosts according to those that have used both. I have never used adfree, but people that have said I blocked more ads than they do and I also use an invalid IP address to block (0.0.0.0) instead of the loopback address (127.0.0.1) so it kills them a bit faster.
Click to expand...
Click to collapse
Added about 10-15 more hosts today.
Thanks for the script. I'm going to give it a shot in a little bit. AdFree hasn't worked right in months. I've been using Absolute System to block ads, but I think I'll give this a try. Thanks again.
I'm about 50% done working on a basic gui app to do what the script does + some other features, just to give an update. GUI app will be free to any xda members of course
Things I am putting into it:
Choice between no blocking, partial blocking (basically in browser only stuff in case you want to show developers some love by not blocking their application ads), and full blocking.
Updating like the script does with just a touch of a button.
Optional ability to download a host block list for your desktop pc.
*features that may come later*
-ability to send me hosts from the app to add to the block list
-ability to add your own hosts on the fly to the list (either for personal routing or for adblocking, since adblocking is only the secondary use of the hosts file). Unfortunately, you will have to figure out the hosts yourself, since there's no easy way to tell really automatically.
Any other suggestions are welcomed
yareally said:
I'm about 50% done working on a basic gui app to do what the script does + some other features, just to give an update. GUI app will be free to any xda members of course
Things I am putting into it:
Choice between no blocking, partial blocking (basically in browser only stuff in case you want to show developers some love by not blocking their application ads), and full blocking.
Updating like the script does with just a touch of a button.
Optional ability to download a host block list for your desktop pc.
*features that may come later*
-ability to send me hosts from the app to add to the block list
-ability to add your own hosts on the fly to the list (either for personal routing or for adblocking, since adblocking is only the secondary use of the hosts file). Unfortunately, you will have to figure out the hosts yourself, since there's no easy way to tell really automatically.
Any other suggestions are welcomed
Click to expand...
Click to collapse
Sounds like AdFree but much better and will work better as well. Can't wait!!
Just tried this today on gingeritis 3d beta8 and it doesnt seem to work as i get the same error someone else posted a few posts back. Something about no such file or directory system/etc/hosts. I reverted adfree and uninstalled it and renamed the hosts file to hosts from hosts.bak but when I Su adblock it gets renamed to hosts.bak and terminal shows that same error

Alternative thoughts on preventing OTA update

I don't think I have seen any mention of this idea yet. Sorry if I missed it...
In a recent thread about the 6.2.2 update and people wanting to prevent it, I thought I read that someone saw the file show up in the update directory. I'm assuming this means the same 'kindleupdates' directory you could manually drop the update into -- but if not, the idea is the same. Why not just take some step to prevent access to this directory?
The exact step to take would depend on how smart the developers were about dealing with problems in the update process
The easiest step would be to chmod 555 it. But of course if the update process is running as root it is under no requirement to honor those permissions! (My experience in the unix world tells me that about half the time, programs running as root do honor the permissions even though technically root overrides them).
Another easy step would be to delete it altogether. But they probably thought of that (if it's /mnt/sdcard/kindleupdates where someone could easily accidentally delete it) and recreate it if it's missing.
One trick that is often done is to replace the directory with a file. Some programmers do not think to check this kind of condition - they see there is something there, but they get an error opening it as a directory, and they just declare it's an error.
A more subtle trick would be to replace the directory with a symlink that points to a read-only directory (such as /system). In this case, they could open it as a directory, and just fail to write there. The programmer probably would not have thought to check whether it's a link vs. a real directory. One possible gotcha is if you point to /system, and /system is r/w, then the update could screw something up under /system. So maybe mount /system r/w, mkdir /system/kindleupdates, remount /system r/o, then link the update dir to /system/kindleupdates.
And finally, I don't know if Android has any kind of loopback filesystem capability, but loopback-mounting something read/only on that directory would certainly fake the OS into thinking there was a directory there; it would definitely be read/only, and I don't think they would ever think to check whether there is actually some filesystem mounted there! (and if there was, all you need is an app that constantly accesses some file you put there, which would make it busy so that it couldn't be unmounted).
The first method won't work because the sdcard partition is fat32 and doesn't accept unix permissions.
it downloads to the /cache folder - this folder is also used for other things like market downloads, logs from twrp and i don't know what else
btw. there are a lot of threads about this from the 6.2.1 update
make a short search for "prevent ota update" - you'll have a lot to read ...
well, i just deregistered my kindle acount and i'm still in 6.2.1...
b63 said:
it downloads to the /cache folder - this folder is also used for other things like market downloads, logs from twrp and i don't know what else
Click to expand...
Click to collapse
Ah, that makes this less practical. Still, perhaps when the next update comes out I can try a variation on this but it requires the filename to be known.
If the update is downloaded as a single file to /cache, which is named the same as the file you can manually grab, then someone who hasn't gotten 6.2.2 (and is not averse to this failing) can try this in a root shell:
mkdir /cache/update-kindle-6.2.2_D01E_3205220.bin
mkdir /cache/update-kindle-6.2.2_D01E_3205220.bin/blah
The purpose here is to put something unremovable in the way of the file it wants to download. Most likely if the update sees something with the existing name there it would probably want to blow it away (after determining it's incomplete) - and since any update there would normally be a regular file, they probably would do nothing more complicated than a simple unlink syscall to delete it before re-downloading. However, since it's a directory with something in it, that unlink will fail. In actuality, making the subdirectory (second command above) should be unnecessary because the unlink should not work for directories; there's a special rmdir syscall for them.
btw. there are a lot of threads about this from the 6.2.1 update
make a short search for "prevent ota update" - you'll have a lot to read ...
Click to expand...
Click to collapse
I did read a lot of that last time and I don't think I actually saw a definitively successful method. If there is one it should be stickied
My interest in this is a little different from most of you guys - I have very limited satellite internet and I don't like these unscheduled 185-meg downloads so I want to be able to update only when I want mostly to control that. This kind of means looking for the least-intrusive way to accomplish this.
/cache/update-kindle-6.2.2_D01E_3205220.bin is exactly where it downloads
if you find a way to even prevent the download, that would be greatly appreciated
Unfortunately I already got the update so I can't try it this time.
at least you could try your method with a dummy file of an other name and try to overwrite it with adb - if you can't overwrite it there's a good chance
I think I'm about the only one who prevented 6.2.1. I did it by constantly checking the cache folder. Found the update by chance and deleted it before it updated. Waited over a week for it to come back. Never did. An app that watched the cache folder for the updates and then moved/deleted them would work fine
Sent from my SGH-I897 using xda premium
jcase already work a way around this automatic OTA update, so when FIREMOD is ready to replace burrito I think we will have no more problem with this OTA issue. (you can find jcase announcement in the kindle developer section)
Heres what I have done to prevent this.
1) Droidwall (white list only the apps you want to allow internet access)
2) Removed "otacerts.zip" from /system/etc/security/otacerts.zip.
3) I removed "OTASilentInstall.apk" /system/app
4) Installed this 6.2.2 based Rom http://forum.xda-developers.com/showthread.php?t=1439916
Hopefully this eliminates the OTA. I had my Fire rooted on 6.2.1 with twrp and it OTA'd on its own, broke root and twrp. So I rerooted with burritoroot2 and installed CWM based recovery.

CUSPTECH Android Headunit

Hi All
I thought I'd open up an new Thread regarding the Cusptech Android head units that are very similar to the S150 units but fundamentally different.
Specs:
http://www.cusptech.com/index.php?c=products2
Here is the link to download firmware for the units.
Official Firmware
http://www.cusptech.com/index.php?c=service&cid=9588d0aa6aefd7aec5f77fd497fe9825
Unofficial Android 4 Firmware.
https://drive.google.com/file/d/0B0MRJU3tnyDrdmpkYlB1VlZ3STQ
Please let me know if you want any more added about this unit
Well, I'm a little bit sad that this unit doesn't have a unique CPU like the others. That was really the easiest differentiator. I guess we'll need more information about this one in comparison with the S150 to make it easy to differentiate between the two.
Do you actually have this unit? Because if you do, I'd like for you to run a few apps to verify specifications and make it easier to create a dedicate wiki page for it.
donaldta said:
Well, I'm a little bit sad that this unit doesn't have a unique CPU like the others. That was really the easiest differentiator. I guess we'll need more information about this one in comparison with the S150 to make it easy to differentiate between the two.
Do you actually have this unit? Because if you do, I'd like for you to run a few apps to verify specifications and make it easier to create a dedicate wiki page for it.
Click to expand...
Click to collapse
Yes I do, which apps you want me to run?
donaldta said:
Well, I'm a little bit sad that this unit doesn't have a unique CPU like the others. That was really the easiest differentiator. I guess we'll need more information about this one in comparison with the S150 to make it easy to differentiate between the two.
Do you actually have this unit? Because if you do, I'd like for you to run a few apps to verify specifications and make it easier to create a dedicate wiki page for it.
Click to expand...
Click to collapse
This is my unit. http://www.cusptech.com/index.php?c=products&t=v&vid=bef7cb4be15327cd8a090aa2c4bb74c5
ryrager said:
Yes I do, which apps you want me to run?
Click to expand...
Click to collapse
Please install Android System Info. Click on the "System" tab, click on the application (overflow) menu and export results to file. Go through it, its a simple html file in /mnt/sdcard directory and censor any information that want to hide like accounts names and SSID then upload it as an attachment.
Also, if you can install CPU / RAM / DEVICE Identifier and check the CPU discovered. If it is unspecific or seems misidentified the please sent the report back to Davy Bartoloni. He's very good at identifying the exact processor and can usually give you feedback within 48 hours. A screenshot would also be nice.
donaldta said:
Please install Android System Info. Click on the "System" tab, click on the application (overflow) menu and export results to file. Go through it, its a simple html file in /mnt/sdcard directory and censor any information that want to hide like accounts names and SSID then upload it as an attachment.
Also, if you can install CPU / RAM / DEVICE Identifier and check the CPU discovered. If it is unspecific or seems misidentified the please sent the report back to Davy Bartoloni. He's very good at identifying the exact processor and can usually give you feedback within 48 hours. A screenshot would also be nice.
Click to expand...
Click to collapse
Sorry how do I get to the overflow menu?
donaldta said:
Please install Android System Info. Click on the "System" tab, click on the application (overflow) menu and export results to file. Go through it, its a simple html file in /mnt/sdcard directory and censor any information that want to hide like accounts names and SSID then upload it as an attachment.
Also, if you can install CPU / RAM / DEVICE Identifier and check the CPU discovered. If it is unspecific or seems misidentified the please sent the report back to Davy Bartoloni. He's very good at identifying the exact processor and can usually give you feedback within 48 hours. A screenshot would also be nice.
Click to expand...
Click to collapse
I installed a virtual button app.. and found the overflow menu.... however I cannot see the html file that it creates in that folder.... so I am at a loss. It says it saved the file but I am unable to find it. Thoughts?
ryrager said:
I installed a virtual button app.. and found the overflow menu.... however I cannot see the html file that it creates in that folder.... so I am at a loss. It says it saved the file but I am unable to find it. Thoughts?
Click to expand...
Click to collapse
Excellent. I was trying to figure out how you're supposed to be able to trigger it with an app. But, all the ones I found required root and I wasn't sure if you had this access yet.
Anyways, the default file location is the /mnt/sdcard/AndroidSystemInfo directory. The nomencalture of the file should be something like "asi-system-infos-{year#}-{mo#da#}-{pid#}.html"
As for the CPU / RAM / DEVICE Identifier, I noticed that it required detection to be improved. Can you please hit the evaluate button and once it is over there should be a "Send Info" button. This will use your email client to attach a report to the developer, Davy Bartoloni. He'll be able to determine the correct information specific to your unit with 48 hours.
ryrager said:
I installed a virtual button app.. and found the overflow menu.... however I cannot see the html file that it creates in that folder.... so I am at a loss. It says it saved the file but I am unable to find it. Thoughts?
Click to expand...
Click to collapse
I haven't seen anything from you in a few days. Were you able to find the file or get confirmation from the Davy?
donaldta said:
I haven't seen anything from you in a few days. Were you able to find the file or get confirmation from the Davy?
Click to expand...
Click to collapse
I just rolled back to 2.3.4 to try use those apps because for some reason I couldn't see anywhere where the files were written. so couldn't upload the html file
ryrager said:
I just rolled back to 2.3.4 to try use those apps because for some reason I couldn't see anywhere where the files were written. so couldn't upload the html file
Click to expand...
Click to collapse
I wish you would have been more vocal. I could have given you a command to use to find the file with a terminal app, like Terminal Emulator.
Code:
$ [COLOR="RoyalBlue"][B]find /mnt -name asi*[/B][/COLOR]
find: /mnt/secure: Permission denied
find: /mnt/sdcard-ext: Permission denied
/mnt/sdcard/AndroidSystemInfo/asi_system_infos-20140210-154124.html
$
As you see above, I use the find "find" command to search for any file or directory name that starts with "asi" from all the subdirectories of /mnt. Because of its id, it cannot traverse through secure or sdcard-ext but it still found the exact path and filename. If you have root access you bypass the permission problems of any subdirectory.
Code:
$ [COLOR="RoyalBlue"][B]su[/B][/COLOR]
# [COLOR="RoyalBlue"][B]find /mnt -name asi*[/B][/COLOR]
/mnt/sdcard/AndroidSystemInfo/asi_system_infos-20140210-154124.html
#
donaldta said:
I wish you would have been more vocal. I could have given you a command to use to find the file with a terminal app, like Terminal Emulator.
Code:
$ [COLOR="RoyalBlue"][B]find /mnt -name asi*[/B][/COLOR]
find: /mnt/secure: Permission denied
find: /mnt/sdcard-ext: Permission denied
/mnt/sdcard/AndroidSystemInfo/asi_system_infos-20140210-154124.html
$
As you see above, I use the find "find" command to search for any file or directory name that starts with "asi" from all the subdirectories of /mnt. Because of its id, it cannot traverse through secure or sdcard-ext but it still found the exact path and filename. If you have root access you bypass the permission problems of any subdirectory.
Code:
$ [COLOR="RoyalBlue"][B]su[/B][/COLOR]
# [COLOR="RoyalBlue"][B]find /mnt -name asi*[/B][/COLOR]
/mnt/sdcard/AndroidSystemInfo/asi_system_infos-20140210-154124.html
#
Click to expand...
Click to collapse
Yes AndroidSystemInfo folder gets created ... just no content is placed inside it.
ryrager said:
Yes AndroidSystemInfo folder gets created ... just no content is placed inside it.
Click to expand...
Click to collapse
Can you maybe try it again but use the terminal emulator to find the file? Maybe show me the output of "ls -l -d /mnt/sdcard/AndroidSystemInfo/" and "ls -l /mnt/sdcard/AndroidSystemInfo/" commands? Btw, do you have root access on this device? Sometimes you cannot see the file because of the app's ID is different from the one that you are using to locate it.
Cusp
Hi all,
finally a thread for the Cusptech Navigation devices, YAY
I own one that i purchased mid last year. Unfortunately I must say it is really buggy. I would love to get CN MOD on them instead of stock "garbage".
As I am a little bit techy, I already gathered some Infos about the Navi:
The devices are based on Mainboards created by cusptech and sntron (sntron.com). The Mainboard incorporates different Modules/Interfaces for Bluetooth, FM-Radio, DVB-T Television and DVD. The Modules are controlled through Android Apps (SNT-FM, SNT-BT and so on). There is a main hardware audioswitch on the Mainboard that switches the sound between the different Interfaces(from BT to FM to Android Media...). Unfortunately the Output levels are not all equal. For example in my case, the BT and FM-Radio is way louder than Android Media. I already tried to access the Volume Control through Tasker, sadly Tasker has only control of the Android Media Sound. The BT-Module is not as usually found on android devices, it is fully controlled by the SNT Software and is not accessible through android itself in the settings nor can one send files through it for example. The sound quality of the BT-Interface is not really good and the Software itself is buggy and often crashes. I don't use it anymore.
I will install Android System Info and if i can find the files I put them here. Btw. I am using 2.3.4 because android 4 is still in early beta. As I know the device is rooted, at least that's what Root-Checker tells me. Although sometimes, some apps are complaining about missing root rights, like Tasker. I don't know why.
tobias.s said:
I will install Android System Info and if i can find the files I put them here.
Click to expand...
Click to collapse
Thanks, I appreciate it.
tobias.s said:
Btw. I am using 2.3.4 because android 4 is still in early beta. As I know the device is rooted, at least that's what Root-Checker tells me. Although sometimes, some apps are complaining about missing root rights, like Tasker. I don't know why.
Click to expand...
Click to collapse
Well, if you can install a terminal app; like Terminal Emulator, then type "su" and the command prompt changes from "$" to "#" then you have root.
As for your other programs telling you that it cannot access root, that is usually with a problem with mismatched_uid symlinks in the app's /data/data/{package.name}/* directories. The symptom is often caused by an incomplete update where package manager saw a uid mismatch in the settings and file system. So, you may see symlink references like the following.
Code:
lib -> /mismatched_uid/settings_10037/fs_1000
The above is showing that PM has found a user id mismatch from the settings "10037" with the apps user files "1000". However, since the /mismatched_uid/settings_10037/fs_1000 directory path doesn't actually exist the app isn't able to use its files. If you have busybox AND a terminal app installed. You can run the following command to see if this is the case with any of the currently installed apps.
Code:
$ [B][COLOR="RoyalBlue"]su[/COLOR][/B]
# [COLOR="RoyalBlue"][B]find /data/data -type l -exec busybox ls -l {} \; | grep mismatch[/B][/COLOR]
The above command uses find to search through all the apps symlinks and uses long listing to show you their links. Grep is used to filter out for the word "mismatch" to make the list smaller. If the command shows nothing at all then try removing the " | grep mismatch" to get the full output. The fix is pretty easy. Uninstall the program make sure its directory in /data/data/{package.name} is gone then reinstall.
Wow thank you for the Input. Will try it tomorrow and keep you informed.
Today my Tasker crashed after using Google Maps. Unfortunately Maps is not quit stable on the device. Seems that Android is trying to close Tasker and ban it from the status bar. Even with correct Configuration in Tasker. Must check this because I created a Profile which controls the Backlight of the unit based on Sunset/Sunrise and location. Anyway.
Attached is the file that I found in /sdcard/AndroidSystemInfo/ . Just black labled the IMEI and MAC.
tobias.s said:
Attached is the file that I found in /sdcard/AndroidSystemInfo/ . Just black labled the IMEI and MAC.
Click to expand...
Click to collapse
Excellent. But, you might have to post it on a file sharing host; like Dropbox, Skydrive or Google Drive. I think you need to have at least 10 posts before you can post attachments and linkable URLs. You can get around the URL parser by just surrounding the URL with underscores; like _https://www.dropbox.com/s/8suzxlgcdv640n8/old.google.maps.apk_ which will allow you to post an non-clickable link that can be copy & pasted into the URL bar of a browser.
(or you can copy and paste the context of the file into a post)
Is the attachment now viewable? I reattached it to the post. If not, I would upload it elsewhere.
tobias.s said:
Is the attachment now viewable? I reattached it to the post. If not, I would upload it elsewhere.
Click to expand...
Click to collapse
Yes, it is. Thank you very much.
donaldta said:
Yes, it is. Thank you very much.
Click to expand...
Click to collapse
Beat me to it...Thanks Tobia.s. I just got latest firmware from Lucy at Cusptech ... think its the same as the one that leaked earlier 20131125

those invisible menu options

There is an interesting discussion on the Russian forum the-ebook.org (paste this link into Google and select the translation; item is on page 2) regarding those annoying invisible menu options in many apps. Although the translation is a little rough around the edges, the gist seems to be that the default text and background colors for the app menus are not exactly what the e-ink display has in mind, often resulting in light or near-white text on a white background--hence, invisible text.
The "solution" used is to change some background color settings in framework-res.apk. I have no idea what the outcome looks like but it seems like a really good idea, although beyond my abilities, and the example used is 1.10 firmware. I'm using 1.21. Any attempt I have made to modify apk files has always failed
Does anyone have a fool-proof set of steps for doing this?
I remember reading about what you're talking about somewhere on the forums but I could never get it to work either...
Here's what I'm talking about:
http://forum.xda-developers.com/showthread.php?t=1356514
http://forum.xda-developers.com/showthread.php?t=1512846
OK, well.....I've got the adjusted background images extracted from the framework-res.apk file that I got from the Russian site (I'm working with the lighter background option at this point). And...I've found the setting in WinRar to simply "store" (not compress) the updated png files. So far, so good. My altered apk file is the same size as the original.
The clincher is to get it back on the Nook without disaster ensuing. I'm going to follow Renate's method for pushing back framework-res.apk via ABD (from this thread):
C:\>adb shell
# stop
# mount -o rw,remount /dev/block/mmcblk0p5 /system
# ^C
C:\>adb push framework-res.apk /system/framework
C:\>adb shell
# reboot
Keep your fingers crossed. If it works, I'll report back with step-by-step and files.
[Report: in concept this "works". On reboot I could see the slightly grey background color in menu options and going to a few apps where I knew the menus were invisible, I could see white text on the slightly grey background. BUT...almost no apps will work. The B&N side seems to function OK, but the App drawer is useless. Back to the drawing board. The Russian site has a method for installation using RootExplorer. I'll try that next.]
OK...day 2. Here's what does NOT work:
1. method in post above using ADB
2. method using RootBorwser as adapted from Russian site and detailed below:
a. Change permissions in /system, /system/etc and /system/framework folders so that all users have write access
(note this is my kludge to get around not knowing how to "mount" the /system partition as r/w--maybe it's wrong?)
b. Use ADB wireless to move modified framework-res.apk into /system/etc
c. Use RootBrowser to check ownership of modified framework-res.apk (should be and was already owner: 0-root, group: 0-root)
d. Use RootBrowser to change permissions on modified framework-res.apk to rw-r--r-- (664)
e. Use RootBrowser to move (cut/paste) modified framework-res.apk into /system/framework (overwrite)
With Superuser permission, this all went off without a hitch.
f. Use RootBrowser to reset permissions of folders listed in (a)
g.Shut down Nook and restart.
The result is the same as the ADB-only method described before. The Nook starts up just fine. You can see that the background color of menus is slightly gray. Those changes have obviously worked. But the vast majority of apps will not run (ADW Launcher is an exception). At one point while I was fiddling with things the Nook spontaneously rebooted.
I guess that's better than spontaneously combusting
SIGH. Clearly, despite my best efforts, something I did in handling the framework-res.apk has damaged it in some subtle way, OR, my inability to properly "remount" the /system as R/W is causing the problem, although using ADB this is accomplished without difficulty and since the result is the same...it must be the modified apk file.
And this is why I have a dedicated SD card backup......
Method 3 that does NOT work:
1. Install Ninjamorph and BusyBox from Market
2. Follow instructions for altering framework-res.apk found here.
Two ways to Finish Project, with zip-align and without. Both yield the same result which is the same as the other methods above, i.e., the B&N stuff mostly works and the desired contrast of the menus is achieved so you can actually see what used to be invisible, but most apps will not run. Really frustrating.
I have to say that while this method seemed promising it is tedious in the extreme as each of the 28 png files must be replaced individually and that means each must be located in a much larger list (which reverts to the top after each replacement....). Ugh.
I simply don't believe anyone who says they can make these modifications with the instructions they have provided. It must be that people who are more familiar with this stuff are leaving out information which is so obvious to them that they don't even think to mention it
framework-res.apk is an apk and therefore it must be signed.
It's a system apk so it must be signed with the system signature.
Modifying a few things doesn't annoy the signature matching, other stuff does.
When you have problems, please quote from logcat because that tells you exactly what the problem is.
Using ADB:
Code:
logcat
Whatever.9.png are special files.
The are usually created thusly:
http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch
When they get packed into an apk they are turned into a PNG graphic with alpha channel.
aapt handles this.
If you take a PNG with sidebars and just zip it, it will not work.
Renate NST said:
When you have problems, please quote from logcat because that tells you exactly what the problem is.
Using ADB:
Code:
logcat
Whatever.9.png are special files.
The are usually created thusly:
http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch
When they get packed into an apk they are turned into a PNG graphic with alpha channel.
aapt handles this.
If you take a PNG with sidebars and just zip it, it will not work.
Click to expand...
Click to collapse
I just tried again and this time after pushing the amended framework-res.apk file (yes, all 28 amendations are nine-patch files) I typed in logcat before rebooting.
Whoosh!!! Lines of information went streaming by faster than I could follow, so much that some of the earliest disappeared from the top of the console window. I have no clue how to extract the text from the console window
The top-most complaint I saw was a reference to system error 1248 in association with the CleanMaster app. Then there seems to be a periodic (15 second) dhcpcd renewal. Eventually there is a section that says "Framework disconnected, eof, failed to read size, closing connection". Then comes a long list of notifications from the Service Manager about all the services that have just died. After that it just continues with the 15-second dhcpcd renewal cycle. Then I gave up and rebooted.
The result is the same as before. The new image backgrounds have been incorporated into the system, but most of the app drawer is just pretty icons. ADW runs--at least the drawer and home page appear. The B&N Home and Library pages load but you can't access any of the books shown. Wi-Fi can be accessed but no apps that use it will run. Occasionally the CleanMaster app throws up an error message.
Here's what I've learned so far:
1. In the original amended framework-res.apk file (for FW 1.10) viewing the archive reveals that the files which have been changed all have an "archive " attribute. None of the original files show any attribute. I don't know whether that is important. I've searched on this topic and have come up with nothing.
2. In moving the amended *.9.png files from the original Russian example for FW 1.10 into a copy of my own framework-res.apk for FW 1.21, those "archive" attributes came along for the ride and the resulting amended file does show "STORE" for the method so I think I got that part right and didn't recompress any files when moving from one apk to another (I dragged the files from one instance of WinRAR to another--I tried 7zip as well...).
But I have no idea why people report that this procedure works just fine. For me, it is predictable, but not successful.
I've just completed yet another restore from backup. I'm going to uninstall CleanMaster and try again. Perhaps it's background activities are driving the process into the ground. I have no clue.
Here's the logcat session file (learned how to get that done!) after a re-try, having removed CleanMaster first.
No change in the outcome but no bleating from the Nook about CleanMaster errors.
I wonder--is it the modified apk that is causing the system to malfunction, or....is it the way it is being pushed back to the Nook?
So..an experiment: I pulled a copy of the stock framework-res.apk from my Nook. I didn't do anything to it at all. Then I pushed it back to the Nook via wireless ABD:
C:\>adb shell
# stop
# mount -o rw,remount /dev/block/mmcblk0p5 /system
# ^C
C:\>adb push framework-res.apk /system/framework
C:\>adb shell
# reboot
This is supposed to work, yes? It does not. It leaves me in the same condition that all of the other attempts by this and other methods have. The Nook boots normally and displays Home but you can't access the "currently reading" book. I can get to the app drawer via the quicknav buttons, but very few apps will work (including ADB). There is no way to examine the file system because RootBrowser will not work (although ES File Explorer does, but it doesn't have root access).
So....whether the modified apk is OK or not, I would never know because all of the methods I have tried to get the framework-res.apk back onto the Nook have been unsuccessful.
That procedure should work fine.
Have you checked using the stock framework-res.apk ?
Renate NST said:
That procedure should work fine.
Have you checked using the stock framework-res.apk ?
Click to expand...
Click to collapse
Yes, that's what I just tried. Just pulled it via ADB and then pushed it right back. I also installed a copy of Root Explorer (I generally used Root Browser) because that's what was used in the original thread on the Russian site where I got started with the whole project. That also yields the same results. The Home screen loads but you can't access the book currently being read from it or from the little button at the top left. You can access any of the QuickNav options. The Library "functions". But you can't access books from their covers and the double-tap does not work.
In the app drawer, ADW seems to work fine but you can only run a very few apps, and none that require wi-fi (although wi-fi works). Too much fiddling around and the Nook spontaneously reboots.
When I have tried to move in the modified apk with the slightly gray background 9.png files I can see that the new image backgrounds have been used in the drop-down menus. This suggests to me that the problem is not in how the 9.png files have been moved from the FW1.10 apk obtained from the Russian site into my FW1.21 apk but rather in the integration of the modified apk into the system. I've checked permissions, etc. Everything is OK but the system is just screwed up.
I'm running FW1.21 which has been rooted using Nook Manager with Gapps added. I've done the multi-touch modification and have swapped in a modified internal.db file which seems to have solved the confusion of the "reading now" button. I have some apps that run along in the background, like Tasker and Clean Master (probably others that I don't realize). Do I need a completely clean system to make this change?
I saw the logcat and it showed that it's unhappy and killing the Android.
I couldn't see exactly where the problem is.
I think that you are doing too many things at once.
If there are specific things that do not work, a logcat when you do that should show.
Renate NST said:
I saw the logcat and it showed that it's unhappy and killing the Android.
I couldn't see exactly where the problem is.
I think that you are doing too many things at once.
If there are specific things that do not work, a logcat when you do that should show.
Click to expand...
Click to collapse
Yes, I was probably a little unclear. The ONLY thing that I did when I produced the logcat was attempt to push the modified framework-res.apk file back to the Nook. All those other things mentioned have long ago been successfully accomplished and included in my current backup (which I've had to use dozens of time in the last week or two as I struggle with this framework issue).
The ONLY change to the stock framework-res.apk is the overwriting of 28 *.9.png images with ones copied from another framework-res.apk which, unfortunately, is from FW1.10 (or I'd just use it "as is" without the copying). However, even pushing back an unmodified stock apk results in the same mess.
Like I say, based on what functionality remains when the modified apk file is pushed over, it is clear that the new images are being used, but the system function is severely degraded.
I don't know much about the process, but from what I've read I'm wondering if it would be better to use a zip via CM to deliver this modified file? That way the Android system is not even running (right?) during the replacement procedure.
When you say "stop" Android is no longer running.
Try clearing the cache:
Code:
rm -R /data/dalvik-cache/*
Renate NST said:
When you say "stop" Android is no longer running.
Try clearing the cache:
Code:
rm -R /data/dalvik-cache/*
Click to expand...
Click to collapse
Before pushing? After, but before rebooting?
Anytime that Android is stopped you can clear the cache.
I tried this with a copy of the stock apk:
Code:
C:\>adb shell
# stop
# rm -R /data/dalvik-cache/*
# mount -o rw,remount /dev/block/mmcblk0p5 /system
# ^C
C:\>adb push framework-res.apk /system/framework
C:\>adb shell
# reboot
It put me in an very long chase of the black and white dots that I almost thought would be endless but eventually it finished booting and is in the same condition as all the previous methods. Very crippled.
I can't figure it out
First, get the 1.2.1 update off B&N's website and unzip.
Get framework-res.apk out of that and push it.
The stuff in /system/framework should all be chmod 644.
An ADB push probably leaves it with wider access.
None of this should make any difference.
I'd guess that you are either missing a resource in your fw-r or else you modified something else.
Find an app that crashes. Get a logcat of just that crashing.
Renate NST said:
First, get the 1.2.1 update off B&N's website and unzip.
Get framework-res.apk out of that and push it.
The stuff in /system/framework should all be chmod 644.
An ADB push probably leaves it with wider access.
None of this should make any difference.
I'd guess that you are either missing a resource in your fw-r or else you modified something else.
Find an app that crashes. Get a logcat of just that crashing.
Click to expand...
Click to collapse
I got a copy of the FW 1.21 zip from B&N and extracted the framework-res.apk. I didn't try to push it yet. Instead I got the checksum for the current file on the Nook and compared it to the newly minted file. They were identical. I don't think there is any point in trying yet again with the same procedure. If my reasoning is incorrect, I'm certainly game to try anyway.
All files in /system/framework are chmod 644. The Framework folder itself (and the system folder) are something else, but the contents are all 644.
The only modifications I have made after rooting with Nook Manager are the installation of Google Apps, the implementation of multi-touch (I have to go back and look that up to see what all I did, but surely nothing with framework-res.apk or it never would have worked....), editing settings.db to relabel the QuickNav buttons after programming with NTMM, and pushing a modified copy of internal.db to fix the schizo "reading now" button. As i say, these are all long-established changes and the Nook has been stable with them. I think Google apps may modify framework.jar, but I'm not sure.
[I checked on multi-touch. I flashed a new kernal image and added one line to /etc/permissions/required_hardware.xml in order to enable multi-touch...have no idea what "flashed a new kernal" actually did, but it worked]
Two really noob questions: 1) how can I get a logcat of an app crashing when ADB will not run once a copy of framework-res.apk has been pushed? 2) if the Android system is actually stopped when I type "stop"in ADB shell, how does ADB continue to function?
And, actually, apps do not so much "crash" once I've attempted to put in a "new" framework-res.apk--most just refuse to run. But maybe there is something going on in the droid brain while the screen flickers a little and nothing else happens.
ADB runs under Linux, not the Android subsystem.
You should always be able to access ADB.
If ADB isn't running continuously and reliably you have problems.
If some app does not run, give the specific section in logcat where it doesn't run.

[Q] TMP-MKSH folder

Hello. Can somone tell me what is TMP-MKSH folder with one file. I deleted this unfortunately... is this important file? Can someone upload that folder with file? I don't remember permissions.
I'm on KK 80220h. Please help.
(1) BSD Reference Manual MKSH(1)
NAME
mksh, sh - MirBSD Korn shell
SYNOPSIS
mksh [-+abCefhiklmnprUuvXx] [-T [!]tty | -] [-+o option] [-c string | -s | file [argument ...]] builtin-name [argument ...]
DESCRIPTION
mksh is a command interpreter intended for both interactive and shell script use. Its command language is a superset of the sh(C) shell language and largely compatible to the original Korn shell.
I'm an Android user, so what's mksh?
mksh is a UNIX shell / command interpreter, similar to COMMAND.COM or CMD.EXE, which has been included with Android Open Source Project for a while now. Basically, it's a program that runs in a terminal (console window), takes user input and runs commands or scripts, which it can also be asked to do by other programs, even in the background. Any privilege pop-ups you might be encountering are thus not mksh issues but questions by some other program utilising it.
FILES
~/.mkshrc User mkshrc profile (non-privileged interactive shells); see Startup files. The location can be changed at compile time (for embedded systems); AOSP Android builds use /system/etc/mkshrc. ~/.profile User profile (non-privileged login shells); see Startup files near the top of this manual. /etc/profile System profile (login shells); see Startup files. /etc/shells Shell database. /etc/suid_profile Suid profile (privileged shells); see Startup files.
About Android L and SELinux
The developer preview of Android L hints at which restrictions for root apps, mainly with regard to SELinux, can be expected in future.*Chainfire*provides a very helpful, developer-aimed*explanation of the impact of SELinux*and thus I won’t dive into more details here.*Fact is: most root apps don’t work on the Android L developer preview.*At least, not yet. Development of root apps becomes more difficult. As a developer of a root app myself, I’m highly interested in understanding the reasons and fixing them as soon as possible. The restrictions present in the developer preview will most-likely be included in the official release of Android L and later versions. Further restrictions must be expected. Thus, even although the results I describe in this article show that superuser access can still be achieved (at least for some apps) it’s very well possible that these methods won’t work in a few months.
Setup
The following experiments were done on a Nexus 5 running the Android L developer preview. The device was rooted using the steps shown by XDA usersavoca*here. Thanks, savoca! Additionally,*SuperSU*2.00 by Chainfire was used. Thanks, Chainfire!
After setting up the device and rooting it, I tried to run my Android app RepetiTouch Pro. As expected, it did not work. Like many root apps, RepetiTouch uses an executable stored in its private app directory (under /data, e.g., /data/data/com.example.myapp/files/myexecutable) to handle the tasks which require superuser privileges. Trying to run this executable, called*eventserver*in this app, in a su shell results in
*
tmp-mksh: ./eventserver: can't execute: Permission denied
SELinux context experiments
Following this test, I experimented with various SELinux file contexts and additionally changed the file owner of this executable to root (the default file owner is similar to u0_a123). The file contexts can be listed via*ls -Z*and changed via the*chcon*command which is part of Android’s toolbox. Example:
#*
*
#*
#*
*
ls -Z eventserver
-rwx------ u0_a88 u0_a88 ubject_r:app_data_file:s0 eventserver
chcon ubject_r:system_file:s0 eventserver
ls -Z eventserver
-rwx------ u0_a88 u0_a88 ubject_r:system_file:s0 eventserver
SuperSU supports the*-cn/–context*argument to set the SELinux context, e.g.,
$*
su --context u:r:untrusted_app:s0
The default context is u:r:init:s0.
There were different results/errors:
“./eventserver: can’t execute: Permission denied” with error code 126 and different shells prepended, e.g., “tmp-mksh: ./eventserver: can’t execute: Permission denied”. For this error,*exec error*is used in the following.“error: only position independent executables (PIE) are supported.” with error code 1. For this error,*PIE error*is used in the following.success (which only means that the file could be executed, it still might not get access to other files or resources)
Default file context (ubject_r:app_data_file:s0)
su contextdefault ownerroot owneru:r:init:s0tmp-mksh: exec error tmp-mksh: exec erroru:r:untrusted_app:s0sh: <stdin>[1]: exec errorPIE erroru:r:system_app:s0sh: exec errorsh: exec erroru:r:system_server:s0sh: exec errorsh: exec error
_____________________________________Read more write less and be smart

Categories

Resources