[Q] Can't Execute Script via Terminal Emulator - Android Q&A, Help & Troubleshooting

Hello all,
I'm trying to run a script on my rooted Galaxy W GT-I8150 but - here's the rub - the script use to run perfectly but now returns a syntax error.
The script runs on my Mac, and I know it's syntactically flawless. But if I try to run it from ADB shell, it returns a syntax error. The syntax error is the same if I try to run it from the terminal emulator on the phone. It stopped working after I used CWM to restore a backup of my stock rom.
However, my stock rom is still rooted, with SU and busybox installed. I am wondering if I should wipe my cache or something?
The error is:
sdcard/external_sd/pull_script.sh: 4: Syntax error: word unexpected (expecting ")")
The first four lines of the script is this:
Code:
NUM=0;
NUM2=1;
str=( "ccid_ctrl" "ccid_bulk" "smem_log" "ttySMD0" "ttyCSD0" "ttyHS0" "poop.rtf" ) ;
str2=( "mmcblk1" "mmcblk0p" ) ;
Anyone have any ideas? Thanks,
Foxy

Related

[Q] Help...No idea which bootloader I have...Running CM 7.0.3- Harmony

Guys,
I bought and rooted my Gtablet a while ago and I am thinking about trying some other ROMs now. I do not remember back when I did it which bootloader I have 1.1 or 1.2? I have been searching for a few hours but I am just going crazy with all the info. First I thought I had 1.1 but now I just don't know.
How can I be sure of my bootloader? also, if it makes any difference I am running CWM v4.0.1.5
Thanks in advance!!!
treepog said:
How can I be sure of my bootloader? also, if it makes any difference I am running CWM v4.0.1.5
Click to expand...
Click to collapse
You can check which bootloader you have if you're running on a pershoot kernel (which is what comes with CyanogenMod):
1. Reboot tablet.
2. Run a Terminal Emulator app (or use adb), and then type:
Code:
gTablet$ [B]dmesg | fgrep VmaxIndex[/B]
[ 10.334790] Shmoo: s_CpuShmoo.ShmooVmaxIndex = 7
If ShmooVmaxIndex = 7, then you're running on a 1.1 bootloader. If it is 8, then you have a 1.2 bootloader.
ADDED:
You can also determine the bootloader version, without booting into a working kernel, by looking for a string in the bootloader files--either the binaries or the image files. On any Unix system, this command will work (use bootloader.bin, or part4.img, or whatever, instead of filename.ext in the command line below):
Code:
$ [B]fgrep -q recoverykey= [I]filename.ext[/I] && echo 1.2 || echo 1.1[/B]
On other systems, you can use a hex or binary editor and look for a recoverykey= string in the bootloader file (binary or image). If the string is present, then the bootloader version is 1.2; else it is 1.1. This is true on all the official (from ViewSonic) and unofficial (from the various nvflash packages available here on XDA) bootloader binaries that I've looked at (as of March 2013).
To extract the bootloader image from the gTablet, use this command after putting the tablet into APX mode using Power and Vol [-]:
Code:
C:\> [B]cd C:\SOME\PATH[/B] [I]Change to the dir. which has both [FONT=Fixedsys]nvflash.exe[/FONT] and [FONT=Fixedsys]bootloader.bin[/FONT][/I]
C:\SOME\PATH> [B].\nvflash --bootloader bootloader.bin --read 4 bootldr.img[/B] [I]Extract the bootloader on the gTab.[/I]
Thanks very much for the reply. I just tried using Terminal Emulator for the past hour and I am really having a hard time figuring this out since I have never used terminal emulator before.
I tried typing:
gTablet$ dmesg | fgrep VmaxIndex
It says "permission denied"
I also typed:
dmesg | fgrep VmaxIndex
It says "permission denied"
How exactly do I do this??? Thanks very much.
treepog said:
I also typed:
dmesg | fgrep VmaxIndex
It says "permission denied"
Click to expand...
Click to collapse
That's a very strange error for something so simple--BTW, that is the correct command to use; the "gTablet$" is just a prompt to tell you that it should be executed on the gTab.
1. Did you type the command inside the Terminal Emulator window on the gTablet?
2. Is your CyanogenMod working correctly?
3. What's the output of this command (again, type only the stuff in bold) on the gTablet:
Code:
gTablet$ [B]ls -l /system/bin/dmesg /system/xbin/dmesg /system/bin/fgrep /system/xbin/fgrep[/B]
Yes, I typed exactly that:
dmesg | fgrep VmaxIndex
Into Terminal Emulator.
The Cyanogenmod was running "fine"...I was able to do the things that I wanted with the tablet which was play the few games that my daughter loves to play (diversion, angry birds, etc), watch movies through the netflix app, and browse the internet. Even when I would overclock I always noticed that it felt kind of sluggish though and i tried several browsers and none of them really ran great.
Back when I first modded this Gtablet (it was my very first Android device to mod). I remember having some issues when I went from Vegan to CM7. I am pretty sure I was not as thorough on cleaning up the tablet as i should have been before flashing.
Yesterday, after doing quite a bit of reading I decided to NVflash and totally clean up everything. I went back to 1.2-4349 and then followed the option 2 istallation instructions EXACTLY for Flashback 7.2. Wow, was I missing out I had always just thought the Gtablet was supposed to run like it was for me (not thinking that my botched install would have such an affect)...the Gtablet is running AMAZING now.
In any case I finished late last night and did not get a chance to update this thread.
Rather than just try to flash with what I think may have been 1.1 bootloader. I started from scratch and I am now running 1.2 bootloader on a Super clean machine with Honeycomb and VERY happy overall.
Thanks very much for your help!!!!

[Q] having alot of trouble getting sdk up and going on linux

I have spent the last to days trying to solve my error setting up sdk on linux mint12. I keep getting this error.
[Qoute]
scott-Presario-CQ62-Notebook-PC scott # apt-get -f installReading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
libc-bin libc6
Suggested packages:
glibc-doc
The following NEW packages will be installed:
libc-bin
The following packages will be upgraded:
libc6
1 upgraded, 1 newly installed, 0 to remove and 376 not upgraded.
3 not fully installed or removed.
Need to get 0 B/5,143 kB of archives.
After this operation, 3,432 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Can't exec "locale": No such file or directory at /usr/share/perl5/Debconf/Encoding.pm line 16.
Use of uninitialized value $Debconf::Encoding::charmap in scalar chomp at /usr/share/perl5/Debconf/Encoding.pm line 17.
Preconfiguring packages ...
dpkg: warning: 'ldconfig' not found in PATH or not executable.
dpkg: error: 1 expected program not found in PATH or not executable.
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.
E: Sub-process /usr/bin/dpkg returned an error code (2)
[Qoute]
I have tried every fix I have found online and all return this exact error. I tried changing the permisons on etc/sudoers to make sure they were right. I also added a these paths.
export PATH={PATH}:/usr/local/sbin:/usr/sbin:/sbin
export PATH={PATH}:/usr/local/bin:/usr/bin:/bin
I have even placed a permission file inside sudoers.d to try to add the path but I just ended up ruining my root access and have to do a complicated fix through my bootloader.but just cant seem to get it to work I am newer to linux and know basic commands but have no idea why I keep getting the same error or how to fix it any help would be deeply appreciated.
Are you running 64 bit? You need to dl the 32 bit lib's
Now it may be cheating, but try Tommytommatoe's android utility it sets up SDK for you and adds everything to your path... It's my go to for stubborn SDK
Sent from my PC36100 using xda premium
Yea it 64bit and I added the 32 bit libs for java but it gives the error when I try that to. I guess I will try that tanks man
Sent from my ADR6425LVW using XDA
Are you using an installer script or something like that?
RoberGalarga said:
Are you using an installer script or something like that?
Click to expand...
Click to collapse
No just piece by piece did java then unpacked SDK in my root dir and update it installed the API and all that then when I try to use adb it says their is no command and all the fixes make the error I described at first.
Sent from my ADR6425LVW using XDA
Ok... you don't need any fixes... you can simply move to platform-tools directory (using command cd /path/to/platform-tools) to can run ./adb command (note: ./adb, not adb).
RoberGalarga said:
Ok... you don't need any fixes... you can simply move to platform-tools directory (using command cd /path/to/platform-tools) to can run ./adb command (note: ./adb, not adb).
Click to expand...
Click to collapse
Really now I feel dumb lol. Guess I'm to used to windows been developing on it for a while. Thanks a lot.
Sent from my ADR6425LVW using XDA
Well thanks for all your help guys I guess I had a bad download of linux so I did a new clean install and setup SDK and apktool and dsixdas kitchen. Now everything works fine. No sudo errors or nothing the good news is with all the trying to fix what was wrong I got used to root being / instead of c:/ so that's a bonus
Sent from my ADR6425LVW using XDA

