sl4a shell script help - Android Software Development

Hi all,
I'm trying to run a shell script in sl4a but I'm running into problems. Here's what I want to do: change ADW configuration files in one click (since the app doesn't yet do it natively). There are two files that need to be changed for this to happen:
Code:
/data/data/org.adwfreak.launcher/databases/launcher.db
/data/data/org.adwfreak.launcher/shared_prefs/adw_ex_preferences.xml
I'm trying to delete those files and copy in new files from a stored location on the SD card but I can't get the sl4a script to run the following rm commands:
Code:
rm -rR /data/data/org.adwfreak.launcher/databases/launcher.db
rm -rR /data/data/org.adwfreak.launcher/shared_prefs/adw_ex_preferences.xml
I use
Code:
su -c
before the rm commands to run them as root, but the error then is that the /data partition is not mounted (which I find strange since it should be rw anyway...). I've tried using
Code:
mount -o remount,rw /dev/block/userdata /data
and it looks like it runs but then it doesn't work and I can't rm the files anyway.
Am I running into a limitation of sl4a or shell scripts in sl4a? I can rm the files from the terminal, so I'm not sure what the issue is. I'm very new to this (obviously) so any tips would be helpful. Thanks!

Here is my full script currently:
Code:
#!
kill android.process.acore
kill org.adwfreak.launcher
busybox rm -R /data/data/org.adwfreak.launcher/databases/*
busybox rm -R /data/data/org.adwfreak.launcher/files/*
busybox rm -R /data/data/org.adwfreak.launcher/shared_prefs/*
cp /sdcard/adw_ex_launcher.db /sdcard/ADW/Honeycomb/adw_ex_launcher.db
cp /sdcard/adw_ex_settings.xml /sdcard/ADW/Honeycomb/adw_ex_settings.xml
cp /sdcard/ADW/Portrait/adw_ex_launcher.db /sdcard/adw_ex_launcher.db
cp /sdcard/ADW/Portrait/adw_ex_launcher.db /data/data/org.adwfreak.launcher/databases/launcher.db
chmod 664 /data/data/org.adwfreak.launcher/databases/launcher.db
cp /sdcard/ADW/Portrait/adw_ex_settings.xml /sdcard/adw_ex_settings.xml
cp /sdcard/ADW/Portrait/adw_ex_settings.xml /data/data/org.adwfreak.launcher/shared_prefs/adw_ex_preferences.xml
chmod 664 /data/data/org.adwfreak.launcher/shared_prefs/adw_ex_preferences.xml
exit
When I test the rm commands in the sl4a shell, they don't remove the files even when the /data partition is mounted. I've tried all that I know. Help please!
Sent from my DROIDX

I don't know what you are trying in your second post, but from your first post I would say:
Code:
su
busybox rm -r /data/data/org.adwfreak.launcher/databases/*
busybox rm -r /data/data/org.adwfreak.launcher/files/*
busybox rm -r /data/data/org.adwfreak.launcher/shared_prefs/*
cp /sdcard/adw/prefs.xml /data/data/org.adwfreak.launcher/shared_prefs/
..
kill org.adwfreak.launcher
If you do "chmod 664" on the files, you also have to do "chown & chgrp" or the launcher won't be able to write into the settings xml's/db's.
And /data ist mounted rw, everything else would be senseless.

Thanks for the response.
I'm trying to change ADW configuration with one click. I'm going to use Tasker to create a widget that, when clicked, runs a script. That script will:
1. delete the current ADW configuration files (launcher.db and adw_ex_preferences.xml)
2. copy the target configuration files to the proper places (and set permissions, owner, group)
3. restart ADW so that the configuration is loaded
OR
3. open the ADW settings page so that I can click "restore desktop" and "restore preferences" and have the configuration loaded in an almost-one-click solution.
The script in the 2nd post is my best effort at that. I have tried the busybox part of the script, but I don't believe it makes a difference. I will try again, though, and report back.
As far as chown and chgrp goes, I'll add in what I think that should be and post that back later, too.

Fr4gg0r said:
I don't know what you are trying in your second post, but from your first post I would say:
Code:
su
busybox rm -r /data/data/org.adwfreak.launcher/databases/*
busybox rm -r /data/data/org.adwfreak.launcher/files/*
busybox rm -r /data/data/org.adwfreak.launcher/shared_prefs/*
cp /sdcard/adw/prefs.xml /data/data/org.adwfreak.launcher/shared_prefs/
..
kill org.adwfreak.launcher
If you do "chmod 664" on the files, you also have to do "chown & chgrp" or the launcher won't be able to write into the settings xml's/db's.
And /data ist mounted rw, everything else would be senseless.
Click to expand...
Click to collapse
Progress update: Success! More or less.
I realized I wouldn't need to remove the files since the ones I was copying in would just overwrite them anyway, so that cleared up that issue.
I did add chown and chgrp (a piece of information I'm sure I'll find useful in the future) so I'm sure that helped. Making sure to get the group and owner right PER YOUR OWN SETUP was key. When I changed ROMs I had to redo it... so check properties with Root Explorer or whatever.
I revised my script a little to add the background wall paper, too.
The true key, however, was using Lua in SL4A and using the 'sush' script in this post here:
http://code.google.com/p/android-scripting/issues/detail?id=184 (comment #9). That allowed me to run my script in the 'sush' format and do what I wanted.
I also had to add a line to kill the launcher process (android.process.acore) so it would restart itself.
I now have a one-click solution to changing between two ADW desktop configurations/settings!
I've attached my script if anyone would like it. Just get SL4A, the Lua interpreter, and put the pieces together! (Use a custom shortcut on the desktop and not a widget and the desktop setup will be preserved; widgets aren't supported in any method...)

Related

Adding and removing apps from ROMs

I wasnt sure and couldnt find this anywhere but, I was looking through a zip folder of a rom and noticed the apk folder. Am I able to delete different apk's and add apps as well? And If I delete the browser apk can I add dolphin browser to work as my default browser?
Thanks in advance
I´m interested in this too.
I guess that the main problem will be to sign the new zip file once added or removed the apps
Yes, but it won't do you any good unless you also do something else. Ask the same question again in the right section, and I'm sure someone will tell you what it is. I'm not going to here, though. Not to be a jerk or anything, but we can't answer questions here, as posting these question threads clutters the dev section. Besides, you can't get a very good answer here anyway--a mod will lock this thread soon. If you want answers, you have to ask in the Q&A section.
carnegie0107 said:
Yes, but it won't do you any good unless you also do something else. Ask the same question again in the right section, and I'm sure someone will tell you what it is. I'm not going to here, though. Not to be a jerk or anything, but we can't answer questions here, as posting these question threads clutters the dev section. Besides, you can't get a very good answer here anyway--a mod will lock this thread soon. If you want answers, you have to ask in the Q&A section.
Click to expand...
Click to collapse
Thanks. I just figured since it was kinda about a rom it would be okay. But yeah you are right
Yeah, but you know how some people are.
You can remove unused/uneeded files by using a Root Manager. Deleting the apk file associated with the particular program you don't want works for me. Make sure you do a Nandroid backup in case you delete something you really needed. Don't for instance delete your virtual keyboard if you only have one.. you will be faced with forced closes.
just push or pull the application through the adb that you want to add or remove from the rom
Amazon MP3 app
I'd love to ditch the US-only Amazon MP3 app from ROMs. Can't uninstall it. Probably need to SU to where it lives & delete it.
linuxluver said:
I'd love to ditch the US-only Amazon MP3 app from ROMs. Can't uninstall it. Probably need to SU to where it lives & delete it.
Click to expand...
Click to collapse
There are instructions on how to and what app you are able to delete without it becoming unstable over at http://wiki.cyanogenmod.com/index.php/Barebones.
Use ADB.
Or Terminal:
Code:
su
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
cd system/app
rm -r appname.apk
rm -r appname.opex
E.g. appname = com.amazon.mp3
ID# said:
Use ADB.
Or Terminal:
Code:
su
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
cd system/app
rm -r appname.apk
rm -r appname.opex
E.g. appname = com.amazon.mp3
Click to expand...
Click to collapse
Simply deleting the apk files will leave the data directories, and entries in packages.xml. Someone suggest command [pm uninstall XXXXX], but I cannot get it work.
ID# said:
Use ADB.
Or Terminal:
Code:
su
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
cd system/app
rm -r appname.apk
rm -r appname.opex
E.g. appname = com.amazon.mp3
Click to expand...
Click to collapse
This, OP use this and next time use QnA for your questions
Help?
Whats the instructions to install apk? Yours shows how to install. I have SuperD and need intstall the IM.apk Thanks 8)
ID# said:
Use ADB.
Or Terminal:
Code:
su
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
cd system/app
rm -r appname.apk
rm -r appname.opex
E.g. appname = com.amazon.mp3
Click to expand...
Click to collapse
install over ADB
adb install <filename>
deafptl4ever said:
Whats the instructions to install apk? Yours shows how to install. I have SuperD and need intstall the IM.apk Thanks 8)
Click to expand...
Click to collapse
You would be smarter to leave it out, he did it since that app ate alot of ram.
Goto the market and get one of the free im apps instead.The tmo version has no feats like custom mess and stuff
ID# said:
Use ADB.
Or Terminal:
Code:
su
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
cd system/app
rm -r appname.apk
rm -r appname.opex
E.g. appname = com.amazon.mp3
Click to expand...
Click to collapse
I finally find the proper way to uninstall the system apps.
Step #1 - Find the package names of the apps (e.g. IM.apk=com.android.im)
In console, type
su
pm list packages -f
Step #2 - Delete the apk files from /system/app
In console, type
su
mount -o remount,rw /system
rm /system/app/IM.apk
Step #3 - Uninstall the package
In console, type
su
pm uninstall com.android.im

Adding blur alarm to Fission ROM

For those of you that felt in love with the Blur Alarm and looking for a way to add it back. I have figured out the missing files beside the apk that goes in the system\app. This has been tested with sucess for Fission ROM v2.0.1.
Adding Blur alarm
system\app\BlurAlarmClock.apk
framework\blur-res.apk
framework\com.motorola.blur.library.utilities.jar
Hope it help.
nice,
I prefer the blur alarm over the normal one.
but here is my problem, the dock is DeskClock.apk, which is also the Clock and the alarms,
when I replace it with the Dock.apk, then the dock won't start up,
did you try to do that?
I'm getting the following exception, and have no clue on how to fix that Oo
Code:
11-04 00:39:22.031 2063 2063 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.motorola.dlauncher/com.motorola.dlauncher.DLauncher}: java.lang.SecurityException: Neither user 10048 nor current process has android.permission.DEVICE_POWER.
braway said:
nice,
I prefer the blur alarm over the normal one.
but here is my problem, the dock is DeskClock.apk, which is also the Clock and the alarms,
when I replace it with the Dock.apk, then the dock won't start up,
did you try to do that?
I'm getting the following exception, and have no clue on how to fix that Oo
Code:
11-04 00:39:22.031 2063 2063 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.motorola.dlauncher/com.motorola.dlauncher.DLauncher}: java.lang.SecurityException: Neither user 10048 nor current process has android.permission.DEVICE_POWER.
Click to expand...
Click to collapse
What ROM are you using? I renamed the original DeskClock.apk to DeskClock.bak since I don't have a docking station. May be it has something to do with the dlauncher. I also deleted the original launcher2 and replaced it with launcherpro.apk.
Fission 2.0.2
I basically did the same with the DeskClock.apk
but added the Dock.apk from the clean verizon rom (which is basically the "stock" droid2), I guess I'm simply missing something
btw, com.motorola.dlauncher is Dock.apk
I guess something is still missing which would set the missing permission oO
got it to work...
if someone cares:
I had to manually modify the /data/system/packages.xml
it should contain something like this:
Code:
<package name="com.motorola.dlauncher" codePath="/system/app/Dock.apk" flags="1" ts="1288859615000" version="8" userId="10057">
<sigs count="1">
<cert index="1" />
</sigs>
</package>
userId and ts are probably different
change the cert index to 0 !
reboot (right after it, for example with adb reboot)
after reboot, check that your change is still in this file (should be)
put your phone into the docking station, and the blur dock should start
yay
lol, this default blur alarm app is awesome and best I have seen. I was so surprised at what it wanted me to do when I first woke up to it , lol
I am not using fission and I am using Rubix 1.6.
I can only find the bluralarm.apk file and I can't find
framework\blur-res.apk
framework\com.motorola.blur.library.utilities.jar
Do i have to nandroid back to a blurry room to pick these up or are they available somewhere else?
Thanks
rkrasny said:
I am not using fission and I am using Rubix 1.6.
I can only find the bluralarm.apk file and I can't find
framework\blur-res.apk
framework\com.motorola.blur.library.utilities.jar
Do i have to nandroid back to a blurry room to pick these up or are they available somewhere else?
Thanks
Click to expand...
Click to collapse
get the vzw clean rom (or so) from droid2files.com (http://droid2files.com/roms/VZW_2.4.5_Clean_ROM.zip)
everything should be in it...
braway said:
get the vzw clean rom (or so) from droid2files.com (http://droid2files.com/roms/VZW_2.4.5_Clean_ROM.zip)
everything should be in it...
Click to expand...
Click to collapse
Perfect; thanks much.
Question?
How do I add this to my phone and make it work? Do I need to use ADB and move it to the phone or what? I really liked the blur alarm a lot and would like to get that back if I can. Thanks for any help in advance.
You just need a method to transfer the files to the phone to the correct spot
ADB or root explorer can move the files
I will show the adb method below, you can substitute the adb shell, mount, cp (copy), chmod (change permissions), and rm (delete) steps with Root Explorer
ADB
Open a command prompt
cd to the directory where you have the files on your computer
Code:
adb push BlurAlarmClock.apk /sdcard/BlurAlarmClock.apk
adb push blur-res.apk /sdcard/BlurAlarmClock.apk
adb push com.motorola.blur.library.utilities.jar /sdcard/com.motorola.blur.library.utilities.jar
Then adb shell to the phone, mount system as r/w, copy the files to the system
Code:
adb shell
su
mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system
cp /sdcard/BlurAlarmClock.apk /system/app/BlurAlarmClock.apk
cp /sdcard/blur-res.apk /system/framework/blur-res.apk
cp /sdcard/com.motorola.blur.library.utilities.jar /system/framework/com.motorola.blur.library.utilities.jar
Then set the permissions on these files so they will work
Code:
chmod 644 /system/app/BlurAlarmClock.apk
chmod 644 /system/framework/blur-res.apk
chmod 644 /system/framework/com.motorola.blur.library.utilities.jar
You can then remove the files from the sdcard if you wish
Code:
rm /sdcard/BlurAlarmClock.apk
rm /sdcard/blur-res.apk
rm /sdcard/com.motorola.blur.library.utilities.jar
Now mount the system as read-only again
Code:
sync
mount -o ro,remount -t ext3 /dev/block/mmcblk1p21 /system
As for the Blur dock
Use the same steps above to copy the file and move it to the system
Code:
adb push Dock.apk /sdcard/Dock.apk
adb shell
su
mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system
cp /sdcard/Dock.apk /system/app/Dock.apk
chmod 644 /system/app/Dock.apk
sync
mount -o ro,remount -t ext3 /dev/block/mmcblk1p21 /system
rm /sdcard/Dock.apk
Next pull the packages.xml file
Code:
adb pull /data/system/packages.xml
Edit packages.xml as shown in the above post
Then push back
Code:
adb push packages.xml /data/system/packages.xml
When you "install" the blur dock, you might want to remove the standard android dock
Code:
adb shell
su
mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system
mv /system/app/DeskClock.apk /system/app/DeskClock.bak
sync
mount -o ro,remount -t ext3 /dev/block/mmcblk1p21 /system
Notice I just used mv (rename/move)
This is just in case I want it back later
You may need to reboot the phone when you are finished for this to work.
I never tried without rebooting so I don't know if they will work otherwise.

SwiFTP - fix for freezing downloads

I was using SwiFTP to upload files, but it seemed to freeze when downloading ...
The reason is that the /system/bin/ls command on S3 returns output which is different from previous Android versions ...
The solution is to replace /system/bin/ls (which points to toolbox) to point to busybox.
Code:
cd /system/bin
mv ls ls.orig
ln -s /system/xbin/busybox ls
Make sure you have busybox installed in /system/xbin and that your /system partition is mounted read/write.
If you don't know what this is doing, please don't attempt to do it

[HOWTO] Add init.d to stock ROM + a few other goodies

I have been resisting the urge to flash a custom ROM for a bit, but I really miss having init.d support. So I read a few threads for other phones and rolled my own.
Warnings
I borrowed bits and pieces from various places. If you don't know what init.d is, you probably don't want to do this. If you aren't willing to take responsibility for bricking your tablet, don't do this. Seriously, the risk of bricking is very low, but if you aren't comfortable booting into an adb shell from recovery, maybe this is not for you. Strongly suggest a nandroid backup before you get started so if you totally bork things you can just hit rewind.
Note: The latest CWM may prompt you on a reboot that the ROM may overwrite the bootloader and offer to fix it for you. Don't do that. The init.d hack takes over the bootloader install script, but does not change your bootloader! If you accidentally do let it fix things for you, just rebuild the install-bootloader.sh file. The other steps should be fine.
Prerequisites
First, you need root, busybox, and some sort of terminal (either adb, or some terminal you like using on the tablet).
I have found that I like Busybox Installer (from the market; https://play.google.com/store/apps/details?id=com.jrummy.busybox.installer) but for some reason it doesn't create new symlinks unless you click advanced install.
Let's get to it!
In the shell (don't type # or anything after #):
Code:
su # get root
mount -o remount,rw /system # get access to /system (4.04 seems to mount ro as is usual; seems like the original mounted rw)
which run-parts # if you don't see /system/xbin/run-parts you need to install/reinstall busybox; if it is somewhere else, note it
mkdir /system/etc/init.d
Create a file called sysinit -- we are going to put it in /system/bin. You can edit it in place with vi, mount your tablet and edit it on your computer, or create it on the computer and push it via adb. Whatever.
Here's the file (you do need the # and the things after it in the file!):
Code:
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
/system/bin/logwrapper /system/xbin/run-parts /system/etc/init.d
Note that if your run-parts is not in /system/xbin (from the which command) then fix the above to reflect your reality.
In the shell, make it executable
Code:
chmod 755 /system/bin/sysinit
Now go in the init.d directory and create some things you want to run at start up. For example:
Code:
cd /system/etc/init.d
echo '#!/system/bin/sh' >99test # note: you do need the first # in this line but not the 2nd!
echo 'date >>/data/tmp/init.d-log.txt' >>99test
chmod 755 99test
Here's a more practical one (yes, you need the # signs). Name it something like 10diskperf -- don't forget to chmod it.
Code:
#!/system/bin/sh
# Set disk read aheads to 1024
chmod 777 /sys/block/mmcblk0/queue/read_ahead_kb
echo "1024" > /sys/block/mmcblk0/queue/read_ahead_kb
chmod 777 /sys/block/mmcblk1/queue/read_ahead_kb
echo "1024" > /sys/block/mmcblk1/queue/read_ahead_kb
chmod 777 /sys/devices/virtual/bdi/179:0/read_ahead_kb
echo "1024" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
Or here is one to tweak some TCP parameters (25sysctl):
Code:
#!/system/bin/sh
sysctl -w net.core.rmem_max=524288
sysctl -w net.core.wmem_max=524288
sysctl -w net.ipv4.tcp_rmem=6144 87380 524288
sysctl -w net.ipv4.tcp_wmem=6144 87380 524288
Whatever files you put in, you need to remember to make them executable (chmod 755).
Finally, you need to kick it all off at start up. The hack for that is we are going to create /system/etc/install-recovery.sh which apparently runs on each boot.
Code:
cd /system/etc
echo '#!/system/bin/sh' >install-recovery.sh
echo '/system/bin/sysinit' >>install-recovery.sh
chmod 755 install-recovery.sh
Tips and troubleshooting
If you are too lazy to cut and paste I have the files here (View attachment init.d-support.zip) that you can just move to the right places and change permission. If you are really lazy there is lightly tested install script below.
I like to try running the whole thing before a reboot to see if I get any errors:
Code:
/system/etc/install-recovery.sh
I'd suggest putting the 99test file in first. Verify that you get the expected file in /data/tmp and then reboot and check again. Then you can remove 99test.
Same goes for adding new scripts. Try running them from the shell to see if they throw errors before you reboot!
If you have trouble, see if this looks right:
Code:
ls -ld /system/etc/install-recovery.sh /system/bin/sysinit /system/etc/init.d /system/xbin/run-parts
-rwxr-xr-x root root 39 2012-07-14 10:00 install-recovery.sh
-rwxr-xr-x root root 140 2012-07-14 10:01 sysinit
drwxrwxrwx root root 2012-07-14 10:10 init.d
lrwxrwxrwx root root 2012-07-14 09:55 run-parts -> /system/xbin/busybox
For the brave
The install-init.d zip file (View attachment install-init.d.zip) contains a lightly tested script that SHOULD do the install steps for you.
Send the file to your android to someplace that can execute code (e.g., /system/xbin; I had to use adb to put it on the sdcard and then move it to /systemxbin in the shell since I don't have the adb root kernel installed).
Code:
cd /system/xbin # or wherever you have it
chmod 755 install-init.d
./install-init.d
It performs rude checks to see if init.d exists, and tries to handle moving or missing busybox. It only installs 99test as a script.
Let me know if this works or doesn't work for you.
For the extra brave: There is no reason this should only work on the Samsung. This ought to work on pretty much most stock ROMs as long as they execute install-recovery.sh on start up.
Scripts
What do you put in your init.d? If you post anything cool I'll put it up here in the op.
One that gave me some real gains in I/O performance required a new version of the tune2fs executable. By default, it is part of busybox but the busybox one only has a few simple options. I've included a stand alone version and the script 10disktune here View attachment disktune.zip. Unpack the zip and put the 10disktune in /system/etc/init.d (don't forget to chmod) and put tune2fs in /system/bin (chmod that too). Note that busybox has one in /system/xbin but the script specifically calls out the one in /system/bin.
Here's one that will zipalign your apks on each boot
Code:
#!/system/bin/sh
for apk in /data/app/*.apk ; do
zipalign -c 4 $apk
ZCHECK=$?
if [ $ZCHECK -eq 1 ]; then
zipalign -f 4 $apk /cache/$(basename $apk)
if [ -e /cache/$(basename $apk) ]; then
cp -p -f /cache/$(basename $apk) $apk
rm /cache/$(basename $apk)
fi;
fi;
done;
Fin
Corrections welcome. I considered using exec or . to load some of this into one shell but given that it runs once at startup, I figured it is fine as is.
All files for reference
View attachment init.d-support.zip
View attachment install-init.d.zip
View attachment disktune.zip
Great guide, gonna try it tonight.
Sent from a GNote, hell yeah!
SirRhor said:
Great guide, gonna try it tonight.
Sent from a GNote, hell yeah!
Click to expand...
Click to collapse
I'm curious how it went. If you ran into any issues, let me know so I can update the op. Thanks!
Hmm did anyone get this to work?
wd5gnr said:
Hmm did anyone get this to work?
Click to expand...
Click to collapse
I did it on my Galaxy Nexus.
It works great, I had a bit of problem with the sysinit file, but when I downloaded your zip file and used your sysinit, it worked, so it must be a problem from my side
Thanks for this, I can finally use "Odex Me"
aavan said:
I did it on my Galaxy Nexus.
It works great, I had a bit of problem with the sysinit file, but when I downloaded your zip file and used your sysinit, it worked, so it must be a problem from my side
Thanks for this, I can finally use "Odex Me"
Click to expand...
Click to collapse
Great, just wanted to be sure I hadn't made any typos/errors in the guide.
A lot of init.d files collected here: http://forum.xda-developers.com/showthread.php?t=1227269
Also build.prop things, etc.
Thanks, I use your guide and worksperfect for my RK3066 devices. Very simple to understand all steps and what we are doing to our system, perfect for me. Thanks again dude
Melch1zedeK said:
Thanks, I use your guide and worksperfect for my RK3066 devices. Very simple to understand all steps and what we are doing to our system, perfect for me. Thanks again dude
Click to expand...
Click to collapse
Glad to help!
What is thhe utility of this?
moliverac8 said:
What is thhe utility of this?
Click to expand...
Click to collapse
Init.d is how Linux and many Android (which is kind of Linux, after all) systems manage executing commands on boot up.
The /etc/init.d files run in numerical order as root and you can do things like change system settings, manipulate the file system, etc.
See the init.d section linked below for some ideas.
http://forum.xda-developers.com/showthread.php?t=1227269
Question? what is the difference in this method and running a script?
wd5gnr said:
Init.d is how Linux and many Android (which is kind of Linux, after all) systems manage executing commands on boot up.
The /etc/init.d files run in numerical order as root and you can do things like change system settings, manipulate the file system, etc.
See the init.d section linked below for some ideas.
http://forum.xda-developers.com/showthread.php?t=1227269
Click to expand...
Click to collapse
I use the "swap memory script" and was wondering if it would also work this way with the init.d If so would there be any benefit this way over the current way of running it one way or the other? One drawback I see running the script as is is that I have to wait once the system has fully booted until the script has run and I see the Smanager screen to let me know that my memory has been remounted.
Thanks for the info and the learning process.
Here is the script and the link.
http://forum.xda-developers.com/showthread.php?t=1961097
Code:
sleep 5
mount -o remount,rw /
mount -t vfat -o umask=0000 /dev/block/vold/179:25 /mnt/sdcard
sleep 5
mount -o bind /data/media /mnt/extSdCard
As long as the device is ready to mount at boot time and doesn't get remounted, ought to work. Backup and try it
External memory wasn't ready
wd5gnr said:
As long as the device is ready to mount at boot time and doesn't get remounted, ought to work. Backup and try it
Click to expand...
Click to collapse
Thanks for the guide, but I think that the external memory was not ready to be mounted at that time. it didn't see the card till after boot. It was worth a shot, Reverted back to the script in /data and all worked again,
Note: I didn't find /system/xbin/run-parts however, I did find /system/bin/run-parts and changed the path to reflect that, I don't think this was an issue but I'm not 100% sure.

[ROOT][LB] Xperia Z (C6602) running Android 5.0.2 (10.6.A.0.454)

Hi Everyone,
Recently I have updated my XZ to lollipop 5.0.2 and after updating the Root is lost. I have been struggling to Root the latest firmware and finally I managed to get it rooted. I am posting the instructions so that it might help anyone.
I have a Locked Bootlaoder but it should also work with Unlocked Bootloader.
This has been tested on Xperia Z C6602, Lollipop 5.0.2 (FW: 10.6.A.0.454) and I will not be responsible if you try it on other device and if you do not follow the instructions carefully and accidently mess up with your phone.
Prerequisites
1. Upgrade to Lollipop 5.0.2.
2. Install drivers and configure ADB on your PC.
3. Enable USB debugging on your phone and Allow installation of apps from unknown sources under security settings.
Read the instructions carefully before proceeding.
Steps:-
1. Go to my google drive link and download the data.zip file. https://drive.google.com/file/d/0B1LQ910-5UYpNk5udEF4Qnd6T2M/view
2. Extract the contents into your working ADB directory (where adb.exe is located).
3. Connect your phone to PC via USB cable.
3. Copy KingRoot-4.1.0.249.apk file to your phone. Install the apk and run it. Make sure you are connected to internet as the KingRoot tool uses internet connection to download suitable exploit for your device on the go. After you run it, click Try Root option and let it complete till 100%. It will confirm that Rooting is successful. Now your phone is rooted.
If you do not like KingRoot and KingUser (for any reason) and want to switch to SuperSU then follow these steps:
1. Make sure you have extracted all the apps from data.zip into ADB directory. Browse to your ADB directory, press & hold Shift Key on Keyboard then right click on empty space to open context menu and select Open command window here. In command windows, type “adb devices” without quotes. You should be able to see your device listed. Then type the following commands carefully in same order (copy paste is better way to prevent any typo )
adb push su /data/local/tmp
adb push busybox /data/local/tmp
adb shell
2. You will be taken to a shell prompt with $ sign. In the shell type the following commands and keep your eye on your phone, when prompted, give the access permission:
su
mount -o remount,rw /system
cat /data/local/tmp/su >/system/xbin/daemonsu && chmod 0755 /system/xbin/daemonsu
cat /data/local/tmp/busybox >/system/xbin/busybox && chmod 0755 /system/xbin/busybox
daemonsu -d &
Leave the command Window running and do not disconnect your phone while you continue with the rest of steps.
3. Open the KingUser app in your phone, open settings (at the top right corner) and click Root authorization setting and then Remove Root permission. The app will be uninstalled automatically.
4. Uninstall the other two remaining KingRoot apps from your phone (KingRoot and the other one with Chinese language and the blue icon).
5. Go back to the Command window running adb, and type the following commands:
cat /data/local/tmp/su > /system/xbin/su && chmod 0755 /system/xbin/su
busybox chattr -ia /system/xbin/ku.sud
busybox chattr -ia /system/xbin/supolicy
busybox chattr -ia /system/xbin/pidof
rm /system/xbin/ku.sud
rm /system/xbin/supolicy
rm /system/xbin/pidof
rm /system/bin/debuggerd
rm /system/bin/debuggerd_real
rm /system/bin/debuggerd64
busybox chattr -ia /system/bin/install-recovery.sh
busybox chattr -ia /system/bin/rt.sh
rm /system/bin/install-recovery.sh
rm /system/bin/rt.sh
busybox chattr -ia /system/bin/.usr/.ku
rm -rf /system/bin/.usr
rm /system/usr/icu/icusuflag.conf
busybox chattr -ia /system/usr/iku/isu
rm -rf /system/usr/iku
rm /system/kroot_*
rm /sdcard/kr-stock-conf
rm -rf /sdcard/Kingroot
Again leave this command window running and do not disconnect your phone.
6. Copy Superuser.apk file (from extracted data.zip folder) into phone’s sdcard.
7. Go to your phone and Install Superuser.apk, Run it and let it update the SU binary.
8. Reboot your phone and enjoy the ROOT access on your latest Android 5.0.2 Lollipop.
I have used King's Root to root my phone. My issue is random reboot whenever an app tires to get root access. And titanium backup is not able to backup (it keeps on saying insufficient storage on 20GB free storage area) or delete any app. Plus, I also get random reboot whenever an app having root access is updated over Play Store. And from random reboot it reboots some times and sometimes it doesn't reboot.
So, if anyone having same issue kindly ping back.
(I will post update after reflashing the ftf)
Replace KingUser app with SuperSU
DrXperience said:
I have used King's Root to root my phone. My issue is random reboot whenever an app tires to get root access. And titanium backup is not able to backup (it keeps on saying insufficient storage on 20GB free storage area) or delete any app. Plus, I also get random reboot whenever an app having root access is updated over Play Store. And from random reboot it reboots some times and sometimes it doesn't reboot.
So, if anyone having same issue kindly ping back.
(I will post update after reflashing the ftf)
Click to expand...
Click to collapse
To deal with random reboot issue, I would suggest you to replace KingUser app with SuperSU as described above.
For TitaniumBackup issue, try this:
Open TitaniumBackup, Go to MENU -- Preferences -- Backup folder location.
You will see Storage provider: (Click to change) and you will see multiple option of storage providers. Select second option DocumentProvider Storage and then click on SD Card option and at the bottom of screen you will see select "SD Card". Click on this option. It is important that you do not select any folder inside SD Card, you only have to select the SD Card option. Now select <<Create a new folder>> and then select USE THE CURRENT FOLDER.
To make it more clear, I have attached the snapshots, please go through snapshots one by one and you will be able to fix insufficient free storage error in TB.
SurenderK said:
To deal with random reboot issue, I would suggest you to replace KingUser app with SuperSU as described above.
For TitaniumBackup issue, try this:
Open TitaniumBackup, Go to MENU -- Preferences -- Backup folder location.
You will see Storage provider: (Click to change) and you will see multiple option of storage providers. Select second option DocumentProvider Storage and then click on SD Card option and at the bottom of screen you will see select "SD Card". Click on this option. It is important that you do not select any folder inside SD Card, you only have to select the SD Card option. Now select <<Create a new folder>> and then select USE THE CURRENT FOLDER.
To make it more clear, I have attached the snapshots, please go through snapshots one by one and you will be able to fix insufficient free storage error in TB.
Click to expand...
Click to collapse
Okay I will give it a shot :highfive:
And you have not provided download link. Provide that in your first post.
Download link sent
DrXperience said:
And you have not provided download link. Provide that in your first post.
Click to expand...
Click to collapse
Hey DrXperience,
Check your PM, I have sent the download link through PM....
Try both links, one should be working
can i have download link plz?
SmunksRiley said:
can i have download link plz?
Click to expand...
Click to collapse
Hey SmunksRiley,
Please check your PM. I have sent the link.
Sent from my C6602 using xda Forums PRO
hi sir
sir can i have a link to i need to replace kings app to avoid random reboot
bagsey said:
sir can i have a link to i need to replace kings app to avoid random reboot
Click to expand...
Click to collapse
Hey, please check your PM. I have sent the download link
Sent from my C6602 using xda Forums PRO
SurenderK said:
Hi Everyone,
Recently I have updated my XZ to lollipop 5.0.2 and after updating the Root is lost. I have been struggling to Root the latest firmware and finally I managed to get it rooted. I am posting the instructions so that it might help anyone.
I have a Locked Bootlaoder but it should also work with Unlocked Bootloader.
This has been tested on Xperia Z C6602, Lollipop 5.0.2 (FW: 10.6.A.0.454) and I will not be responsible if you try it on other device and if you do not follow the instructions carefully and accidently mess up with your phone.
Prerequisites
1. Upgrade to Lollipop 5.0.2.
2. Install drivers and configure ADB on your PC.
3. Enable USB debugging on your phone and Allow installation of apps from unknown sources under security settings.
Read the instructions carefully before proceeding.
Steps:-
1. Go to my google drive link and download the data.zip file. https://drive.google.com/file/d/0B1LQ910-5UYpNk5udEF4Qnd6T2M/view
2. Extract the contents into your working ADB directory (where adb.exe is located).
3. Connect your phone to PC via USB cable.
3. Copy KingRoot-4.1.0.249.apk file to your phone. Install the apk and run it. Make sure you are connected to internet as the KingRoot tool uses internet connection to download suitable exploit for your device on the go. After you run it, click Try Root option and let it complete till 100%. It will confirm that Rooting is successful. Now your phone is rooted.
If you do not like KingRoot and KingUser (for any reason) and want to switch to SuperSU then follow these steps:
1. Make sure you have extracted all the apps from data.zip into ADB directory. Browse to your ADB directory, press & hold Shift Key on Keyboard then right click on empty space to open context menu and select Open command window here. In command windows, type “adb devices” without quotes. You should be able to see your device listed. Then type the following commands carefully in same order (copy paste is better way to prevent any typo )
adb push su /data/local/tmp
adb push busybox /data/local/tmp
adb shell
2. You will be taken to a shell prompt with $ sign. In the shell type the following commands and keep your eye on your phone, when prompted, give the access permission:
su
mount -o remount,rw /system
cat /data/local/tmp/su >/system/xbin/daemonsu && chmod 0755 /system/xbin/daemonsu
cat /data/local/tmp/busybox >/system/xbin/busybox && chmod 0755 /system/xbin/busybox
daemonsu -d &
Leave the command Window running and do not disconnect your phone while you continue with the rest of steps.
3. Open the KingUser app in your phone, open settings (at the top right corner) and click Root authorization setting and then Remove Root permission. The app will be uninstalled automatically.
4. Uninstall the other two remaining KingRoot apps from your phone (KingRoot and the other one with Chinese language and the blue icon).
5. Go back to the Command window running adb, and type the following commands:
cat /data/local/tmp/su > /system/xbin/su && chmod 0755 /system/xbin/su
busybox chattr -ia /system/xbin/ku.sud
busybox chattr -ia /system/xbin/supolicy
busybox chattr -ia /system/xbin/pidof
rm /system/xbin/ku.sud
rm /system/xbin/supolicy
rm /system/xbin/pidof
rm /system/bin/debuggerd
rm /system/bin/debuggerd_real
rm /system/bin/debuggerd64
busybox chattr -ia /system/bin/install-recovery.sh
busybox chattr -ia /system/bin/rt.sh
rm /system/bin/install-recovery.sh
rm /system/bin/rt.sh
busybox chattr -ia /system/bin/.usr/.ku
rm -rf /system/bin/.usr
rm /system/usr/icu/icusuflag.conf
busybox chattr -ia /system/usr/iku/isu
rm -rf /system/usr/iku
rm /system/kroot_*
rm /sdcard/kr-stock-conf
rm -rf /sdcard/Kingroot
Again leave this command window running and do not disconnect your phone.
6. Copy Superuser.apk file (from extracted data.zip folder) into phone’s sdcard.
7. Go to your phone and Install Superuser.apk, Run it and let it update the SU binary.
8. Reboot your phone and enjoy the ROOT access on your latest Android 5.0.2 Lollipop.
Click to expand...
Click to collapse
The following lines in script gives error
busybox chattr -ia /system/xbin/ku.sud
chattr: stat /system/xbin/ku.sud: No such file or directory
busybox chattr -ia /system/bin/.usr/.ku
chattr: stat /system/bin/.usr/.ku: No such file or directory
busybox chattr -ia /system/usr/iku/isu
chattr: stat /system/bin/usr/iku/isu: No such file or directory
DrXperience said:
The following lines in script gives error
busybox chattr -ia /system/xbin/ku.sud
chattr: stat /system/xbin/ku.sud: No such file or directory
busybox chattr -ia /system/bin/.usr/.ku
chattr: stat /system/bin/.usr/.ku: No such file or directory
busybox chattr -ia /system/usr/iku/isu
chattr: stat /system/bin/usr/iku/isu: No such file or directory
Click to expand...
Click to collapse
Hi,
Ignore the error if it says No such file or directory. Proceed to next commands and once completed reboot your device. You will get SuperSU working and KingUser replaced.
Sent from my C6602 using xda Forums PRO
SurenderK said:
Hi Everyone,
Recently I have updated my XZ to lollipop 5.0.2 and after updating the Root is lost. I have been struggling to Root the latest firmware and finally I managed to get it rooted. I am posting the instructions so that it might help anyone.
I have a Locked Bootlaoder but it should also work with Unlocked Bootloader.
This has been tested on Xperia Z C6602, Lollipop 5.0.2 (FW: 10.6.A.0.454) and I will not be responsible if you try it on other device and if you do not follow the instructions carefully and accidently mess up with your phone.
Prerequisites
1. Upgrade to Lollipop 5.0.2.
2. Install drivers and configure ADB on your PC.
3. Enable USB debugging on your phone and Allow installation of apps from unknown sources under security settings.
Read the instructions carefully before proceeding.
Steps:-
1. Go to my google drive link and download the data.zip file. https://drive.google.com/file/d/0B1LQ910-5UYpNk5udEF4Qnd6T2M/view
2. Extract the contents into your working ADB directory (where adb.exe is located).
3. Connect your phone to PC via USB cable.
3. Copy KingRoot-4.1.0.249.apk file to your phone. Install the apk and run it. Make sure you are connected to internet as the KingRoot tool uses internet connection to download suitable exploit for your device on the go. After you run it, click Try Root option and let it complete till 100%. It will confirm that Rooting is successful. Now your phone is rooted.
If you do not like KingRoot and KingUser (for any reason) and want to switch to SuperSU then follow these steps:
1. Make sure you have extracted all the apps from data.zip into ADB directory. Browse to your ADB directory, press & hold Shift Key on Keyboard then right click on empty space to open context menu and select Open command window here. In command windows, type “adb devices” without quotes. You should be able to see your device listed. Then type the following commands carefully in same order (copy paste is better way to prevent any typo )
adb push su /data/local/tmp
adb push busybox /data/local/tmp
adb shell
2. You will be taken to a shell prompt with $ sign. In the shell type the following commands and keep your eye on your phone, when prompted, give the access permission:
su
mount -o remount,rw /system
cat /data/local/tmp/su >/system/xbin/daemonsu && chmod 0755 /system/xbin/daemonsu
cat /data/local/tmp/busybox >/system/xbin/busybox && chmod 0755 /system/xbin/busybox
daemonsu -d &
Leave the command Window running and do not disconnect your phone while you continue with the rest of steps.
3. Open the KingUser app in your phone, open settings (at the top right corner) and click Root authorization setting and then Remove Root permission. The app will be uninstalled automatically.
4. Uninstall the other two remaining KingRoot apps from your phone (KingRoot and the other one with Chinese language and the blue icon).
5. Go back to the Command window running adb, and type the following commands:
cat /data/local/tmp/su > /system/xbin/su && chmod 0755 /system/xbin/su
busybox chattr -ia /system/xbin/ku.sud
busybox chattr -ia /system/xbin/supolicy
busybox chattr -ia /system/xbin/pidof
rm /system/xbin/ku.sud
rm /system/xbin/supolicy
rm /system/xbin/pidof
rm /system/bin/debuggerd
rm /system/bin/debuggerd_real
rm /system/bin/debuggerd64
busybox chattr -ia /system/bin/install-recovery.sh
busybox chattr -ia /system/bin/rt.sh
rm /system/bin/install-recovery.sh
rm /system/bin/rt.sh
busybox chattr -ia /system/bin/.usr/.ku
rm -rf /system/bin/.usr
rm /system/usr/icu/icusuflag.conf
busybox chattr -ia /system/usr/iku/isu
rm -rf /system/usr/iku
rm /system/kroot_*
rm /sdcard/kr-stock-conf
rm -rf /sdcard/Kingroot
Again leave this command window running and do not disconnect your phone.
6. Copy Superuser.apk file (from extracted data.zip folder) into phone’s sdcard.
7. Go to your phone and Install Superuser.apk, Run it and let it update the SU binary.
8. Reboot your phone and enjoy the ROOT access on your latest Android 5.0.2 Lollipop.
Click to expand...
Click to collapse
Sadly my phone reboots as soon as I get to the point where I mount /system ("mount -o remount,rw /system" ). Probably caused by RIC, any suggestions on how to avoid this?
cruzersteve said:
Sadly my phone reboots as soon as I get to the point where I mount /system ("mount -o remount,rw /system" ). Probably caused by RIC, any suggestions on how to avoid this?
Click to expand...
Click to collapse
Hi,
Please check this xda thread. Might help you out.
http://forum.xda-developers.com/xpe...b-definitive-root-remount-reboot-fix-t2317432
Sent from my C6602 using xda Forums PRO
Anyone tryed on c6603?
hey surrenderk, i did the mistake of following this tutorial and literally copy pasted everything despite not having a sony, but an infinix hot note, just because i wanted to remove kinguser and kingroot and have superuser as the dedfault application for handling root access. any way to reverse everything we just did, coz i cant update via ota?? shell commands to undo everything perhaps that affected the "system" folder or that affected normal working of device??thanks!!
Jokichu said:
hey surrenderk, i did the mistake of following this tutorial and literally copy pasted everything despite not having a sony, but an infinix hot note, just because i wanted to remove kinguser and kingroot and have superuser as the dedfault application for handling root access. any way to reverse everything we just did, coz i cant update via ota?? shell commands to undo everything perhaps that affected the "system" folder or that affected normal working of device??thanks!!
Click to expand...
Click to collapse
Which device and software are you using??
Are you observing any strange behaviour in your device after making changes?
Sent from my C6602 using xda Forums PRO
Hey surrenderk yep, the problem is that somehow, I can't see any Ota update. It's says it's up to date, while I know there's an upgrade. In the steps we did, did we in any way change anything related to that??
I was already rooted, and had kinguser, and used kingroot. Whenever an Ota update came I could just unroot, perform the update then root again, easy.
However since I followed your tutorial steps with the adb shell, I received an Ota update, and did the unroot as usual, but the system found several files failing the root integrity tests, thus failing to update. My questions are
1.all these rm commands we used, did we remove/delete any core essential android file from the system folder? Bin folder? (debuggered /real/64) kroot_*, iku, kr-stock-conf, icusuflag.conf,
2.what do the rt.sh and install-recovery.sh scripts do?
My phone had become unstable, and could not play videos well nor audio files, it kept stuttering like it's buffering from an online Stream. Anyways, I am now unrooted and did a factory reset which fixed the video/audio glitch but still cannot "see" any new update although it's there. I just want want that update.
Sent from my Infinix-X551 using XDA Free mobile app
Question:
Why is the link not available in the OP?
Why is the link only shared thru PM?
Isn't this XDA - a sharing community?
This thread is just a little too weird.

Categories

Resources