[REQ] /system/bin/sh clockwork recovery - Fascinate Android Development

I just did a major mistake by copying sh from Windows to /system/bin/sh. Not haivng the execute bit has stopped me from using adb shell.
Could someone provide a clockworkmod recovery file that restores sh & it's permissions? I would greatly appreciate it. Thanks!

Why not just run the fix permissions script from the advanced menu in clockworkmod?
Sent from my SCH-I500 using XDA App

well, would be easier from a linux box:
chmod 755 sh
adb push sh /system/bin/sh
adb reboot

i_am_enderst said:
well, would be easier from a linux box:
chmod 755 sh
adb push sh /system/bin/sh
adb reboot
Click to expand...
Click to collapse
Thanks. I fixed it through recovery mode shell via adb.
I'm getting the following garbage when I do ls within adb shell. Is there any way to fix this?
Code:
# ls
ls
←[1;34mcache←[0m ←[1;32minit.rc←[0m ←[1;34msbin←[0m
←[1;34mconfig←[0m ←[1;32minit.smdkc110.rc←[0m ←[1;34msdcard←[0m
←[1;34mdata←[0m ←[1;32minit.smdkc110.sh←[0m ←[1;34msqlite_stmt_journals←[0m
←[1;34mdbdata←[0m ←[1;34mlib←[0m ←[1;34msys←[0m
←[1;32mdefault.prop←[0m ←[1;32mlpm.rc←[0m ←[1;34msystem←[0m
←[1;34mdev←[0m ←[1;34mmnt←[0m ←[1;32msystem.prop←[0m
←[1;34mefs←[0m ←[1;34mpreinstall←[0m ←[1;34mtmp←[0m
←[1;36metc←[0m ←[1;34mproc←[0m ←[1;34muserdata←[0m
←[1;32mfota.rc←[0m ←[1;32mrecovery.rc←[0m
←[1;36minit←[0m ←[1;34mres←[0m

Those are bash color escape codes but I don't know why adb is outputting them since I'm new to Android.

It's a windows command prompt thing..
Easiest solution, do this from your adb shell (you'll need to do it each time)
export LS_COLORS=none
alternatively you can installed cygwin and spend a little time setting it up so that the ANSI colors are displayed when using adb shell.
I assume the colors show up fine under linux, which is why this got included in some kernels/rom packages without anyone addressing it.

Thanks for the info. It shows up correctly through a cygwin terminal. I'll just use that for now on.

Related

Rooted

All credit goes to the orig guy who made the d2 exploit
If you feel the need to donate money then he deserves it [email protected]
I made an easier to follow tutorial over here with pics. Sorry but I am tired of going back and forth so just go there if you are having problems. If you can follow simple adb commands just follow the directions below
Download and Install Samsung Drivers
64bit:
http://www.wikifilez.com/root files/epic4g/usb_drivers_GalaxyS_x64.zip
32bit:
http://www.wikifilez.com/root files/epic4g/SAMSUNG_USB_Driver_for_Mobile_Phones_x86.exe
1 Click Root Method
http://forum.androidcentral.com/fascinate-roms-hacks/33899-how-root.html
Manual Method
cd C:\android-sdk\tools
adb push C:\fascinate\su /sdcard/su
adb push C:\fascinate\rage.bin /data/local/tmp/rage.bin
adb push C:\fascinate\busybox /sdcard/busybox
adb shell
cd /data/local/tmp
chmod 0755 rage.bin
./rage.bin
wait....
when it brings you back to your original shell in windows then follow these commands
adb shell (you should see # this time instead of $ this is exactly what we want)
mount -t rfs -o remount,rw /dev/block/stl9 /system
cd /system/xbin
cat /sdcard/su > su
cat /sdcard/busybox > busybox
chmod 4755 su
chmod 4755 busybox
exit
adb install C:\fascinate\Superuser.apk
This is permanent.
I just updated the files here with the latest su / superuser.apk / busybox
Also check out my tutorial to fix the memory/lag issues for this phone
http://forum.xda-developers.com/showthread.php?p=8086738#post8086738
Dirrk said:
All credit goes to the orig guy who made the d2 exploit
I feel naked without my droid lol this phone is so light
adb push su /sdcard/su
adb push rage.bin /data/local/tmp/rage.bin
adb push busybox /sdcard/busybox
adb shell
cd /data/local/tmp
chmod 0755 rage.bin
./rage.bin
wait....
when it brings you back to your original shell or windows cmd promt
adb shell
mount -t rfs -o remount,rw /dev/block/stl9 /system
cd /system/xbin
cat /sdcard/su > .
cat /scard/busybox > .
chmod 4755 su
chmod 4755 busybox
exit
adb install Superuser.apk
Please let me know if I posted something wrong.
Click to expand...
Click to collapse
does it stick after reboot?
Its supposed to be a temporary root so i doubt it will.
This works on any android phone up to 2.2. I have confirmed this works on my epic, so th same sould work here.
Sent from my SPH-D700 using XDA App
see below.
confirmed root.
Had to use Superuser.apk 2.3.6.1 and the su binary in the package, but the rest worked.. except for that cat command? Why would you cat binary files instead of copying them? (not complaining, just curious). I just adb pushed them to /system/xbin, and adb shell chmod'd them.
You also have a typo near the end "scard" instead of "sdcard".
You can also use mv or cp. I just happen to use cat because I used it the other day rooting my friends stock 2.2 droid. Which required me to use cat.
And yes this is permanent
Cool, i tried using rm -rf to get rid of a directory I created accidentally, and was getting some syntax errors, so I wasn't sure how compatibile the command line on android was to linux.
Glad it's pretty close. Being very familiar with linux makes this pretty easy to understand. Day 1 with an android device was pretty darn fun. I think I'm glad I went this direction.
I just followed this and used the same files I had from my Droid 2 (just updated the Superuser.apk from this sites thread for it) and works perfectly. Rebooted phone did "adb shell" and "su" and still have root, so it is permanent
side note: steps say "/system/xbin" and assume you meant "/system/bin" like Droid 2 was. That's where I put them and it worked.
cliffr39 said:
I just followed this and used the same files I had from my Droid 2 (just updated the Superuser.apk from this sites thread for it) and works perfectly. Rebooted phone did "adb shell" and "su" and still have root, so it is permanent
side note: steps say "/system/xbin" and assume you meant "/system/bin" like Droid 2 was. That's where I put them and it worked.
Click to expand...
Click to collapse
It works either way, both are executable system folders. Glad you it worked for you, hopefully we can get some roms cooking soon and play catch up to the other galaxy s phones
doesnt work for me, i get an error device not found
ive type adb devices - device not found. usb debugging on, usb conneced on port 5037
xirnibor said:
doesnt work for me, i get an error device not found
ive type adb devices - device not found. usb debugging on, usb conneced on port 5037
Click to expand...
Click to collapse
Your USB mode might be set wrong. Flip it to whatever it's not at, and try again.
i forgot this laptop didnt have the updated usb drivers from android sdk, downloading then will try again. i have tried so far with the sdcard mounted and unmounted, while in usb debugging mode. will post after updates
How long do you actually have to wait after the execting the rage.bin file?
itznfb said:
How long do you actually have to wait after the execting the rage.bin file?
Click to expand...
Click to collapse
I dunno, ~20-30 seconds? Assuming sound is enabled you should hear the same USB device connected/disconnected sounds.
If you want to be 100% sure just wait like 90 seconds. I'm pretty sure it killed my shell though, so if it does that, you're good to go.
ok, adb recognizes the device *see below, however when i type adb push su /sdcard/su i get cannot stat 'su': no such file or directory. ?
C:\downloads\android\android\tools>adb devices
List of devices attached
I500a2d0087a device
namebrandon said:
I dunno, ~20-30 seconds? Assuming sound is enabled you should hear the same USB device connected/disconnected sounds.
If you want to be 100% sure just wait like 90 seconds. I'm pretty sure it killed my shell though, so if it does that, you're good to go.
Click to expand...
Click to collapse
ok... running the rage.bin locked up my device twice but on the third try it worked. another fascinate rooted
xirnibor said:
ok, adb recognizes the device *see below, however when i type adb push su /sdcard/su i get cannot stat 'su': no such file or directory. ?
C:\downloads\android\android\tools>adb devices
List of devices attached
I500a2d0087a device
Click to expand...
Click to collapse
su is a file (for our purposes right here, anyway). Unless you explicity specify its path, it needs to be in the same directory you're running the adb command from.
If you installed the Android SDK per guidelines, adb should be in your PATH environment variable, and you should be able to execute it from any directory. If you didn't do that, then for the sake of simplicity, copy all the files referenced in the original steps to your working directory. From your post above, it appears that is c:\downloads\android\android\tools\
I got stuck at cat /sdcard/su > . Is that supposed to be > .? It won't let me enter that...There's not something else that's supposed to be there?
EDIT: I get the same error faspalma
I'm stuck at that point too. cat /sdcard/su > . returns "cannot create .: is a directory"

adb mount remount problem

hello x10 buddys
srry for my noob question, but i have a problem...
when i go to run - cmd
adb shell
$ su
#
mount -o remount,rw -t yaffs2 /dev/block/mtdblock2 /system
i am able to do this.
No i wanna install a theme with the file ****.cmd
I start the cmd file and i will get this error
mount -o remount,rw -t yaffs2 /dev/block/mtdblock2 /system
mount: Operation not permitted
Why i get this error?
i am not adb shell # at this moment?
You'll only be able to remount while you've root permissions...
If you do SU before doing the .cmd then you should be fine...
(You might also have problems with file permissions, in which case you'll need to run chmod 755 on some directory after remounting. If you've this problem, let us know. Maybe post the .cmd?)
Sent from my X10i using XDA App
i thougt that was the problem ty
but how i get SU before run the cmd file?
when i do adb shell in the directory of the theme
after that i cant run the cmd files or i did something wrong.
Spend the hole night on it ^^
the cmd file will be alright, its from the New theme here
Have u tried
Adb shell su
Then allow it with superuser?
I'm not sure if it will work as I haven't tested it...
Hope it helps
in my Su on the phone
Unkonwn
/system/bin/sh als root (uid: 0)
i wanna run ***.cmd when i am in cmd with su#
wen i start the **cmd i wil not have su#
i need to do....
adb shell
$ su
#
and then put a command to run ***.cmd file of the theme
when the **.cmd file in c:\desktop\newfolder\***.cmd
which command i need to write when i in adb shell # to run the cmd file??
If I don't remember wrong, I had to do this chmod 4755 /system/bin/su to get the "#" prompt (su) as default in Better Terminal.
Perhaps it will help you too ? (allowing the scripts to run as superuser)
Have you tried doing everything with adb shell? Ie
Adb shell su
Hit enter
Adb shell mount blah blah blah
Hit enter
Adb shell run the cmd
I read somewhere u should only chmod as a last resort and if u know what you're doing. For the most part i have no idea what's going on (i feel like Gary busey) so i haven't tried the chmod.
I would have posted the actual script but its a pita to do from my phone
he said run:not found ^^
How about at the beginning before adb shell su move to the directory its in.
Eg.
cd C:\the directory the cmd is saved
hphhaze said:
he said run:not found ^^
Click to expand...
Click to collapse
Adb shell run the cmd does NOT mean you should type in Adb shell run <some command>.
It means you should type in Adb shell <some command> where <some command> can be for example su, cp, dd or something else (unix commands).
tread can closed. I dont get it...
You're giving up that quick? :-(
Come on!!!!
Solution A:
1. Go here and download X10Root1.0.8.apk.
2. Install the apk to your phone.
3. Run the app and use it to "unsecure sh".
4. Run your CMD script.
5. Run the app again to "secure sh".
6. If you skipped #5 (secure), go back and do #5.
Solution B (alternative):
1. Download the Standalone Toggle Secure Shell script.
2. Extract and run it (it's a CMD script).
3. Select "Unsecure" and follow the directions (requires some typing or copy/pasting).
4. Run your CMD script.
5. Run the toggle script again to select "Secure".
6. Don't skip #5 (secure).

[Q] Root for Sharp Aquos SH-06D

Hi guys
I've imported the SH-06D from Japan and the phone is running great, however I'd like to remove some system apps etc to help speed up the phone (it's still on 2.3.5) and obviously tweak it as well.
I know there is an existing thread on the SH-01D (predecessor to the SH-06D) but I'm wondering if anyone has successfully rooted the SH-06D and if so, is there an (easy) process to do this?
Another reason I want to root, is to install the UI from the upcoming Evangelion Nerv edition of the SH-06D that is due to be released in a few days.
ICS for the SH-06D is just around the corner (due to be released in July) but I'd realy appreciate any help, assistance or tips in rooting the phone as it is now.
Cheers! :fingers-crossed:
Anyone?
:-(
here is a link to root the sh-06d :
http://itsuki.ddo.jp/gadget/index.php?SH-06D
THANK YOU!
Have you tried this method and does it work? Can you assist me in following those directions?
Cheers
interfreak said:
THANK YOU!
Have you tried this method and does it work? Can you assist me in following those directions?
Cheers
Click to expand...
Click to collapse
i haven't tried since i don't have this phone.
i can try to help you if you want.
testnumero said:
i haven't tried since i don't have this phone.
i can try to help you if you want.
Click to expand...
Click to collapse
Thanks mate!
I'm fumbling through the process now - it's a little hard when you are using google translate lol!
OK, I've run through all the steps but..
When I get to the end of the process:
C:\Users\interfreak\Desktop
$ su
su
su: permission denied
:-(
interfreak said:
OK, I've run through all the steps but..
When I get to the end of the process:
C:\Users\interfreak\Desktop
$ su
su
su: permission denied
:-(
Click to expand...
Click to collapse
i don't know what is the problem, try to do steps again.
Tried, same result. :-(
interfreak said:
Tried, same result. :-(
Click to expand...
Click to collapse
i'll ask to translate it
Thanks mate!!! :highfive:
I want to know untill now has SH-06D been rooted?
I wish someone could dump ROM or launcher from SH-06 NERV version:fingers-crossed:
I'm working on the translation for root on Sharp Aquos SH-06D.
Please give me one or two more days!
That is highly impossible, having full root in J Phone are hard enough. Unlocking the bootloader is a wet dream for almost everyone who likes J phone
lightout said:
I want to know untill now has SH-06D been rooted?
I wish someone could dump ROM or launcher from SH-06 NERV version:fingers-crossed:
Click to expand...
Click to collapse
I'm trying to hard reset my SH-06D, but I can't do it via settings-privacy. I can select to wipe, but nothing happens.
Any suggestions?
I got the Nerv edition
Hey man, how did the rooting go? I ordered the Nerv edition of this phone, and I want to root it (mainly to pair my sixaxis controller for psx emulation) but wanted to consult with you first as a precaution.
Here is the a rough translation of the root guide found here:
http://itsuki.ddo.jp/gadget/index.php?SH-06D
Big thanks to testnumero for the help!
Please don't ask me directly for help. I don't own this phone.
A quick look at root
• With root you can freeze preinstalled bloatware and backup application settings and game save data.
• 3D content from /system can be played on other devices and 3DTVs.
Unresponsive apps can be frozen which will help the device run smoother and have a longer battery life.
Applications which are frozen disappear from your drawer making the device look cleaner and keeping your mind at ease.
• The process is similar to the one used for SH-01D.
• If an update patch is released or the Android 4.0 summer update is released then this guide will no longer be of help.
(Make sure your device is the following: Android Ver. 2.3.5 Build No. 01.00.03)
• If your device becomes a paperweight I won’t be held responsible.
• Follow this guide at your own risk.
↑
Preparations – Before you begin
• Install Android SDK and SHARP ADB USB drivers and make to use ADB.
• 「Settings」→「Applications」→「Development」→「USB Debugging」 checked.
• SH-06D and micro USB cable to connect to your PC
↑
Required Files
• Download "shdisphook" from the following link and extract.
http://goo.gl/Bs6Iq
• Download shsdgetroot-omap4.zip from the following link and extract.
http://www1.axfc.net/uploader/File/so/78144
• Download shbootgetroot-su.lzh from the following link and extract.
http://www.mediafire.com/?6i0n32jlwbxe8cp
• Keep all extracted files in the same folder.
↑
Creating files
• Create a file named "shdisphook.bat" in the folder with the extracted files.
Copy and paste the following and save.
adb push onload.sh /data/local/
adb push libsdservice_jni.so /data/local/
adb push shdisphook /data/local/
adb shell chmod 755 /data/local/onload.sh
adb shell chmod 755 /data/local/shdisphook
adb reboot
adb wait-for-device shell /data/local/shdisphook
pause
• Create a file named "oncmd.sh" and put the following in the description.
(Save the line break as LF)
chmod 777 /cache
chmod 666 /cache/recovery
• Replace the contents of the file "installfile.cmd" with the following and save.
adb shell /data/local/shsdgetroot-omap4 -c "/system/bin/mount -o rw,remount -t rootfs rootfs /"
adb shell /data/local/shsdgetroot-omap4 -c "/system/bin/chmod 777 /sbin"
adb push su /sbin
adb push busybox /sbin
adb shell /data/local/shsdgetroot-omap4 -c "/system/bin/chown 0.0 /sbin/su"
adb shell /data/local/shsdgetroot-omap4 -c "/system/bin/chown 0.0 /sbin/busybox"
adb shell /data/local/shsdgetroot-omap4 -c "/system/bin/chmod 6755 /sbin/su"
adb shell /data/local/shsdgetroot-omap4 -c "/system/bin/chmod 755 /sbin/busybox"
adb shell /data/local/shsdgetroot-omap4 -c "/sbin/busybox --install -s /sbin"
adb shell /data/local/shsdgetroot-omap4 -c "/system/bin/chmod 755 /sbin"
adb shell /data/local/shsdgetroot-omap4 -c "/system/bin/mount -o ro,remount -t rootfs rootfs /"
adb push Superuser.apk /data/local/
adb shell /system/bin/pm install -t -f -r /data/local/Superuser.apk
adb shell /system/bin/rm /data/local/Superuser.apk
exit /b
↑
Step 1
• Open command prompt to the folder with the extracted files and navigate to "shdisphook".
Execute "shdisphook.bat". (You can also just double click on the .bat file)
• The device will reboot so just wait for the [Press any key to continue] message to appear.
If more than a few minutes have passed and nothing has appeared then, force close and execute "shdisphook.bat" again.
(When you fail your PC will reboot or your SH-06D WiFi will start. There is a high rate of success when you immediately unlock the lock screen for your device when it goes to sleep.)
↑
Step 2
• Open command prompt and send oncmd.sh to SH-06D to change permissions
adb push oncmd.sh /data/local/oncmd.sh
adb shell chmod 755 /data/local/oncmd.sh
• 「Settings」→「microSD and device storage」→「Unmount microSD」 This will execute the file "oncmd.sh" , which was sent to the device earlier.
(Cancel the message for 「Unmount microSD」)
• Enter the following commands.
adb shell mv /cache/recovery /cache/recovery_
adb shell ln -s /dev/shsd /cache/recovery
• Execute the following adb shell ls -l /cache and if you see the following message you have succeed.
drwxrwx--- root  root 2011-11-11 03:39 lost+found
drw-rw-rw- system cache 2012-01-24 10:48 recovery_
lrwxrwxrwx shell  shell 2012-03-02 13:24 recovery -> /dev/shsd
• Next execute adb shell ls -l /dev/shsd you should get the following message if you were successful.
crw-rw-rw- system cache 231, 0 2012-04-23 02:01 shsd
↑
Step 3
• Execute adb push shsdgetroot-omap4 /data/local
• Execute adb shell /system/bin/chmod 755 /data/local/shsdgetroot-omap4
• Execute adb shell /data/local/shsdgetroot-omap4 -v -m -u
• The “# “mark will appear there will be no response. Close command prompt for now.
• Execute installfile.cmd
• Check if you have root with the following adb shell→su
↑
After you reboot
• After you reboot you will lose root rights so execute shdisphook.bat→Cancel Unmount microSD →execute installfile.cmd and you should have root again.
The reason why you cannot do a clean wipe or nothing happen is because the recovery section has been move out into another location, causing it to not loading the recovery correctly.
Check with SH-01d part, I have asked similar question there and I revert the recovery in order to wipe the phone..
You need to rearrange the following section like on the sh-01d when you hit this part:
(Following is Original command that you relocated the recovery for root)
adb shell mv /cache/recovery /cache/recovery_
adb shell ln -s /dev/shsd /cache/recovery
And replace with the revert command found on sh-01d thread. You will need to redo all the steps from step 1 to step 2 and STOP AFTER YOU REVERT the RECOVERY.
You should be able to do a full wipe with no issue then. DO NOT POWER DOWN or RESET!!! You will have to REDO it again as it REQUIRES SHDSIHOOK to input shell command.
Hope it helps
waiting!!!!!!!!!!

[Q] adb shell prompt

Hey everyone I got a very technical question
I am trying to set a custom prompt for the shell on an android device running bourne shell (sh), I have suceeded in setting it for a login shell (sh -l) but I would like to make this default for non login like adb or ssh through connectbot @localhost. Normally on linux I could do this by editing /etc/profile but for some reason on my android sh does not read /etc/profile unless it is a login shell. I tried moving the sh binary and replacing the sh binary in /system/bin with a shell script that executes sh -l but I loose superuser access ( shell reports su command not found) so I moved sh back to /system/bin/sh. Does anyone have any Idea which file is read in by sh at launch?

ADB push alternative from Android device itself (non-rooted)

I have a non-rooted Android device with stock ROM 4.4.2 and I have the following test shell script:
Code:
adb push test.sh /data/local/tmp
adb shell "cd /data/local/tmp; chmod 755 test.sh"
adb.exe shell "sh /data/local/tmp/test.sh > /dev/null 2>&1 &"
If I run this over ADB from PC to my device, it simply works.
Now convert this to:
Code:
cp test.sh /data/local/tmp
cd /data/local/tmp; chmod 755 test.sh
/system/bin/sh /data/local/tmp/test.sh > /dev/null 2>&1 &"
and it doesn't work. It says permission denied on /data/local/tmp.
Is there any other EXT4 place on a non-rooted device that I can do this?
Well, I cd to /data/local/tmp and even submitting a 'ls' command inside Terminal Emulator doesn't work, it says permission denied, but when doing it from PC to Android using ADB it's fine. Is there any workaround for this? I want to be able to do this on the device itself.
Thanks
idoit said:
I have a non-rooted Android device with stock ROM 4.4.2 and I have the following test shell script:
Code:
adb push test.sh /data/local/tmp
adb shell "cd /data/local/tmp; chmod 755 test.sh"
adb.exe shell "sh /data/local/tmp/test.sh > /dev/null 2>&1 &"
If I run this over ADB from PC to my device, it simply works.
Now convert this to:
Code:
cp test.sh /data/local/tmp
cd /data/local/tmp; chmod 755 test.sh
/system/bin/sh /data/local/tmp/test.sh > /dev/null 2>&1 &"
and it doesn't work. It says permission denied on /data/local/tmp.
Is there any other EXT4 place on a non-rooted device that I can do this?
Well, I cd to /data/local/tmp and even submitting a 'ls' command inside Terminal Emulator doesn't work, it says permission denied, but when doing it from PC to Android using ADB it's fine. Is there any workaround for this? I want to be able to do this on the device itself.
Thanks
Click to expand...
Click to collapse
No there isnt, not if you try using /data partition. ADB can read this partition (and that too was added around android kitkat itself for purpose of adb backup
etc). So ADB can read this partition, but terminal emulator and such cannot.
Assuming that you have a great reason to simply not copy the sh file to user-usable internal memory, /system partition is the one place where you can copy things without actually having root (and even access them with terminal emulator, but not manipulate them), and this isn't that simple either. Rather, the method will be device dependent. For instance, if you have a phone like Nexus phones, simply download stock firmware, open/extract it depending on what format it is (img or tar), add your sh file and repack the firmware, then flash it into the phone. The firmware should be same as your current installed so your applications dont mess up. But this method is not only long (and messy if your device has integrity checks on firmware files), but also not possible on some phones (as far as I know).
You can also try copying the sh file with adb to /data/data/com.android.terminal. Then you should be able to access this with terminal emulator (since an app has permissions inside its own data folder). However I have not tested this method and I am not sure it will work.
Besides this, every app (including terminal emulator) runs in a sandbox and does not have access to anything except /system (read-only access), emulated user-storage and its own data inside /data/data/. So in phone itself, you cannot read the file unless you copy it to /system or user-memory. And this finally implies that except above two methods, there is no other way to copy file to some other place except user-memory and be able to read it using some app inside phone itself without rooting.
Thanks for your comprehensive reply. I resolved the problem. Yes, it's right, I can simply run the shell script without even moving it to /data/local/tmp... so now I can conveniently running it directly from my phone without having to turn a computer on and do it over ADB.
thankx

Categories

Resources