Galaxy S III adb shell error

I was looking up the partition layout of the Galaxy S III while I stumbled upon this problem.
The first time you run a command in 'adb shell' everything is fine, but when you try to run a second command, it just hangs. It doesn't crash, it just hangs.
So, I tried to find out what could be wrong, by doing the following: Instead of going into the shell itself, I just entered a semi-random command 'adb shell mount', which returned the normal result.
Then, I typed 'adb shell' and guess what? It returns a commonly known error: 'error: protocol fault (status 72 6f 6f 74?!)'
The status code is HEX, which translates to: 'error: protocol fault (status root?!)'
So I suppose this has something to do with the fact that my SGS3 is rooted.
I don't feel like unrooting it, but if someone would be so kind to test this on an unrooted SGS3 and report back the results here so we can investigate this further that would be greatly appreciated.
it works without any error.
do you know what to backup which contains kernel and ramdisk ?
Mine is rooted, with Omega Rom V3 and everything works perfect with adb.
Cranck said:
Mine is rooted, with Omega Rom V3 and everything works perfect with adb.
Click to expand...
Click to collapse
Have you tried multiple shell commands? I know adb functions, but it's about using adb shell.
I'm on the stock rom, rooted manually with CF's insecure kernel by the way.
I'm not sure this is related, but there is some very suspicious new functionality in the FactoryTest.apk, called "SysScope". Its some kind of service checking and verifying the authenticity of "something". But I have no idea of what, only that a related java file (ResultCode.class [sysscope.service] contain the following code segment:
Code:
[SIZE=2] arrayOfResultCode[0] = OK;
arrayOfResultCode[1] = ADB_RUNNING_AS_ROOT;
arrayOfResultCode[2] = PARTITION_TAMPERED;
arrayOfResultCode[3] = ROOT_PROCESS_FOUND;
arrayOfResultCode[4] = DANGEROUS_FILE_DETECTED;
arrayOfResultCode[5] = NOT_OFFICIAL_BINARY;
[/SIZE]
Then it looks for SysScope files in the SysScopeVerifyer.class like this:
Code:
[SIZE=2]/data/app/com.sec.android.app.sysscope-1.apk
/data/app/com.sec.android.app.sysscope-2.apk[/SIZE]
I suggest you to back these up, and then replace them, with empty files of the same name, and see what happens.
I have the exact same problem on the GS2, OneX, and OneS. I have no problem shelling into the devices using another system, but on one of my computers I have the same issue. Windows 7 64bit with jdk7 installed.
Also, I enabled adb trace to see what was being returned: set ADB_TRACE=all
-Entering ls three times on the OneX, the first time works correctly
Code:
ls
system/core/adb/commandline.c::stdin_read_thread():stdin_read_thread(): post uni
x_read(fdi=0,...)
system/core/adb/commandline.c::stdin_read_thread():stdin_read_thread(): pre unix
_read(fdi=0,...)
system/core/adb/commandline.c::read_and_dump():read_and_dump(): post adb_read(fd
=101): len=5
ls
system/core/adb/commandline.c::read_and_dump():read_and_dump(): pre adb_read(fd=
101)
system/core/adb/commandline.c::read_and_dump():read_and_dump(): post adb_read(fd
=101): len=32
acct
cache
config
cwkeys
d
system/core/adb/commandline.c::read_and_dump():read_and_dump(): pre adb_read(fd=
101)
system/core/adb/commandline.c::read_and_dump():read_and_dump(): post adb_read(fd
=101): len=318
data
default.prop
dev
devlog
etc
firmware_dsps
firmware_q6
firmware_radio
firmware_wcnss
init
init.elite.rc
init.goldfish.rc
init.qcom.rc
init.qcom.sh
init.rc
init.target.rc
init.usb.rc
mnt
proc
root
sbin
sdcard
sys
system
tombstones
ueventd.goldfish.rc
ueventd.rc
vendor
[email protected]:/ $ system/core/adb/commandline.c::read_and_dump():read_and_dump()
: pre adb_read(fd=101)
ls
system/core/adb/commandline.c::stdin_read_thread():stdin_read_thread(): post uni
x_read(fdi=0,...)
system/core/adb/commandline.c::stdin_read_thread():stdin_read_thread(): pre unix
_read(fdi=0,...)
ls
system/core/adb/commandline.c::stdin_read_thread():stdin_read_thread(): post uni
x_read(fdi=0,...)
system/core/adb/commandline.c::stdin_read_thread():stdin_read_thread(): pre unix
_read(fdi=0,...)

