Linux - MobileThis forum is for the discussion of all topics relating to Mobile Linux. This includes Android, Tizen, Firefox OS, Sailfish OS, Maemo, MeeGo, Ubuntu Mobile, WebOS, Open Mobile Alliance and other similar projects and products.
A reminder that LQ now has a dedicated Android sister site: AndroidQuestions.org
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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.
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:
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.
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.
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?
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...)