Issues with Shell - Upgrading, Modifying and Unlocking

Hello, i am trying to go into shell and it says this:
/system/bin/sh: dir: inaccessible or not found
(Xiaomi Redmi note 8 pro)
and it makes the name start with 127|

With the newer androids, the shell is harder to use for me. I had a l'il luck by 1st, [ cd /system ], then [ ls -a ]. Without root, /system/bin/sh is useless unless you use toybox or toolbox (won't even getenforce for me). Sometimes, /vendor has usable /bin commands, but often this /vendor/bin is 600 like /system/bin. ADB shell still has its dignity, though, so you can at least list your files. The newer androids w/ system as root, treble roms, etc. changed a lot concerning permissions and such.

Related

[HOWTO] manual rooting of Galaxy Tab (EURO)

This howto is for those people who are unable to root their Galaxy Tab using any of the automated procedures and do not suffer from CLPS (command-line-phobia-syndrome).
My story: After upgrading my EURO (GSM) Galaxy Tab to JM6 my persistent efforts to root the device using either the z4root or SuperOnClick methods have all been unsuccessful. z4root (v1.3.0) kept crashing at different stages, apparently depending on which and how many background apps were running. With SuperOneClick I never managed to get beyond the "changing permissions" stage.
Since both methods are basically wrappers of the rageagainstthecage application, I tried to perform the rooting procedure manually. Guess what, that worked without any problem and it is pretty easy to do.
The basic steps of the rooting process are:
1) use rageagainstthecage to get a temporary root shell
2) use the temporary root shell to copy three files to the read-only system partition the device
While I find the outlined procedure straightforward, you may not. Anyhow, try this at your own risk.
==== Prerequisites ====
I used Ubuntu 10.10 for this, but it should work on any other distro and on Windows just as well. Whatever OS you use, you need a working adb connection to your Galaxy Tab. Odin or Kies are of no use here.
You need the following binaries
* su
* busybox
* Superuser.apk
* rageagainstthecage
To get the all required files, simply download "SuperOneClickv1.5.5-ShortFuse.zip". That's what I used.
Get it here: http://forum.xda-developers.com/showthread.php?t=803682
Extract the contents of the ZIP, open a command-prompt on your computer and change to the directory where the extracted files are located.
Some advice if shell commands are not your regular cup of tea.
The following instructions show the shell commands. Some are executed on the host computer. Others are executed on the Galaxy Tab. You can differentiate between the two easily: All commands which start with "> " need to be executed in a shell on the host computer. Commands which are prefixed with "$ " are executed on the Galaxy Tab. In both case the ">" and the "$" must not be typed. If you copy+paste from this howto, make sure only to copy the commands and leave out the prompt.
==== Step 1: getting a temporary root shell ====
Copy the rageagainstthecage exploit to a temporary directory.
Code:
> adb push rageagainstthecage /data/local/tmp
263 KB/s (5392 bytes in 0.020s)
Change the file permissions and execute the exploit.
Code:
> adb shell
$ cd /data/local/tmp
$ chmod 777 rageagainstthecage
$ ./rageagainstthecage
[*] CVE-2010-EASY Android local root exploit (C) 2010 by 743C
(other output truncated)
Your shell session will be terminated which will throw you back to the regular command prompt of your host computer.
==== Step 2: restart adb server ====
Now stop and restart the adb server process.
Code:
> adb kill-server
> adb start-server
* daemon not running. starting it now *
* daemon started successfully *
Now reconnect to the Galaxy Tab again. Notice the '#' prompt. This means you have a temporary root shell now. We use this to execute some privileged commands which make the rooting permanent.
==== Step 3: making it permanent ====
First, make the system partition writeable. We need this to be able to copy su, busybox and Superuser.apk to the required locations. Then exit the android shell again.
Code:
> adb shell
# mount -o remount,rw -t rfs /dev/block/stl9 /system
# exit
Now we push busybox and su via adb. Then we install Superuser.apk.
Code:
> adb push busybox /system/bin
> adb push su /system/bin
> adb install Superuser.apk
The final steps are to change the file permissions for su and busybox and then remount the system partition as read-only again.
Code:
> adb shell
# chmod 4755 /system/bin/busybox
# chmod 4755 /system/bin/su
# mount -o remount,ro -t rfs /dev/block/stl9 /system
# exit
That should be all. Try a reboot and some apps which require root, like Titanium Backup. The Superuser.apk should popup a dialog requesting permission.
Hope this helps. Happy rooting.
[update]
This process worked for JMA and JMD as well.
"adb install" Superuser.apk instead of "adb push"
[/update]
It will help me !
Merci ;-)
Fantastic! This is just what I was looking for, thank you! I feel dumb now, because I started a thread of my own right as you posted this. You must just type faster than me
I ran a quick test, and it all looks good. One quick question actually. Why do you mount like this:
Code:
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
When most instructions for the Galaxy Tab have you doing something like this:
Code:
# mount -o remount,rw -t rfs /dev/block/stl9 /system
I'm not saying it is wrong, in fact, it actually worked for me. I'm just curious as to why it works like that? My understanding of mounting partitions and such in Linux is a little bit weak, so I like to indulge my curiousity by bugging fine people like yourself
Anyway, thanks again, this did exactly what I needed it to. Well done, I appreciate it.
DavidThompson256 said:
One quick question actually. Why do you mount like this:
Code:
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
When most instructions for the Galaxy Tab have you doing something like this:
Code:
# mount -o remount,rw -t rfs /dev/block/stl9 /system
I'm not saying it is wrong, in fact, it actually worked for me. I'm just curious as to why it works like that? My understanding of mounting partitions and such in Linux is a little bit weak, so I like to indulge my curiousity by bugging fine people like yourself
Click to expand...
Click to collapse
Thanks for pointing that out! Actually both the filesystem type and blockdevice name were totally wrong. Apparently the mount command ignores both parameters - at least when they are wrong.
I just verified this as self-punishment for not paying attention:
Code:
# mount
(...)
/dev/block/stl9 /system rfs ro,relatime,vfat,log_off,check=no,gid/uid/rwx,iocharset=utf8 0 0
(...)
/system is mounted read-only to /dev/block/stl9. This is the normal state of things.
Now I remount this without the fstype parameter and using a wrong blockdevice name:
Code:
# mount -o remount,rw /dev/block/xyz /system
# mount
(...)
/dev/block/stl9 /system rfs rw,relatime,vfat,llw,check=no,gid/uid/rwx,iocharset=utf8 0 0
(...)
Surprise, this actually remounts /system in read-write mode. This is why my original howto worked despite using the wrong parameters.
Thanks again. I corrected the HOWTO.
It works for me, but i get now error message: The application calendar save (proces com.android.providers.calendar) is unexpecly stopt. Try again. Forced closing
I had this also with SuperOneClick.
When i want to start the calender in the applications i get it also.
The application wil not run anymore.
How can i resolved this.
Thnx
leonreijnders said:
It works for me, but i get now error message: The application calendar save (proces com.android.providers.calendar) is unexpecly stopt. Try again. Forced closing
I had this also with SuperOneClick.
When i want to start the calender in the applications i get it also.
The application wil not run anymore.
How can i resolved this.
Thnx
Click to expand...
Click to collapse
That is strange. The result of the rooting process is just adding three files to the system partition. I find it hard to believe that this could lead to the problem you describe. However, while experimenting with z4root I had the the effect that there were many rageagainstthecage processes running in the background and the Galaxy Tab slowed down considerably. Perhaps there is something similar going on.
Have you tried rebooting after completing the rooting process?
Try shutting down the Tab completely.After rebooting get a shell on the Tab with "adb shell" and execute "ps". That shows the process list. If that looks normal, I would try a factory reset of the device. Which ROM version are you running?
BlackLevel: Thank you soooooooooo much... I don't get how to hit the Thanks Meter thing, but here is the old fashioned way. I used a MacBook to accomplish your perfect, step by step rooting of an AT&T Galaxy Tab i987. It helps that I'm more comfortable at the command line than with most GUI systems.
I could put this into a bash script, but that could be dangerous. People really need to look at whats happening with 'adb' and have some idea of what adb is for. I did renamed your 'adbmac' to 'adb', then I could cut and paste from your instructions except for adding ./ before the adb... ie. ./adb shell
Again, wonderful work at pulling this all together in one place.
Jeff
This guide worked perfectly! I love a nice quiet clean root and it doesn't get any better than this. You my friend deserve a cookie!
Hi Guys,
I flashed to JMA, rooted it with One Click Root, and everxthing seemdet to be okay, but activating OCLF failed....is there anybody with the same problem?
Jan
Thanks a lot !. It's clean and doesn't need a kies ...
Just a question : after reboot I have to use "su" after "adb shell" to become root.
Is there any way to be root directly after adb shell ?
And thanks again ...
Mike
mbaroukh said:
Just a question : after reboot I have to use "su" after "adb shell" to become root.
Is there any way to be root directly after adb shell ?
Click to expand...
Click to collapse
The reason is that "/sbin/adbd" (the adb daemon) is running as the shell user. It would need to run as root user instead. This requires changes to the initial ram disk where adbd the relevant settings are stored.
Dealing with "insufficient permissions for device"
Thanks, this worked for me.
One small thing: running from a Linux sustem (Ubuntu 9.04), to overcome a "insufficient permissions for device" problem, I had to put my Ubuntu terminal session into su mode and restart the ADB server -- cf. groups.google.com /group/android-discuss/browse_thread/thread/f85a795644e65b59?pli=1 :
[[
adb kill-server
sudo adb start-server
adb devices
]]
gklyne said:
One small thing: running from a Linux sustem (Ubuntu 9.04), to overcome a "insufficient permissions for device" problem, I had to put my Ubuntu terminal session into su mode and restart the ADB server -- cf. groups.google.com /group/android-discuss/browse_thread/thread/f85a795644e65b59?pli=1 :
[[
adb kill-server
sudo adb start-server
adb devices
]]
Click to expand...
Click to collapse
Thanks for the feedback. On my Ubuntu 10.10 adb runs under my regular user-id (1000) and I do not have to use sudo or run the local adb server as root. That might be due to the way the udev rules are set up. Mine are rather unrestrictive and look like this:
Code:
$ cat /etc/udev/rules.d/51-android.rules
SUBSYSTEMS=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEMS=="usb", SYSFS{idVendor}=="04e8", MODE="0666"
How do yours look like?
Which is the more simple method for root of galaxy tab euro ?are there ?
the incredible said:
Which is the more simple method for root of galaxy tab euro ?are there ?
Click to expand...
Click to collapse
Try z4root or SuperOneClick. Both methods are wrappers of the rageagainstthecage exploit and try to automate the manual process outlined here.
This thread should be a sticky. Worked like a charm.
z4root is very simple method..thanks.
thanks to Germany...
I agree, this thread should be sticky. Finaly some sense in android devel section...
Thank you very much for your guide!
I followed all the instructions in your guide, everything seems fine until I try to push the busybox and su to my Galaxy Tab.
blacklevel said:
Now we push busybox and su via adb. Then we install Superuser.apk.
Code:
> adb push busybox /system/bin
> adb push su /system/bin
> adb install Superuser.apk
[/update]
Click to expand...
Click to collapse
I received an error: "failed to copy 'busybox' to '/system/bin/busybox' : No space left on device\"
the same error for the 'su' too
(No space left on device) is impossible, my tab is brand new sealed when i got it.
I have been trying the z4root and SuperOneClick procedure to root this tab but are all unsuccessful.
I am not sure if it is because of my tab needed a "NAND unlock" (I cannot find any guide about the NAND unlock) because I received this message when I tried to install busybox from the market.
Please help! My tab is carrier locked to Bell Canada, I really wanna to unlock it and root it~
Thanks!
gummo6869 said:
I received an error: "failed to copy 'busybox' to '/system/bin/busybox' : No space left on device\"
the same error for the 'su' too,
Click to expand...
Click to collapse
The `no space left on device` message indicates that the /system partition is still read-only. That means the mount command in step 3 was unsuccessful. Did you get any error message when you executed it?

[Q] terminal

When I su in terminal it grants terminal permissions but then when i put in reboot or reboot recovery it says "not permitted"... what gives???
There is a couple of things you can try to figure out what's up:
1) After you typed in su, did your prompt change from a $ to a #?
If so, OK, and if not, su didn't root you. No need to read further without
rooting again.
2) This may only work if busybox is properly installed, but worth a shot:
Type in at #, "which reboot", to find out which possible reboot in the $PATH
order you ran, so it'll return something like /system/bin/reboot, or perhaps
/system/xbin/reboot.
3) Look at the permissions & ownership of reboot returned by which:
ls -l /system/bin/reboot (if that's the one that was executed). If it's not
something like 755 (rwxr-xr-x), then it's not clear it's set right.
Permissions are usually 3 octets like rwx rwx rwx, first owner, next group, next others. In the ls -l /system/bin/reboot in 3) you can see 'owner group' (perhaps 'root system' or something like that on yours). With that info you can figure out if permissions are right. The easiest way to make it work if you're rooted is to set permissions to 755 (anyone can execute regardless of owner) by doing this:
$ su
# chmod 755 /system/bin/reboot (or whereever your reboot is)
Good luck - Hashi
hachamacha said:
There is a couple of things you can try to figure out what's up:
1) After you typed in su, did your prompt change from a $ to a #?
If so, OK, and if not, su didn't root you. No need to read further without
rooting again.
2) This may only work if busybox is properly installed, but worth a shot:
Type in at #, "which reboot", to find out which possible reboot in the $PATH
order you ran, so it'll return something like /system/bin/reboot, or perhaps
/system/xbin/reboot.
3) Look at the permissions & ownership of reboot returned by which:
ls -l /system/bin/reboot (if that's the one that was executed). If it's not
something like 755 (rwxr-xr-x), then it's not clear it's set right.
Permissions are usually 3 octets like rwx rwx rwx, first owner, next group, next others. In the ls -l /system/bin/reboot in 3) you can see 'owner group' (perhaps 'root system' or something like that on yours). With that info you can figure out if permissions are right. The easiest way to make it work if you're rooted is to set permissions to 755 (anyone can execute regardless of owner) by doing this:
$ su
# chmod 755 /system/bin/reboot (or whereever your reboot is)
Good luck - Hashi
Click to expand...
Click to collapse
When I chmod 755, it says unable to chmod system is read only. Before the # sign there is a sh-3.2 (#) is that normal because i didnt see that on any of the videos I watched. I want to put the psfrecovery on my incredible and thats what this is all about but it wont seem to push the recovery to the phone, but it doesnt throw any errors either. ::
When I chmod 755, it says unable to chmod system is read only. Before the # sign there is a sh-3.2 (#) is that normal because i didnt see that on any of the videos I watched. I want to put the psfrecovery on my incredible and thats what this is all about but it wont seem to push the recovery to the phone, but it doesnt throw any errors either
Click to expand...
Click to collapse
Sorry: I skipped a step. You would have to remount /system as read write to do a chmod on something in /system.
The other question (sh-3.2) (#) and while I can't say it 'isn't normal' , I can tell you I've never seen it. (which doesn't mean much).
One thing I wonder about is :: "are you seeing anything or have you seen the superuser.apk app being asked to 'allow' su access the first time you use su in term?" I'm wondering if something has gone wrong with your basic superuser install.
Anyway, about as much as you can try to do with this information is to see if you can remount the /system FS read-write as follows, and then do the chmod again. Here's what I think will work on the dinc:
(from adb or term emulator):
$ su
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
# chmod 755 {whatever the file was}
# ls -l {the file so you can check it's mode}
// if it's ok, then proceed, and if not, not much you can do without re-rooting
// then remount as ro so everything is flushed & flush and synced.
# mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system
// then try the command again.
Click to expand...
Click to collapse
So if none of this works, or also gives permission errors, then you might , if you have Rom Manager, try a 'fix permissions'. Normally I wouldn't advise that, because I don't know who uses that or even which files it 'fixes' or if it fixes them. I just figure it's worth a shot.
Bottom line is if you don't have permissions to a lot of things and you're rooted with su and superuser.apk, then something in the install of those things has gone haywire (if you can't repair them , one way being as above).
Best of luck to you - H
hachamacha said:
Sorry: I skipped a step. You would have to remount /system as read write to do a chmod on something in /system.
The other question (sh-3.2) (#) and while I can't say it 'isn't normal' , I can tell you I've never seen it. (which doesn't mean much).
One thing I wonder about is :: "are you seeing anything or have you seen the superuser.apk app being asked to 'allow' su access the first time you use su in term?" I'm wondering if something has gone wrong with your basic superuser install.
Anyway, about as much as you can try to do with this information is to see if you can remount the /system FS read-write as follows, and then do the chmod again. Here's what I think will work on the dinc:
(from adb or term emulator):
So if none of this works, or also gives permission errors, then you might , if you have Rom Manager, try a 'fix permissions'. Normally I wouldn't advise that, because I don't know who uses that or even which files it 'fixes' or if it fixes them. I just figure it's worth a shot.
Bottom line is if you don't have permissions to a lot of things and you're rooted with su and superuser.apk, then something in the install of those things has gone haywire (if you can't repair them , one way being as above).
Best of luck to you - H
Click to expand...
Click to collapse
yeah tried it and it was a no go lol, Skyraider 3.5 is my rom so i am gonna try and switch roms thanks for trying though

[NST]Manual Rooting, ADB, Gapps (1.1), etc

Please, dont post on this thread, continue to use [NST]MinimalTouch 1.1beta5
Recomendation, Paste the commands one by one.
I am not responsible for any damage your nook suffers.
Index
Automatic Method:
[NST]MinimalTouch 1.1beta5
[NST]Touch-Formatter
Manual Tutos:
Skip registration (OOBE)
Making the manual process LESS PAINFULL
Setting up adb manually on the nook touch
Setting up root access on NST through adb and installing busybox
Improve battery life(testing)
Backup bookmarks and annotations(testing)
Enable non market app installs
Installing XorZone's B&N button modifier
Change the powered off screen image
Blocking OTA updates
Installing new fonts for your nook (testing)
Installing Gapps (+launcher, etc)
Totally uninstall Gapps (my repack), unrooting, erasing and restoring
Interesting or useful specific apps or hacks for Nook Simple Touch
nook 1.1 update
Thanks to:
GabrialDestruir for his hard work, making easy to root the NST creating the Touchnooter (http://forum.xda-developers.com/showthread.php?t=1343143) (http://forum.xda-developers.com/showthread.php?t=1132693)
ros87 for the update on uramdisk and the how to modify boot/charging images and usb drivers. (http://forum.xda-developers.com/showthread.php?t=1337653) (http://forum.xda-developers.com/showpost.php?p=17882146&postcount=11) (http://forum.xda-developers.com/showpost.php?p=19342931&postcount=12)
XorZone for NookTouchTools and his jars, book button menu and the orientation Switch (http://forum.xda-developers.com/showthread.php?t=1289894)
nookdevs for noogie and making all this possible (http://nookdevs.com/NookColor_Rooting)
mali100 for the update on framework. (http://forum.xda-developers.com/showpost.php?p=19201466&postcount=352)
xboxexpert for the working market. (http://forum.xda-developers.com/showpost.php?p=15084704&postcount=51)
Kralik for his findings. (http://www.mobileread.com/forums/showthread.php?t=156539)
bonzer2u for OTA blocking. (http://forum.xda-developers.com/showpost.php?p=10973887&postcount=1)
traycold for his images (http://forum.xda-developers.com/showpost.php?p=17822468&postcount=9)
jerryfan2000 for Button savior (http://forum.xda-developers.com/showthread.php?t=865525)
OMGWTF_BBQ for the Button Savior eink friendly mod (http://forum.xda-developers.com/showthread.php?t=1250278)
TJay99 for the Simplistic Countdown Timer (http://forum.xda-developers.com/showthread.php?t=1290900)
mdall for tweaking the screen refresh (http://forum.xda-developers.com/showthread.php?t=1241419)
dark_hawk for adding the last step on the Gaps method + Fonts (method 1) (http://forum.xda-developers.com/showpost.php?p=19441352&postcount=33)
met67 for usb drivers http://forum.xda-developers.com/showpost.php?p=19339163&postcount=11
LastSilmaril for the bookmarks and annotations info (http://forum.xda-developers.com/showpost.php?p=19483661&postcount=67)
met67 for the permissions and ownership on Gapps (http://forum.xda-developers.com/showpost.php?p=19658259&postcount=109)
mali100 for portin CWM to NST (http://forum.xda-developers.com/showthread.php?t=1360994)
salsichad2 for pointing out that the X files where corrupt and his adw theme config (http://forum.xda-developers.com/showpost.php?p=19720053&postcount=139)
kneeldug for sugesting extra steps on the automatic tuto.
bisbal for helping me beta testing.
dobbing for the copy of the 1.1 update.
Setting up adb manually on the nook touch:
If you want to restore, wipe data, or reset your nook, FIRST read how to backup your anotations and then search on this post for: Totally uninstall Gapps (my repack), unrooting, erasing and restoring.
Download noogie, and burn it into an SD-card (http://www.multiupload.com/OFI609MP8V) use Win32DiskImage.exe.
Shut down the Nook Touch completely your NST http://www.multiupload.com/CJ981FWPJG
Insert the SD-card into your Nook, connect it to the pc and turn it on.
When the nook ends booting (you should see a rooted forever splash screen on it) wait 20 seconds, you should see a new drive named boot, if not, go to MiniTool Partition Wizard Home Edition look for a partition named boot and assign it a letter.
Open boot, and replace the uramdisk, with one of these (http://forum.xda-developers.com/showthread.php?t=1337653).
This tuto is all made for the Wifi-uramdisk, if you want to use the usb change all the "adb connect yourNSTip" into "adb devices".
If you finally want to use adb over usb, follow this to make the nook recognizable by adb http://forum.xda-developers.com/showpost.php?p=19342931&postcount=12 or install this http://forum.xda-developers.com/showpost.php?p=19339163&postcount=11.
Eject the nook from the pc and reboot the NST without the noogie SD-card.
Setting up root access on NST through adb and installing busybox:
Download java JKD http://www.oracle.com/technetwork/java/javase/downloads/index.html
Download the android sdk (I recommend zipped) and extract it on C so that it looks like C:/android-sdk-windows
Open the SDK manager and update it, install for example the 2.1 platform, etc, it will automatically create /platform-tools
Download Superuser (http://nookdevs.com/images/a/a9/Superuser.zip), su (http://nookdevs.com/images/e/e0/Su.zip), and busybox (http://bit.ly/s1s7FZ or http://benno.id.au/android/busybox), extract them on C:/android-sdk-windows/platform-tools
Connect your NST to your home Wi-Fi, and check its ip.
Open cmd and type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb install Superuser.apk
adb push su /data/local/
adb shell
cd /system/bin
mount -o remount,rw /dev/block/mmcblk0p5 /system
cat /data/local/su > su
chmod 6755 su
reboot
Now we will install buysbox.
Close cmd and reopen it, When your nook reboots type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb shell
su
mount -o remount,rw /dev/block/mmcblk0p5 /system
exit
exit
adb push busybox /data/local
adb shell
su
cd /system
mkdir /system/xbin
cd /data/local
chmod 755 busybox
/data/local/busybox cp /data/local/busybox /system/xbin/busybox
cd /system/xbin
chmod 755 busybox
./busybox --install -s /system/xbin
rm /data/local/busybox
reboot
Improve battery life (testing)
As the Nook Touch hasn't got a overclocking kernel, and isn't near, as it isn't convenient to change or modify the cpu governor (it works in an unusual way), as I don't like too many apks bloating my nook, there is something that seems to be working for me, underclocking it manually of course .
The Nook has 3 stock frequencys, 300, 600, 800, and a deepsleep state.
As this small monster is just an ereader, and the refresh rates of eink are painfully slow I didn't find the need for it going all the way to 800mhz I did this small trick:
Make a backup up clrbootcount.sh.
Open CMD and type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb pull /system/bin/clrbootcount.sh
Now lets modify it:
Code:
adb shell
mount -o remount,rw /dev/block/mmcblk0p5 /system
echo "echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq" >> /system/bin/clrbootcount.sh
adb reboot
Check to see if the process was succesfull by typing this on cmd:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb shell
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
To return back to stock file, restore the file you backed up by pushing it back or use:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb shell
mount -o remount,rw /dev/block/mmcblk0p5 /system
sed -i '/echo/d' /system/bin/clrbootcount.sh
reboot
Click to expand...
Click to collapse
If the output is 300000, then it worked and now your nook won't go all the way to 800mhz, if you want to limit it to 600mhz, just change 300000 to 600000.
Backup bookmarks and annotations (Haven't tried it yet)
Bookmarks and annotations are saved in /data/data/com.bn.nook.reader.activities/databases/
To backup them open CMD and type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb shell
mount -o remount,rw /dev/block/mmcblk0p5 /system
exit
adb pull /data/data/com.bn.nook.reader.activities/databases/ /bookmarks
To restore them after a reset open CMD and type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb shell
mount -o remount,rw /dev/block/mmcblk0p5 /system
exit
adb push /bookmarks /data/data/com.bn.nook.reader.activities/databases/
Enable non market app installs:
Download sqlite3 (http://www.sqlite.org/sqlite-shell-win32-x86-3070900.zip) and extract it on C:/android-sdk-windows/platform-tools
Open cmd and type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb shell
mount -o rw,remount -t ext2 /dev/block/mmcblk0p5 /system
exit
adb pull /data/data/com.android.providers.settings/databases/settings.db settings.db
sqlite3 settings.db "update secure set value=1 where name='install_non_market_apps';"
adb push settings.db /data/data/com.android.providers.settings/databases/settings.db
Installing XorZone's B&N button modifier (Jars for 1.1, for other system versions check thread)(as I call it)
Download the jars (http://forum.xda-developers.com/attachment.php?attachmentid=781948&d=1321243370) and NookTouchTools (http://forum.xda-developers.com/attachment.php?attachmentid=750222&d=1318646585) and extract the zips on C:/android-sdk-windows/platform-tools. (Thread: http://forum.xda-developers.com/showthread.php?t=1289894)
Then backup the original jars onto the SD-card.
Open CMD and type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb shell
mount -o remount,rw /dev/block/mmcblk0p5 /system
cp -p /system/framework/android.policy.jar /sdcard
cp -p /system/framework/services.jar /sdcard
exit
Then let’s push the new ones in place and install NookTouchTools:
Code:
adb push android.policy.jar /system/framework/
adb push services.jar /system/framework/
adb install NookTouchTools-1.0b2.apk
This can also be done by Nooktouchtools, but this is a manual thread, so now we will delete calvick-cache and fix permissions:
Code:
adb shell
mount -o rw,remount -t ext2 /dev/block/mmcblk0p5 /system
chown root.root /system/framework/*
chmod 644 /system/framework/*
rm -R /data/dalvik-cache/*
reboot
Now open NookTouchTools and modify settings as you wish.
Change the powered off screen image
First, let’s make a copy of the original apk.
Open CMD and type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb pull /system/framework/framework-res.apk
You will find this file on C:/android-sdk-windows/platform-tools.
Make a copy of the file and open it with 7zip (download it if you don’t have it http://www.7-zip.org/).
Look for and open res\drawable-mdpi\
Search for cold_boot_screen.png and replace it for whatever 800x600 image you want.
Search for cold_battery_low_boot_screen.png and again replace it for whatever 800x600 image you want.
Save the modified apk on C:/android-sdk-windows/platform-tools
Then we have to push the new file and fix permissions.
Code:
adb shell
mount -o remount,rw -t ext2 /dev/block/mmcblk0p5 /system
exit
adb push framework-res.apk /system/framework/
adb shell
chown root.root /system/framework/*
chmod 644 /system/framework/*
rm -R /data/dalvik-cache/*
reboot
If you have problems pushing the framework-res.apk because the NST reboots, or hangs, use this zip (http://nooter.googlecode.com/files/RestoreFramework.zip) in conjunction with CWM (http://forum.xda-developers.com/attachment.php?attachmentid=806435&d=1323121399). (Keep reading)
You must:
Open the zip and drop your original or modifyed framework-res.apk in /system/framework, inside the zip.
Copy it to the SD card where you have burnt CWM and flash it through it.
If you see any strange behavior restore your backed up copy.
On this post, there are some nice pictures to use, http://forum.xda-developers.com/showpost.php?p=17822468&postcount=9, I modified them a bit, making them 16 bit grayscale and 800x600, see attachments..
Blocking OTA updates:
To prevent future automatic updating and unrooting you can block OTA updates.
Open CMD and type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb pull /data/data/com.bn.devicemanager/databases/devicemanager.db devicemanager.db
sqlite3 devicemanager.db
sqlite> update registry set value='manual' where name='com.bn.device.fota.mode';
sqlite> .q
adb push devicemanager.db /data/data/com.bn.devicemanager/databases/devicemanager.db
adb reboot
Installing new fonts for your nook
This first method works for Opera mini, for example, not for normal apps.
The second one for changing the official interface Font (testing)
The third one for changing the Fonts on the official reader app (testing)
1º method
First open CMD and make a copy of your fonts:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb shell
su
mount -o remount,rw /dev/block/mmcblk0p5 /system
adb pull /system/fonts
exit
Then add the new fonts.
Code:
adb push thenewfont /system/fonts
adb shell
su
chmod 4755 /system/fonts/*
2º method
3º method
Installing Gapps (+launcher, etc)
Market FULLY functional, My apps tab working and updating correctly, proof: http://forum.xda-developers.com/showpost.php?p=19602755&postcount=76
PC android market webpage working, proof:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
dark_hawk's exprience.
My experience.
New packages, deleted all the unneeded, apks, not needed libraries, jars, etc.
You have four options:
Minimal Touch (Core Gapps (http://bit.ly/rQ3YNn))
Minimal Touch + NookColorTools (http://bit.ly/vUwXeb)
Minimal Touch + Extras (Core Gapps + Launcher + theme + Button savior + NookColorTools(http://bit.ly/skgHhe))
Everything is functional, Gmail, Gtalk, Market.
Instructions:
For this process to work, you will need to install busybox, so search for Setting up root access on NST through adb and installing busybox and go directly to installing busybox if you come from another method of installing Gapps.
Download Minimal Touch + Extras if you haven't got a launcher installed, and extract it on the C:/android-sdk-windows/platform-tools (root)
Download Minimal Touch if you already have a launcher installed, and extract it on the C:/android-sdk-windows/platform-tools (root)
First, make a backup of the files we will modify:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb shell
su
mount -o remount,rw /dev/block/mmcblk0p5 /system
adb pull /system/framework/framework.jar
adb pull /data/system/packages.xml
adb pull /system/build.prop
exit
exit
Second, lets start with the install process.
Open CMD and type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb shell
su
mount -o remount,rw /dev/block/mmcblk0p5 /system
exit
exit
adb push data /data
adb push system /system
If the NST reboots before finishing the process, it may happen, start again where you left it.
Now lets fix permissions and ownership.
Code:
adb shell
su
mount -o remount,rw /dev/block/mmcblk0p5 /system
chown system.system /data/app/*
chmod 644 /data/app/*
chmod 644 /system/app/*
chmod 644 /system/etc/permissions/*
chmod 644 /system/framework/*
chmod 644 /system/lib/*.so
reboot
When the NST reboots select adw launcher as your predefined launcher (If you haven't already), log in on YouTube (click settings, my channel) and log in the Gmail account you used on YouTube, both accounts must be the same.
It will fail to sync and force close.
Open Cmd and type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb shell
su
mount -o remount,rw /dev/block/mmcblk0p5 /system
sed -i '/uid.system/,/perms/{/uid.system/b;/perms/b;d}' /data/system/packages.xml
reboot
Gmail should already work and sync.
Open Cmd and type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb shell
su
mount -o remount,rw /dev/block/mmcblk0p5 /system
echo "ro.config.nocheckin=no" >> /system/build.prop
reboot
Let android fully load.
Open Market, it will try to connect, if it can't retry until it does (it will), if it doesn’t, you haven’t got the Wi-Fi on .
Market should be fully functional now.
After this, manually by deleting it and its data, or through your launcher, or through Nook Color Tools, you can unistall YouTube.apk, it is no longer needed, and autostarts everytime wasting resources.
Now lets make protected apps show in market
Open CMD and type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb shell
su
mount -o remount,rw /dev/block/mmcblk0p5 /system
sed -i 's/^.*ro.build.fingerprint.*$/ro\.build\.fingerprint=verizon\/voles\/sholes\/sholes:2\.1-update1\/ESE81\/29593:user\/release-keys/' /system/build.prop
reboot
Protected apps wont appear inmediatly, the market must check your new fingerprint and that happens at midnight, so you can wait 1 day or:
Check you have correctly changed the fingerprint, change the time to 23:50 on your Nook Touch and wait till "midnight" wait a bit more, and protected apps should appear.
Totally uninstall Gapps (my repack), unrooting, erasing and restoringTesting
Open CMD and type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb shell
su
mount -o remount,rw /dev/block/mmcblk0p5 /system
adb push /system/framework/framework.jar
adb push /data/system/packages.xml
adb push /system/build.prop
rm /data/app/YouTube.apk
rm -R /data/data/com.google.android.youtube
rm /system/lib/libgtalk_jni.so
rm /system/lib/libinterstitial.so
rm /system/framwork/com.google.android.gtalkservice.jar
rm /system/etc/permissions/com.google.android.datamessaging.xml
rm /system/etc/permissions/com.google.android.gtalkservice.xml
rm /system/app/Gmail.apk
rm -R /data/data/com.google.android.gm
rm /system/app/GmailProvider.apk
rm -R /data/data/com.google.android.providers.gmail
rm /system/app/GoogleApps.apk
rm -R /data/data/com.google.android.googleapps
rm /system/app/GoogleCheckin.apk
rm -R /data/data/com.google.android.server.checkin
rm /system/app/GoogleSubscribedFeedsProvider.apk
rm -R /data/data/com.google.android.providers.subscribedfeeds
rm /sytem/app/gtalkservice.apk
rm -R /data/data/com.google.android.apps.gtalkservice
rm /system/app/Talk.apk
rm -R /data/data/com.google.android.talk
rm /sytem/app/TalkProvider.apk
rm -R /data/data/com.google.android.providers.talk
rm /sytem/app/Vending.apk
rm -R /data/data/com.android.vending
reboot
Unrooting:
Open CMD and type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb shell
mount -o remount,rw /dev/block/mmcblk0p5 /system
rm -R /sytem/app/Superuser.apk
rm -R /data/app/Superuser.apk
rm -R /sytem/bin/su
rm -R /sytem/xbin
reboot
Erasing and restoring:
After this, if what you want is to have a clean nook and you didnt make a backup before rooting you have to:
Use nookRestore to restore /system (http://forum.xda-developers.com/showthread.php?t=1289233), or using adb do:
Open CMD and type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb shell
echo -n -e "\x08\x00\x00\x00" > /rom/devconf/BootCnt
reboot
Use on settings, device, Erase and Deregistered to wipe /data
(If it doesn’t let you, force it shutting down your nook, then starting it up, and when the screen flickers press right and left bottom buttons, hold for 5+ seconds).
Update to 1.1 (http://www.barnesandnoble.com/u/Software-Updates-NOOK-Simple-Touch/379003175/)
Interesting or useful specific apps or hacks for Nook Simple Touch
Calendar Pad (https://market.android.com/details?id=jp.ne.gate.calpad)
Book button menu (http://forum.xda-developers.com/showthread.php?t=1280509)
Button Savior (http://forum.xda-developers.com/showpost.php?p=9669486&postcount=1)
Button Savior eink friendly mod (http://forum.xda-developers.com/showthread.php?t=1250278)
Simplistic countdown timer (http://forum.xda-developers.com/showthread.php?t=1290900)
Tweaking the screen refresh (http://forum.xda-developers.com/showthread.php?t=1241419)
Orientation Switch [Recommended, use in conjunction with XorZone's B&N button modifier] (http://forum.xda-developers.com/showthread.php?t=1283176)
ADW launcher + Minimalist_Black - ADW Theme, nice launcher + awesome theme pack with awesome icons for eink (https://market.android.com/details?id=org.adw.launcher + https://market.android.com/details?...iwiY29tLmRhdmlkMTE3MS5taW5pbWFsaXN0YmxhY2siXQ..)
Minimalistic text, it’s a really nice free widget app, from which you can make things like this http://attachments.xda-developers.com/attachment.php?attachmentid=781918&d=1321239931, you will need version 2.6.2 or 2.6.3 here you have the 2.6.2 (http://www.megaupload.com/?d=UO7PD9BU) and the market link for the latest (https://market.android.com/details?id=de.devmil.minimaltext)
AdbWireless widget, to control when you want adb over Wi-Fi on and off with the Wi-Fi uramdisc, or to add the possibility to the usb uramdisc (https://market.android.com/details?id=siir.es.adbWireless)
Making the manual process LESS PAINFULL
To not have to open each time CMD, and go typing cd C/.... and connect yourNSTip make a small batch file like this:
Open notepad type:
Code:
@echo off
cd C:/android-sdk-windows/platform-tools
adb kill-server
adb connect yourNSTip
cmd
Save the file as .bat, or change the extension when saved.
Now each time you reboot in the proces, instead of opening CMD and typing cd ..... and adb connect.... just open this file and star copying command right away
eded333 said:
Change the powered off screen image
First, let’s make a copy of the original apk.
Open CMD and type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb pull /system/framework/framework-res.apk
You will find this file on C:/android-sdk-windows/platform-tools.
Make a copy of the file and open it with 7zip (download it if you don’t have it http://www.7-zip.org/).
Look for and open res\drawable-mdpi\
Search for cold_boot_screen.png and replace it for whatever 800x600 image you want.
Search for cold_battery_low_boot_screen.png and again replace it for whatever 800x600 image you want.
Save the modified apk on C:/android-sdk-windows/platform-tools
Then we have to push the new file.
Code:
adb shell
mount -o remount,rw -t ext2 /dev/block/mmcblk0p5 /system
exit
adb push framework-res.apk /system/framework/
adb reboot
If you see any strange behavior restore your backed up copy.
On this post, there are some nice pictures to use, http://forum.xda-developers.com/showpost.php?p=17822468&postcount=9, I modified them a bit, making them smaller in size, 16 bit grayscale and 800x600 here is the link http://www.megaupload.com/?d=PD94ZJK9.
Click to expand...
Click to collapse
So, I did all that, but I'm stuck at the loading screen (the one with 5 dots doing stuff).
Any ideas?
I've also tried to restore the orig framework-res.apk, but nothing.
Also changed permissions back to 644.
ace7196 said:
So, I did all that, but I'm stuck at the loading screen (the one with 5 dots doing stuff).
Any ideas?
I've also tried to restore the orig framework-res.apk, but nothing.
Also changed permissions back to 644.
Click to expand...
Click to collapse
I hate you..... (not really )
Read the first page:
"Please, dont post on this thread, continue to use [NST]MinimalTouch 1.1beta5"
Anyway
It works, I've modded it myself, try to fix the the permissions:
chmod 644 /system/framework/*
What images did you use?
Please lets continue this conversation on: http://forum.xda-developers.com/showthread.php?t=1346748
Or through PM, id like to use this thread only to add more tutos, or correct the ones I allready have.
----------------------------------------------------------------------------
Edit,
didnt read you allready did that.
So after restoring the original file, you still have problems?
Try to force shut it down, and start it again, or try to erase dalvik cache, and reboot (if you can acces adb, if not I'll make you an CWM zip)
rm -rf /data/dalvik-cache/*
Skip OOBE:
On the first screen that appears on the NST without tapping any button.
1.Hold the right top button and move your finger from left to right on the top of the screen.
2.The factory button will appear at the bottom right of the screen, tap it.
3.Hold again the right top button and tap the right bottom part of the screen, where the factory button appeared
4.A button labeled skip oobe will appear, tap it, your done
Redid Gapps packages and updated links.
eded333 said:
Improve battery life (testing)
As the Nook Touch hasn't got a overclocking kernel, and isn't near, as it isn't convenient to change or modify the cpu governor (it works in an unusual way), as I don't like too many apks bloating my nook, there is something that seems to be working for me, underclocking it manually of course .
The Nook has 3 stock frequencys, 300, 600, 800, and a deepsleep state.
As this small monster is just an ereader, and the refresh rates of eink are painfully slow I didn't find the need for it going all the way to 800mhz I did this small trick:
Make a backup up clrbootcount.sh.
Open CMD and type:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb pull /system/bin/clrbootcount.sh
Now lets modify it:
Code:
adb shell
mount -o remount,rw /dev/block/mmcblk0p5 /system
echo "echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq" >> /system/bin/clrbootcount.sh
adb reboot
Check to see if the process was succesfull by typing this on cmd:
Code:
cd C:/android-sdk-windows/platform-tools
adb connect yourNSTip
adb shell
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
To return back to stock file, restore the file you backed up by pushing it back or use:
If the output is 300000, then it worked and now your nook won't go all the way to 800mhz, if you want to limit it to 600mhz, just change 300000 to 600000.
Click to expand...
Click to collapse
Have you done any actual benchmarkings on this? Usually trickery like this actually make degrades battery performance because the slower the computations is done the less time is spent in deep sleep. Most of the time the device should be in deep sleep but whenever something need to be done, it should be done as quickly as is possible.
Anyway I like your guides. I just got everything up and running exactly as I want without a bunch of crappy useless apps installed. Market as well. Something the automated methods doesn't handle at all well
Fulkerson said:
Have you done any actual benchmarkings on this? Usually trickery like this actually make degrades battery performance because the slower the computations is done the less time is spent in deep sleep. Most of the time the device should be in deep sleep but whenever something need to be done, it should be done as quickly as is possible.
Anyway I like your guides. I just got everything up and running exactly as I want without a bunch of crappy useless apps installed. Market as well. Something the automated methods doesn't handle at all well
Click to expand...
Click to collapse
¬¬ please dont reply on this thread.... do it on the thread which I point out on the first post.
I did some testing, and it did last longer when being used, it lasted the same on sleep, I never turn it off, but didnt really do any real benchmarking so its just my impression.
I'm glad this manual tutos are still being used and found usefull ^^

[Q] Linux user with some questions about root methods.

Okay folks, I am a rooting newb where it comes to this wonderous device known as the Optimus G, and I need some questions answered.
First lemme fill you all in on some details where the computer I might be using to root my Optimus G is concerned. I run Zorin OS 6.1 64bit Core edition (yes, Linux) and that obviously that begs my first question, of any of the rooting methods mentioned in the development part of this forum, are there any that will work with Linux? And if so which ones or is there some kind of special magic I'll need to cast or some kind of coding wizardry level I'll have to obtain in order to be able to root my Optimus G?
Second, to fill you in on the phone, yes I have updated to ZV9 so if that borks me if you could please let me know?
Third, and Fourth actually are my concerns over being able to fix whatever possible brick type damage might be done. 3)How stable are the root/unlock methods, meaning there would be no way to reverse them? Of course I mean outside of accepting an OTA update which I already know better than to do on a custom ROM (had a Samsung Epic 4g before this so yeah I know how that goes.)
and 4)Is there an LGNPST (sp?) version for Linux or will I have to figure out a wa to maybe run it on WINE or something along those lines?
I'd ask about ROMS but I know everybody has an opinion of their own and I don't so much mind the stock one, though I might get the debloated version and see what else I can do with that.
Thanks in advance everybody for any help you all can give.
1) You can root through linux, although I don't know about which distros. I did it on ubuntu, using one of the links in the link in my sig.
2) AFAIK, you have to be on zv7/8 to root or unlock. You will have to use LGNPST to go back to one of those, and as far as I've ever heard that is a windows program only.
3) Both the root and unlock methods are reversible through whatever program you use to do it.
4) ???
You forgot profit!!!!
Sent from my LG-LS970 using xda premium
As long as you can attain a root shell and install ADB aka Android SDK, and as long as after that you can run ADB shell and then receive a prompt from your device you should be able to push the necessary files and then run the exploit and install the superuser binary there should be no issues. I actually took the windows root method, and used the commands in my Debian box and it worked very well. The only thing that I would be concerned with is weather not you can get a root shell in your specific version once that is attained, run ADB start-server as root then finish.
Basically I took this root method, and modded the script to fit linux.
(as noted from my post on the last page of that thread)
Preparation
ADB can be found either from the android sdk(tools only) or from the 'stuff' folder, in the archive below (i ran the one from the sdk)
Download this zip file, and extract the 'stuff' folder to a newly created 'root' folder on your Desktop
Open a terminal and cd to ~/Desktop/root
My adb location is coded into my $PATH variable so when I issue adb, it runs ~/android-sdk-linux/platform-tools/adb but you can either set up an alias (to the one included which would be alias adb=~/Desktop/root/stuff/adb if you follow the below extraction procedures or the one from the sdk which could be anywhere)
Before running the root I ran:
Code:
su -
adb start-server
exit
Then to test whether or not I had the correct version of adb, I ran:
Code:
adb shell
You should see your prompt change to that of the phone. if it displays any type of error message, please check your version of adb. to exit this prompt and continue with the root, simply type exit and press enter.
ROOT:
Paste the following into your terminal (which should now be in the ~/Desktop/root directory)
Code:
adb "wait-for-device"
adb push stuff/busybox /data/local/tmp/.
adb push stuff/su /data/local/tmp/.
adb push stuff/Superuser.apk /data/local/tmp/.
adb shell chmod 755 /data/local/tmp/busybox
adb restore stuff/fakebackup.ab
echo 'Select "Restore my data" on your phone!'
adb shell "while ! ln -s /data/local.prop /data/data/com.android.settings/a/file99; do :; done" > /dev/null
echo "Your phone will now reboot twice, DO NOT DISCONNECT USB!"
adb reboot
adb "wait-for-device"
adb shell "/data/local/tmp/busybox mount -o remount,rw /system && /data/local/tmp/busybox mv /data/local/tmp/su /system/xbin/su && /data/local/tmp/busybox mv /data/local/tmp/Superuser.apk /system/app/Superuser.apk && /data/local/tmp/busybox cp /data/local/tmp/busybox /system/xbin/busybox && chown 0.0 /system/xbin/su && chmod 06755 /system/xbin/su && chmod 655 /system/app/Superuser.apk && chmod 755 /system/xbin/busybox && rm /data/local.prop && reboot"
echo "Rooting Complete!"
echo "SuperSU should now be available in your applications drawer!"
Assimilated using the interface that interacts with the advanced internet.

The Android Shell

The Android Shell
A "shell" is a program that listens to keyboard input from a user and performs actions as directed by the user. Android devices come with a simple shell program. This shell program is mostly undocumented. Since many people are curious about it I thought I'd write up some documentation for it.
Currently this documentation is incomplete, sorry!
Common problems
The built-in shell has very limited error handling. When you type a command name incorrectly it will say "permission denied", even though the real problem is that it couldn't find the command:
$ dir
dir: permission denied <---- this is a misleading error message, should say 'dir: not found'
$ ls
... listing of current directory
The PATH variable
The Android shell will run any program it finds in its PATH. The PATH is a colon (':') seperated list of directories. You can find out what your shell's PATH is set to by using the built-in echo command:
$ echo $PATH
/data/local/bin:/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
Depending upon your shell, you may see a different result.
Built in Commands
Every shell has a few built-in commands. Some common built-in commands are:
echo -- prints text to stdout.
set -- sets shell variables
export -- makes shell variables available to command-line programs
cd -- change the current directory.
pwd -- print name of the current directory.
Commands
To find out what commands you have available to you, use the "ls" command on each of the directories in the PATH variable.
Finding documentation for the Android commands.
Many of the Android commands are based on standard Linux (or bsd) commands. If you're curious about a command, you can sometimes learn how it works by using the "man" command on a desktop Linux or OSX (Apple Macintosh) computer. The Linux or OSX version of the command may be different in details, but much of the documentation will still apply to the Android version of the command.
Another source of documentation for people without a Linux or OSX machine handy is to use a web browser and use a web search engine to search for the text: "man Linux command-name".
List of commands
The following is a list of the commands that are present on a Nexus S phone running an Android 2.3.3 "user-debug" build. Many of these commands are not present on a "user" phone. (They are missing from a "user" phone because they are specific to developing or debugging the Android operating system.)
$ ls /data/local/bin
/data/local/bin: No such file or directory
Notice that by default there is no /data/local/bin directory. You can create this directory using the "mkdir" command if you like.
$ ls /sbin
opendir failed, Permission denied
The /sbin directory exists, but you don't have permission to access it. You need root access. If you have a developer phone, or otherwise have root access to your phone you can see what's in this directory.
$ su
# ls /sbin
ueventd
adbd
# exit
$
Notice that the shell prompt changes from a '$' to a '#' to indicate that you have root access.
Notice also that neither of the /sbin commands are useful to the shell -- the adb and ueventd files are 'daemon' programs used to implement the Android Debugger "adb" program that is used by developers.
$ ls /vendor/bin
gpsd
pvrsrvinit
Vendor/bin is where device vendors can put device-specific executables. These files are from a Nexus S.
$ ls /system/sbin
/system/sbin: No such file or directory
This directory does not exist on a Nexus S.
$ ls /system/bin
am
am is the Android Activity Manager. It's used to start and stop Android activities (e.g. applications) from the command line. Type am by itself to get a list of options.
amix
aplay
Command line audio file player.
app_process
applypatch
Used to apply patches to android files.
arec
Command line audio recorder.
audioloop
bluetoothd
BlueTooth daemon
bmgr
Backup manager - type command by itself to get documentation.
bootanimation
Draws the boot animation. You may have to reset your phone to get out of this.
brcm_patchram_plus
bugreport
cat
Copy the contents of a file to standard output.
chmod
Change the mode of a file (e.g. whether it can be read or written.)
chown
Change the owner of a file.
cmp
Compare two files byte-by-byte
dalvikvm
The dalvik virtual machine. (Used to run Android applications.)
date
Prints the current date and time
dbus-daemon
dd
Convert and copy a file. By default copies standard in to standard out.
debuggerd
dexopt
df
Shows how much space is free on different file systems on your device.
dhcpcd
dmesg
dnsmasq
dumpstate
dumpsys
dvz
fsck_msdos
gdbserver
getevent
getprop
gzip
hciattach
hd
id
ifconfig
Shows the current configuration of network interfaces (IP, MAC address etc)
iftop
Shows the current processes using the network interfaces (top, but for networks)
ime
input
insmod
installd
ioctl
ionice
iptables
Manage the firewall
keystore
keystore_cli
kill
Send signals to processes.
linker
ln
Used to set up a file system link.
log
logcat
Prints the Android runtime log.
logwrapper
ls
Lists files.
lsmod
lsof
make_ext4fs
mediaserver
mkdir
Make a directory.
monkey
A program that sends random events, used to test applications. (Like having a monkey playing with the device.)
mount
mtpd
mv
Move a file from one directory to another. (Only on the same file system. Use "cat a > b" to copy a file between file systems.
nandread
ndc
netcfg
netd
netstat
newfs_msdos
notify
omx_tests
pand
ping
pm
pppd
printenv
ps
List active processes.
qemu-props
qemud
racoon
radiooptions
reboot
Reboot the device.
record
renice
rild
rm
Remove a file.
rmdir
Remove a directory.
rmmod
route
rtp_test
run-as
schedtest
schedtop
sdcard
sdptool
sendevent
service
servicemanager
setconsole
setprop
setup_fs
sh
showlease
sleep
smd
stagefright
start
Starts the Android runtime.
stop
Stops the Android runtime.
surfaceflinger
svc
sync
system_server
tc
testid3
toolbox
top
Shows which processes are currently using the most CPU time.
umount
uptime
Prints how long your device has been running since it was last booted.
vdc
vmstat
vold
watchprops
wipe
wpa_cli
wpa_supplicant
$ ls /system/xbin
add-property-tag
btool
check-lost+found
dexdump
dhdutil
hcidump
latencytop
librank
opcontrol
oprofiled
procmem
procrank
rawbu
scp
Secure copy program. (Used to copy files over the network.)
showmap
showslab
sqlite3
Used to administer SQLite databases.
strace
System trace command - use to see what system calls a program makes.
su
Start a shell with root privileges.
Versions of the Android Shell
Android 1.0 used a shell that had no tab completion or history editing.
Android 2.3 added history editing. You can for example use the up/down arrows to edit previous commands.

Categories

Resources