LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Mobile
User Name
Password
Linux - Mobile This forum is for the discussion of all topics relating to Mobile Linux. This includes Android, Tizen, LiMo, Maemo, MeeGo, Openmoko, Ubuntu Mobile, WebOS, Firefox OS, Open Mobile Alliance and other similar projects and products.
A reminder that LQ now has a dedicated Android sister site: AndroidQuestions.org

Notices

Reply
 
Search this Thread
Old 03-18-2013, 02:42 AM   #1
rng
Member
 
Registered: Aug 2011
Posts: 747

Rep: Reputation: 23
grep not found


I have superpad3 with android 2.2 which I have rooted with z4root app. It has also installed busybox. I installed terminal but when I try to run grep there is an error 'not found'. Same error occurs with many other commands also like uname and whoami. How can I correct this? Thanks for your help.
 
Old 03-18-2013, 02:53 PM   #2
rtmistler
Senior Member
 
Registered: Mar 2011
Location: Milford, MA. USA
Distribution: Angstrom, Debian, Ubuntu, MINT
Posts: 1,221
Blog Entries: 7

Rep: Reputation: 494Reputation: 494Reputation: 494Reputation: 494Reputation: 494
Busybox may not have been built to include those commands. One of the things about Busybox is that you build it to suit what you need, therefore you can build in or out certain shell commands. And by that you contain the size of Busybox which was intended to provide for memory limited systems rather than be a substitute for real binaries in your shell. And another reason is so that they can restrict what you can do if you get a shell so that it's less likely for you to be able to mess up the system.

If you can find binary versions of these commands compiled for the target processor and Linux version that tablet is using, then you can put those binaries on there and run them, providing the libraries are also on there.

The other alternative is to get the sources and build them on that tablet; however you may not have gcc and the like on there either.

Sorry, I haven't looked into working with the Linux that's on a tablet.

Here's a link discussing the commands by the way, I had forgotten that you can just type Busybox and it gives you the commands available:

http://<br /> http://www.droidforum...oid.html<br />

Another quick search helped me find this one which has a lot about installing a shell or even Ubuntu onto your tablet:

http://<br /> http://www.freeyouran...ndex.php<br />

And it would make sense that as you look deeper, you'd find a way to build an entire Android distribution, or be able to recompile the distribution on your tablet. There's got to be a way to:

- obtain the source for the distribution running on your tablet; i.e. Jellybean for ARM<blah-blah>
- build that into a kernel
- install that onto a tablet

Otherwise, how would these things then boot up for starters, right? I'd recommend searching Android "OS" development forums. Because most of the Android developers forums are going to concentrate on applications to run within the OS.
 
Old 03-19-2013, 12:41 PM   #3
iqbal51
LQ Newbie
 
Registered: Jul 2011
Posts: 4

Rep: Reputation: 0
I am suffering the same problem. It is very important for us. Thanks for the sharing.
 
Old 03-19-2013, 01:19 PM   #4
rtmistler
Senior Member
 
Registered: Mar 2011
Location: Milford, MA. USA
Distribution: Angstrom, Debian, Ubuntu, MINT
Posts: 1,221
Blog Entries: 7

Rep: Reputation: 494Reputation: 494Reputation: 494Reputation: 494Reputation: 494
I may be incorrectly giving a history of Busybox. My experiences are with embedded development. Back in the day, when you compiled Linux for something like a Power PC or earlier ARM processors, the targets were completely custom and we really had to construct each kernel to be sized and optioned for the specific target. We also had limitations in dynamic memory (RAM), or NVRAM (what one considers to be disk space).

The command limitations were because if we did allow a console, we did not want to allow some smartypants to re-option or invalidate security on a half million dollar telephone switch, or router, merely because they were able to power cycle it and stick a hairpin in somewhere. And some of that stuff could not be allowed, otherwise you'd have very unreliable networking. We're talking about that 99.999% availability type of stuff.

Over time, the size allowances for RAM and the various ways to store data in non-volatile form have grown well enough that these days one is more "playing" when they say stuff like they managed to get Linux running on some 8-bit CPU with 8K of RAM. There's little or no product need for that, it's more hobbyist. The products want Bluetooth, WIFI, Networking, Graphics, they all have to mate with a mobile phone, and have to have a webserver.

I'm surprised a bit that Busybox is on Android.