[Q] Install and run apk.file

Is there any command on cmd.exe that would allow me to run apk.file after installing it .. like
adb install myapp.apk
This command will only install myapp onto the emulator and I have to manually run this application from the emulator (by performing single click on its icon).
What I want to do is use a command which not only installs the application but also run it or open it in the device after installation.
stiphen said:
Is there any command on cmd.exe that would allow me to run apk.file after installing it .. like
adb install myapp.apk
This command will only install myapp onto the emulator and I have to manually run this application from the emulator (by performing single click on its icon).
What I want to do is use a command which not only installs the application but also run it or open it in the device after installation.
Click to expand...
Click to collapse
http://delphi.org/2013/11/installing-and-running-android-apps-from-command-line/
I think that is what you are looking for
quentin330 said:
http://delphi.org/2013/11/installing-and-running-android-apps-from-command-line/
I think that is what you are looking for
Click to expand...
Click to collapse
after installing Myfile.apk
adb install Myfile.apk
and then try to run it in the device
adb shell am start -n com.other.Myfile.apk/.MainActivity
I get the error
Starting: Intent { cmp=com.other.Myfile.apk/ .MainActivity }
Error type 3
Error: Activity class {com.other.Myfile.apk/com.other.Myfile.apk.MainActivity} does not exist.
whereas Myfile.apk is installed
stiphen said:
after installing Myfile.apk
adb install Myfile.apk
and then try to run it in the device
adb shell am start -n com.other.Myfile.apk/.MainActivity
I get the error
Starting: Intent { cmp=com.other.Myfile.apk/ .MainActivity }
Error type 3
Error: Activity class {com.other.Myfile.apk/com.other.Myfile.apk.MainActivity} does not exist.
whereas Myfile.apk is installed
Click to expand...
Click to collapse
You have to remplace com.other by the name of the package and MainActivity by the name of the activity you want to open
quentin330 said:
You have to remplace com.other by the name of the package and MainActivity by the name of the activity you want to open
Click to expand...
Click to collapse
As in my first post .. I said I install apk file into my device by
adb install myfile.apk
OK it is installed into my device .. Now with command I want to open/run installed apk in my device .. I know i can normally run it by touching its icon .. but i want to do the same through the command ..
stiphen said:
As in my first post .. I said I install apk file into my device by
adb install myfile.apk
OK it is installed into my device .. Now with command I want to open/run installed apk in my device .. I know i can normally run it by touching its icon .. but i want to do the same through the command ..
Click to expand...
Click to collapse
That's what you can do with the commands but you have to know which activity to open and in which package it is
quentin330 said:
That's what you can do with the commands but you have to know which activity to open and in which package it is
Click to expand...
Click to collapse
as i am new .. i only know that i have installed an apk and is installed . now hoe come i know which package is this in and how can i run it

[Q] Bash scripting on Ubuntu Phone

Hello, I just received my Aquaris E4.5 Ubuntu Edition, and would like to do some bash scripting. I am getting the error in the screenshot (/bin/sh bad interpreter permission denied).
When I execute the script with sh, bash or . before the command, it works properly.
Does anyone know whether /bin/sh has been blocked for a reason (security?) or that there may be a bug somewhere?
Welcome to the forums!
Indeed, this looks like a bug in the terminal app to me. If I run your script via adb or ssh, I can execute it just fine. But if I try to run it using the terminal app, I get exactly the same permission error.
I found some more information on Launchpad: https://bugs.launchpad.net/ubuntu-terminal-app/+bug/1325571

Categories

Resources