Problem running commands in the terminal for android... - Android Software/Hacking General [Developers Only]

Hello, i am trying to boot debian on my nexus one the guide i am using is telling me to run these commands
$ adb remount
$ adb install vnc.apk
$ adb install swapper.apk
$ adb shell
# cd /sdcard/debian
# su
# sh ./debian.sh
# exit (repeat until out of adb)
I am getting to the point where i type the command # cd /sdcard/debian but it tells me cd: can't cd to /sdcard/debian. Anyone know what i am doing wrong? Thanks...
btw i am using ubuntu

Related

What is wrong with my script - going crazy

so I'm new to scripting, and I have a TON of lg optimus S's to root for work. So I figured I'd write a script to make life easy. I know all the shell commands are correct as if I manually type everything in it works. What happens is it gets through gingerbreak exploit and when the prompt returns # - everything seems to go to hell.
Here is my script I am using. I'm using Kubuntu 11.04 writing it in Kate, name of my script is Script2 and I'm executing it in bash via $sh Script2
echo "removing TMP directory";adb shell rm -r /data/local/tmp
echo "creating TMP directory";adb shell mkdir /data/local/tmp
echo "pushing gingerbreak";adb push gingerbreak /data/local/tmp/gingerbreak
echo "CD TMP";adb shell cd /data/local/tmp
echo "CHMOD TMP";adb shell chmod 777 /data/local/tmp/*
echo "running gingerbreak";adb shell /data/local/tmp/gingerbreak &
sleep 32
adb shell mount -o remount,rw -t yaffs2 /dev/block/mtdblock5 /system
adb shell cat /sdcard/flash_image > /system/bin/flash_image
adb shell chmod 755 /system/bin/flash_image
adb shell mount -o remount,ro -t yaffs2 /dev/block/mtdblock5 /system
adb shell flash_image recovery /sdcard/xionia_cwma_12518.6.img
adb shell reboot recovery
I've tried with out sleep command and also with out "&" at the end of gingerbreak, and when I do that and it returns # it seems like no commands will work, even if I type them in it returns just a blank line with out #.
With that current script after sleep 32, it returns #, few seconds later it tries to mount and I get (including the end of gingerbreak exploit).
[!] dance forever my only one
# mount: Operation not permitted
Script2: 9: cannot create /system/bin/flash_image: Directory nonexistent
Unable to chmod /system/bin/flash_image Read-only file system
mount -o: permission denied
reboot: Operation not permitted
then it returns me to bash$
Thanks!
So something interesting, I've been playing with this for awhile, and I took everything out past the
adb shell /data/local/tmp/gingerbreak
it seems if I run it as
bash$ adb shell /data/local/tmp/gingerbreak
vs
bash$ adb shell
$ cd /data/local/tmp
$ ./gingerbreak
when # is returned, the first option won't take any commands its like it hangs, if I type out the next command it will just return a blank line with out $ or #, I have to forcibly end the process by CTRL+C and it will return me to bash, if I do the second option it works and I can enter the next command in and it takes and returns me to #. Anyone know why this is? I'm pretty sure this is the problem.
I would happily use the second option, but I'm not sure how to get the script to take any android shell commands without a "adb shell" infront. If anyone knows how to get around this, that would be awesome =)

[Q]Installing busybox

Hi,
I'm trying to install busybox into a development board by downloading the pre-compiled binary and following the installation steps here. However, after doing so, I'm still unable to use the commands in /system/busybox. For example, when I try to run mknod, it shows me the following error:
Code:
./sh: mknod: not found
Basically, I did the following:
In Linux
Code:
adb root
adb remount
adb push busybox /system/busybox
adb shell
In device adb shell
Code:
cd /system/busybox
./busybox --install .
./sh
cd /system/bin
mv sh sh.android
ln -s /system/busybox/sh sh
It would seem like what I did to install busybox didn't work. May I know what's the correct procedure to install it?
I tried creating symlinks using the same ln command and it works, but do I have to do this manually for every single command?
Thanks!
goister said:
Hi,
I'm trying to install busybox into a development board by downloading the pre-compiled binary and following the installation steps here. However, after doing so, I'm still unable to use the commands in /system/busybox. For example, when I try to run mknod, it shows me the following error:
Code:
./sh: mknod: not found
Basically, I did the following:
In Linux
Code:
adb root
adb remount
adb push busybox /system/busybox
adb shell
In device adb shell
Code:
cd /system/busybox
./busybox --install .
./sh
cd /system/bin
mv sh sh.android
ln -s /system/busybox/sh sh
It would seem like what I did to install busybox didn't work. May I know what's the correct procedure to install it?
I tried creating symlinks using the same ln command and it works, but do I have to do this manually for every single command?
Thanks!
Click to expand...
Click to collapse
You didn't add /system/busybox to your PATH
Sent from my LT26i using XDA
Hi,
Where would I add it? init.rc or something?
Anyone?
Thanks!

The adb shell cd command doesn't change directories

When I use adb shell <cmd>, the commands work as expected, except for cd. If I run the following two commands, it shows I'm still in the root directory.
Code:
adb shell cd /any/valid/path
adb shell pwd
The cd command just doesn't ever change directories.
For completeness, I can not do abd shell ls ~/, as I have no HOME, but I assume this is normal?? I'm not concerned about HOME, it's fixable, but I really need to have the cd command working as I'm writing an IPython extension that wraps adb.
Cheers
Carl
I realise that this is a reply to an older question, but the answer might still be of use to some.
You first have to enter the shell before executing the 'cd' command.
STEP 1.
Code:
adb shell
STEP 2.
Code:
cd /any/valid/path
You don't use cd just type the directory you want to go to

[GUIDE][ROOT] Root almost any china android phone

Use any 1 of the following methods.
I have personally tried these on 2 of my china android phones.
1. Using linux {Recommended}Install Ubuntu or DebianEither
Install the android-sdk.
dl.google.com/android/adt/adt-bundle-linux-x86-20130717.zip <==x86
dl.google.com/android/adt/adt-bundle-linux-x86_64-20130717.zip <==x86_64
or
Just get the standalone adb and fastboot executables
texasice-cream-sandwich-mirror.googlecode.com/files/adb_fastboot.zip​Install ia32-libsRun this in a terminal
Code:
sudo apt-get install libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5
Now download the files required for root and put it in the same folder as adbmir.cr/GDEPZT4V​After you finish installing the files,
Connect your device with debugging mode enabled
Run
Code:
cd path/to/adb
where "path/to/adb" is the directory of your adb file
Now run
Code:
sudo chmod a+x adb
sudo chmod a+x fastboot
>>Root
Code:
./adb devices
./adb push psneuter /data/local/tmp/
./adb push busybox /data/local/tmp/
./adb push su /data/local/tmp/
./adb push Superuser.apk /data/local/tmp/
./adb shell
Chmod and run the exploit under adb shell
Code:
cd /data/local/tmp/
chmod 755 psneuter
./psneuter
Now re-engage an adb shell to check if the exploit worked.
Code:
./adb kill-server
./adb devices
./adb shell
If you see a # sign, the exploit was was successful. Otherwise repeat from >>Root
Now run these on the same adb shell
Code:
cd /data/local/tmp
./busybox ash
mount -o remount,rw /dev/block/mtdblock0 /system
cp /data/local/tmp/su /system/xbin/su
chmod 6755 /system/xbin/su
chown 0.0 /system/xbin/su
cp /data/local/tmp/Superuser.apk /system/app/Superuser.apk
chmod 777 /system/app/Superuser.apk
cp /data/local/tmp/busybox /system/xbin/busybox
chmod 6755 /system/xbin/busybox
Now reboot your device and open up SuperSU. Let it update the binary.
Your device should be rooted. ​2. Use Windows + MoboroboMethod 1 {Recommended but hard}
Download Moborobo from
Code:
moborobo.com
This software can Install drivers for many china phones and other branded phones.
After installing Moborobo download the files required for root
Code:
mir.cr/GDEPZT4V
Extract the files to the installation directory of Moborobo.
Code:
C:\Program Files (x86)\Moborobo
Run a CMD window under that directory and type
Code:
xcopy AndroidInterface.exe adb.exe
Connect your device in debugging mode & Open up Moborobo, It will install the drivers.
Keep Moborobo open & Follow the instructions mentioned in >>Root
P.S- the linux commands begin with a "./" remove this in windows or else it won't work. Note: Wherever I mentioned a terminal, the windows equivalent to this would be cmd​Method 2 {Easier}
Download and Install Moborobo just like above and run this under a cmd on that folder
Code:
xcopy AndroidInterface.exe adb.exe
Also download UnlockRoot or SuperOneClick
To make sure the adb files are of the same version, Copy over
Code:
adb.exe
AdbWinApi.dll
AdbWinUsbApi.dll
to UnlockRoot's tools directory or SOC's ADB directory
Connect your device in debugging mode and open up moborobo.
Now keep Moborobo open and Run UnlockRoot or SOC. ​Good Luck :good:
---Smo0thK, team BL4CKF1R3---
Click thanks if I helped you.
[/COLOR]
Hi there!
under method 2 in the end...I could not locate ROOT nowhere.....
>>Root
arena1 said:
Hi there!
under method 2 in the end...I could not locate ROOT nowhere.....
Click to expand...
Click to collapse
I said follow the instructions mentioned in ">>Root".
I named a step in Method one as ">>Root". So I meant you should repeat those steps.
Now download the files required for root and put it in the same folder as adb
mir.cr/GDEPZT4V
Click to expand...
Click to collapse
What files?
EDIT: managed to do all the steps using method 1 in windows but got this message with executing ./psneuter :
mnmap() failed. Invalid argument
I used windows to root
failed at adb shell psneuter command...
/system/bin/sh: psneuter: not found
how to proceed ?

HOW to root qubo big one

i got a new qubo big one and wanted to root it
Your phone's Android OS is rooted as soon as the cmdlet named su - what by default is left off - is present in Android's file system and executable.
Hence add a suitable version of su to Android OS: can be done via ADB.
Please can I get a step by step
xXx yYy said:
Your phone's Android OS is rooted as soon as the cmdlet named su - what by default is left off - is present in Android's file system and executable.
Hence add a suitable version of su to Android OS: can be done via ADB.
Click to expand...
Click to collapse
Instruction?
Please I need a step by step guide
A: To run Android shell commands with super-user right from within the shell on desktop computer ( AKA Command Prompt ) you have to run within desktop computer shell
Code:
adb devices
adb push <LOCATION-OF-SUITABLE-SU-BINARY-ON-PC-HERE> /data/local/tmp/
what will 1. connect the Android device to your desktop computer and 2. upload the su binary in the Android device temporary directory always available for the user.
B: Then, in desktop computer shell type
Code:
adb shell "cd /data/local/tmp & chmod 776 su"
what makes the su binary executable: its ownership by default is set to shell.
C: Then in desktop computer shell type
Code:
adb shell "ls -l"
what will show you content and permissions on recently uploaded files.
D:
To apply a series of Android shell commands what require super-user rights you now would run
Code:
adb shell
export PATH=/data/local/tmp:$PATH"
su -c "<SHELL-CMD-HERE>"
....
su -c "<SHELL-CMD-HERE">
exit
.
xXx yYy said:
A: To run Android shell commands with super-user right from within the shell on desktop computer ( AKA Command Prompt ) you have to run within desktop computer shell
Code:
adb devices
adb push <LOCATION-OF-SUITABLE-SU-BINARY-ON-PC-HERE> /data/local/tmp/
what will 1. connect the Android device to your desktop computer and 2. upload the su binary in the Android device temporary directory always available for the user
xXx yYy said:
A: To run Android shell commands with super-user right from within the shell on desktop computer ( AKA Command Prompt ) you have to run within desktop computer shell
Code:
adb devices
adb push <LOCATION-OF-SUITABLE-SU-BINARY-ON-PC-HERE> /data/local/tmp/
what will 1. connect the Android device to your desktop computer and 2. upload the su binary in the Android device temporary directory always available for the user.
B: Then, in desktop computer shell type
Code:
adb shell "cd /data/local/tmp & chmod 776 su"
what makes the su binary executable: its ownership by default is set to shell.
C: Then in desktop computer shell type
Code:
adb shell "ls -l"
what will show you content and permissions on recently uploaded files.
D:
To apply a series of Android shell commands what require super-user rights you now would run
Code:
adb shell
export PATH=/data/local/tmp:$PATH"
su -c "<SHELL-CMD-HERE>"
....
su -c "<SHELL-CMD-HERE">
exit
Click to expand...
Click to collapse
B: Then, in desktop computer shell type
Code:
adb shell "cd /data/local/tmp & chmod 776 su"
what makes the su binary executable: its ownership by default is set to shell.
C: Then in desktop computer shell type
Code:
adb shell "ls -l"
what will show you content and permissions on recently uploaded files.
D:
To apply a series of Android shell commands what require super-user rights you now would run
Code:
adb shell
export PATH=/data/local/tmp:$PATH"
su -c "<SHELL-CMD-HERE>"
....
su -c "<SHELL-CMD-HERE">
exit
Click to expand...
Click to collapse
Thanks

Categories

Resources