Because when we evolved slowly to having less worry over space, however still had Busybox, we slowly usurped Busybox by saying, "Hmmm ... no 'ls' command ... copy the binary to /bin ...done!" Eventually we conned onto the fact that we had zero use for Busybox and in fact when we were writing more advanced shell scripts one of the engineers said, "Hey, what's wrong with grep?!? It doesn't work correctly!" And it was because the Busybox representation of grep was so old that it didn't match grep's functionality which the script writer was expecting to use. We told him how to usurp that command and within a release or two, that engineer removed Busybox completely because they didn't want to get bit again. Nobody complained because there was no need, someone else did the 2 hours worth of work and there was never any concern that a command was missing or not. He even set up the man path, something which we silently tolerated for years and merely typed man from a real Linux shell. It's just simply easier to do that on your target when you're developing on the target. However if the target is all limited because you had to cut it way back for size, then you couldn't.

Sorry for the length, but my point is that size-wise, chip-wise, Android doesn't have that problem, and clearly there are full ARM distributions of Linux. I wonder again why they use it, but that's not the point of this forum, or question.
 
Old 03-19-2013, 08:24 PM   #5
rng
Member
 
Registered: Aug 2011
Posts: 747

Original Poster
Rep: Reputation: 23
The command 'busybox grep <options> file' works. But it is a long command to write every time. I tried to make a script file and used 'busybox chmod +x script.sh' to make it executable, but it does not run. The error is "permission denied". This occurs even if I am root.

How can I run grep as a standalone command and how can I run script files on android?

Last edited by rng; 03-19-2013 at 08:25 PM.
 
Old 03-20-2013, 02:52 PM   #6
rtmistler
Senior Member
 
Registered: Mar 2011
Location: Milford, MA. USA
Distribution: Angstrom, Debian, Ubuntu, MINT
Posts: 1,221
Blog Entries: 7

Rep: Reputation: 494Reputation: 494Reputation: 494Reputation: 494Reputation: 494
Try:

Quote:
alias grep='busybox grep'
 
Old 03-20-2013, 07:43 PM   #7
rng
Member
 
Registered: Aug 2011
Posts: 747

Original Poster
Rep: Reputation: 23
How can I make this persist after rebooting on android?
 
Old 03-21-2013, 08:03 AM   #8
rtmistler
Senior Member
 
Registered: Mar 2011
Location: Milford, MA. USA
Distribution: Angstrom, Debian, Ubuntu, MINT
Posts: 1,221
Blog Entries: 7

Rep: Reputation: 494Reputation: 494Reputation: 494Reputation: 494Reputation: 494
If there's a .bash_profile then place it in there.
 
Old 03-22-2013, 05:15 AM   #9
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,499

Rep: Reputation: 570Reputation: 570Reputation: 570Reputation: 570Reputation: 570Reputation: 570
I'm rooted and on Cyanogenmod-6.0 and grep is in /system/xbin
Quote:
su
which grep
If a command isn't found, treat it as a permissions error. Android 'neutered' busybox, removing things like su. Cyanogenmod and other mods restore them.
 
Old 04-13-2013, 10:19 AM   #10
wargear
LQ Newbie
 
Registered: Apr 2013
Location: Navarre FL
Distribution: Kubuntu 12.10
Posts: 3

Rep: Reputation: Disabled
Is your busybox the latest build? rooted galaxy Note2 Note 10.1 tablet both have grep as well the other cmds you mentioned.. 2.2 is ancient news and may or may not be the issue... are you able to upgrade without losing root? (Had an asus TF300T tablet with s/n problem couldn't unlock bootloader but was able to root until 4.1. JB came out...)
 
Old 04-22-2013, 06:52 AM   #11
ritu3356
LQ Newbie
 
Registered: Apr 2013
Location: Delhi
Posts: 5

Rep: Reputation: 0
Hi friend thanks for sharing this info it's great..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating an alias in ksh that uses grep and includes 'grep -v grep' doug248 Linux - Newbie 2 08-05-2012 02:07 PM
[SOLVED] Tail the message log| grep " several words" play a sound when it's found. Alan87i Programming 17 07-08-2011 06:13 AM
[SOLVED] grep fails in shell script when string is not found coolnfunky Linux - Newbie 4 05-04-2011 10:02 AM
Trying to understand pipes - Can't pipe output from tail -f to grep then grep again lostjohnny Linux - Newbie 15 03-12-2009 10:31 PM
use grep and execute a command if string is found plisken Linux - General 6 07-28-2005 11:06 AM


All times are GMT -5. The time now is 07:58 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration