[Q&A] Install or Mount (IOM) | Create chroot on device in minutes - Android Software Development

Project thread created..
http://forum.xda-developers.com/showthread.php?t=2627255
install-or-mount-v0.8-gui.zip
Use this thread for help

Device List
Change Log

Sony Xperia P - CM11 4.4.2
Error with
Code:
handle_error mke2fs -qF -t $fs_type $IMGLOC/$IMGNAME
Needed another command.

ONDR4SH3K said:
Sony Xperia P - CM11 4.4.2
Error with
Code:
handle_error mke2fs -qF -t $fs_type $IMGLOC/$IMGNAME
Needed another command.
Click to expand...
Click to collapse
I figured that was gonna be an issue.
There are so many variants when it comes to device / busybox, I tried to get around that by including my own binary but fail on my part i guess...
Anyways.
Fix this line
Code:
LINE: 310 handle_error mke2fs -qF -t $fs_type $IMGLOC/$IMGNAME
to
Code:
handle_error mk2fs.ext2 $IMGLOC/$IMGNAME

userdelroot said:
I figured that was gonna be an issue.
There are so many variants when it comes to device / busybox, I tried to get around that by including my own binary but fail on my part i guess...
Anyways.
Fix this line
Code:
LINE: 310 handle_error mke2fs -qF -t $fs_type $IMGLOC/$IMGNAME
to
Code:
handle_error mk2fs.ext2 $IMGLOC/$IMGNAME
Click to expand...
Click to collapse
I rewrite with mke2fs -F $IMGLOC/$IMGNAME this working well.
But another problem with debootstrap. See attachment. So it's end of testing, isn't it?

ONDR4SH3K said:
I rewrite with mke2fs -F $IMGLOC/$IMGNAME this working well.
But another problem with debootstrap. See attachment. So it's end of testing, isn't it?
Click to expand...
Click to collapse
hmm...
I had that error initially also and I corrected it, probably should of documented what I fixed...
in the terminal type
uname
Is that a valid command?
change install-or-mount
Code:
LINE :333 handle_error debootstrap --no-check-gpg --extractor=ar --arch=armhf --foreign $DIST $MOUNT $MIRROR
to
Code:
handle_error debootstrap --no-check-gpg --extractor=ar --arch armhf --foreign $DIST $MOUNT $MIRROR

userdelroot said:
hmm...
I had that error initially also and I corrected it, probably should of documented what I fixed...
in the terminal type
uname
Is that a valid command?
Click to expand...
Click to collapse
Yes, it print Linux. I try another deboostrap. You use VERSION='1.0.40~ubuntu0.4'. So I find new one.
EDIT: New debootstrap with the same error.

ONDR4SH3K said:
Yes, it print Linux. I try another deboostrap. You use VERSION='1.0.40~ubuntu0.4'. So I find new one.
EDIT: New debootstrap with the same error.
Click to expand...
Click to collapse
Yea, it has to do with the line above I believe.

userdelroot said:
hmm...
I had that error initially also and I corrected it, probably should of documented what I fixed...
in the terminal type
uname
Is that a valid command?
change install-or-mount
Code:
LINE :333 handle_error debootstrap --no-check-gpg --extractor=ar --arch=armhf --foreign $DIST $MOUNT $MIRROR
to
Code:
handle_error debootstrap --no-check-gpg --extractor=ar --arch armhf --foreign $DIST $MOUNT $MIRROR
Click to expand...
Click to collapse
Sry, not working, but I deleted line with checking architecture and I got new error. See attachment.
EDIT:
I use:
sh install-or-mount -i -n linux.img -m /data/local/chroot -l /data/local -o precise -0
Rewrited mk2fs line in install-or-mount file to: mke2fs -F $IMGLOC/$IMGNAME
Deleted if [ -z "$ARCH" ] || [ -z "$HOST_OS" ]; then error 1 WHATARCH "Couldn't work out current architecture" fi line in deboostrap file
I think if I deleted this line, chroot not mounted correctly and bootstrap can't continue. So we need figure out, how fix architecture error.
I found this: http://uyirpodiru.blogspot.cz/2012/08/debootstrap-error-e-couldnt-work-out.html

ONDR4SH3K said:
Sry, not working, but I deleted line with checking architecture and I got new error. See attachment.
EDIT:
I use:
sh install-or-mount -i -n linux.img -m /data/local/chroot -l /data/local -o precise -0
Rewrited mk2fs line in install-or-mount file to: mke2fs -F $IMGLOC/$IMGNAME
Deleted if [ -z "$ARCH" ] || [ -z "$HOST_OS" ]; then error 1 WHATARCH "Couldn't work out current architecture" fi line in deboostrap file
I think if I deleted this line, chroot not mounted correctly and bootstrap can't continue. So we need figure out, how fix architecture error.
I found this: http://uyirpodiru.blogspot.cz/2012/08/debootstrap-error-e-couldnt-work-out.html
Click to expand...
Click to collapse
All the errors you are getting I did get at one point, I forgot how I fixed them, cause I was working on another project..
Ill do some testing, as I am working on the code right now.
Ill post when I find a solution to those..
Also before continuing I wanted to just let you know.
the debootstrap requires 'ar' archiver which I do not believe comes with CM.
busybox ar
That is why I included my own version.
I may have some work arounds tho so give me a few..

userdelroot said:
All the errors you are getting I did get at one point, I forgot how I fixed them, cause I was working on another project..
Ill do some testing, as I am working on the code right now.
Ill post when I find a solution to those..
Also before continuing I wanted to just let you know.
the debootstrap requires 'ar' archiver which I do not believe comes with CM.
busybox ar
That is why I included my own version.
I may have some work arounds tho so give me a few..
Click to expand...
Click to collapse
New vesion 0.2 in attachment. Is on the way.
EDIT: I put busybox from /sbin to /system/xbin and it looks like deboostrap working, but you have error with Release. Attachment no.3.
Thanks for helping.

is it normall ubuntu for desktop or Ubuntu phone version?

desktop

JFizDaWiz said:
desktop
Click to expand...
Click to collapse
I'm confused
Does touch work? Or do we need OTG cables

milestoneman said:
I'm confused
Does touch work? Or do we need OTG cables
Click to expand...
Click to collapse
You need root, and an android device.
No OTG cables..
It build's a chroot image on the device, with android running in the background.
You can run X windows (only LXDE currently because it is lightwieght) on the device and then vnc into it from anywhere, even a desktop...
There are other tools out there for this however, they require you to download the images. Which are usually between 1gig - 4gigs.
Instead of downloading the images, this creates the image and only downloads approximately 200megs for the packages.

Thanks for the explanation, sounds great
Sent from my Nexus 7 using Tapatalk

ONDR4SH3K said:
New vesion 0.2 in attachment. Is on the way.
EDIT: I put busybox from /sbin to /system/xbin and it looks like deboostrap working, but you have error with Release. Attachment no.3.
Thanks for helping.
Click to expand...
Click to collapse
Yea, crap, that was my bad, I should check where the system busybox is installed. It should default to /system/xbin
But some roms I guess put it in /system/sbin ? Possibly a typo on the rom developers part? LOL
Anyways, I will add code to correct this.
EDIT: How did you fix image 2?, as it should stop at the error in image type every time.
At any rate, image 2 error is because it can't find sh. in the install-or-mount/bin directory type this..
ls -l bin/
Make sure sh is symlinked to /system/bin/sh or /system/xbin/busybox if not that is causing the error in picture 2
it should look like this...
ls -l bin/
sh sh -> /system/xbin/busybox
If you don't see that do the following:
cd /data/local/install-or-mount
busybox touch bin-configs/sh
rm -rf .bin-configs-done
if you have something like that it should be ok, however to be safe since you moved you your busybox
from inside install-or-mount
rm -rf .bin-configs-done
Yes there is a DOT in front of bin-configs-done

I receive a permission denied error with debootstrap as well
Edit: crap I didn't see all the replies up there
Sent from my GT-N7105 using Tapatalk

Will it works on my armv7 single core tablet?

I fix it other way:
mount -o remount,rw /system
cp busybox /sbin /system/xbin
mount -o remount,ro /system
I hope that commands are fine.
I has no solution for fetch Release error, yet. I tried rewrite URL, but unsussesful.
Its in scripts folder line mirror_styles Release
Sent from my Xperia P using xda app-developers app
---------- Post added at 01:06 AM ---------- Previous post was at 01:00 AM ----------
Already testing on armv7 device dual core. OP must fix a few errors but you can try it.
Sent from my Xperia P using xda app-developers app

Related

HTC hero Owner running Linux OS

Looking for assitance installing HTC hero drivers and Devtool ( adb shell ) on a Linux OS based laptop
I have Jolicloud ( Ubuntu base OS for netbooks ) (sudo commands)
if someone could provide a guide or assitance..
The drivers are there already
as for dev tools that pretty easy
download the sdk, extract it to a folder in ~/bin, run
Code:
cd ~/bin
chown +x *
then edit ~/.bashrc and add the line PATH="$HOME/bin:$PATH"
should do it for ya, now you just run adb by putting adb in the terminal
Vrekk said:
The drivers are there already
as for dev tools that pretty easy
download the sdk, extract it to a folder in ~/bin, run
Code:
cd ~/bin
chown +x *
then edit ~/.bashrc and add the line PATH="$HOME/bin:$PATH"
should do it for ya, now you just run adb by putting adb in the terminal
Click to expand...
Click to collapse
thanks but i am having problems moving it to the bin folder ..gives permission denied
whast the line comand to extract file to bin folder?
never mind i got it
sudo mv android-sdk-linux_86
rgildoss said:
whast the line comand to extract file to bin folder?
Click to expand...
Click to collapse
Sorry I was cleaning up. Make sure you are extracting it to the bin folder in your home, NOT THE ROOT ONE. If the folder doesn't exist create it
I realized that the first thing I told you to do was wrong, we want the stuff in the tools folder NOT everthing in the sdk, cd into the folder the android sdk is in and run this: (skip the chmod +x step above, I moved it to down here
command:
Code:
tar -xzf android-sdk_r05-linux_86.tgz
chmod +x android-sdk-linux_86/tools/*
cd -r android-sdk-linux_86/tools/* ~/bin
rm -r android-sdk-linux_86 'this will remove anything you don't need Optional
If you get an error saying that ~/bin dosn't exist, run
Code:
mkdir ~/bin
then edit the .bashrc like described in my first post
EDIT:If should not have needed sudo if you moved it to /home/rgildoss/bin only if you moved it to /bin should it have caused problems. You don't want it in /bin
that cd -r gives me an error
bash: cd -r: invalid option
cd: usage: cd [-L|-P]..[dir]
Oops! typo! try cp no cd lol
Vrekk said:
Oops! typo! try cp no cd lol
Click to expand...
Click to collapse
LOL
okay that worked
one last thing
chown +x * also gives error
chown: invalid user: `+x'
also tried
chown +x*
chown: missing operand after `+x*'
It shouldn't have to be in bin unless you're going to need access to the executable from anywhere in the directory tree. I run mine out of ~/android/ and it's fine. As far as permissions go, chown changes the owner of the file, chmod changes the permissions. If you're the only user on the machine, change the permissions with the octal: chmod 777 path/to/files/*
rgildoss said:
LOL
okay that worked
one last thing
chown +x * also gives error
chown: invalid user: `+x'
also tried
chown +x*
chown: missing operand after `+x*'
Click to expand...
Click to collapse
damn I really off my game tonight, should be chmod not chown
okay everything is good except for the last step:
then edit ~/.bashrc and add the line PATH="$HOME/bin:$PATH"
how do i edit this ? and were is the file at?
im sorry about all the question, its been over 4 years sisnce i used linux ( ubuntu ) and i wasnt very good at then either...lol
HELP!
lol
EDIT: my files are in [email protected]:/home/rico/bin#
rgildoss said:
okay everything is good except for the last step:
then edit ~/.bashrc and add the line PATH="$HOME/bin:$PATH"
how do i edit this ? and were is the file at?
im sorry about all the question, its been over 4 years sisnce i used linux ( ubuntu ) and i wasnt very good at then either...lol
HELP!
lol
EDIT: my files are in root@mini:/home/rico/bin#
Click to expand...
Click to collapse
One thing, why are you loged in as root?
and nano ~/.bashrc should do it
or gedit ~.bashrc if you like gui better
rgildoss said:
okay everything is good except for the last step:
then edit ~/.bashrc and add the line PATH="$HOME/bin:$PATH"
how do i edit this ? and were is the file at?
Click to expand...
Click to collapse
A user specific .bashrc doesn't exist by default in most Ubuntu based distros. Create it with...
Code:
touch ~/.bashrc
...and add the path statement. There should also be a systemwide bashrd located at /etc/bash.bashrc
Vrekk said:
One thing, why are you loged in as root?
and nano ~/.bashrc should do it
or gedit ~.bashrc if you like gui better
Click to expand...
Click to collapse
force of habit from old days ....
rgildoss said:
thanks but i am having problems moving it to the bin folder ..gives permission denied
Click to expand...
Click to collapse
If you want to send to /bin or /usr/bin, you'll need superuser access:
Command is: sudo su
Then type your password.
What was recommended was creating a bin directory in your home directory. Then edit your .bashrc to include the new bin directory.
[email protected]:~$ adb devices
List of devices attached
???????????? no permissions
[email protected]:~$
did i do something wrong?
comintern said:
A user specific .bashrc doesn't exist by default in most Ubuntu based distros. Create it with...
Code:
touch ~/.bashrc
Click to expand...
Click to collapse
I forgot that, been so long sence the last time I booted up anything ubuntu based or even
rgildoss said:
force of habit from old days ....
Click to expand...
Click to collapse
did it work? You will need to reopen a terminal in order for it to use the new file, but then you should be able to use adb like any other linux command
EDIT: you answered my question before I posted it, nice
Hmm, I don't know what to do about that part, when ever I get an error like I can't get it to go away
rgildoss said:
[email protected]:~$ adb devices
List of devices attached
???????????? no permissions
[email protected]:~$
did i do something wrong?
Click to expand...
Click to collapse
1. Try adb kill-server first, then rerun the command.
2. If that doesn't work, run as superuser...see if that fixes it.
tkirton said:
1. Try adb kill-server first, then rerun the command.
2. If that doesn't work, run as superuser...see if that fixes it.
Click to expand...
Click to collapse
nope
wtf....
lol
[email protected]:~$ adb kill-server
[email protected]:~$ adb devices
* daemon not running. starting it now *
* daemon started successfully *
List of devices attached
???????????? no permissions
[email protected]:~$

Why 'adb remount' failed on a Rooted neuxs one

Hi,
I have rooted my Nexus one. I can do "'adb shell and then 'su' under the shell"
But on my MacOS Desktop, when I execute 'adb remount', it still said
$ adb remount
remount failed: Operation not permitted
Click to expand...
Click to collapse
Can anyone please help me resolve this?
Thank you.
[size=+4]DO *NOT* POST QUESTIONS IN THIS FORUM - only tips/info/etc.[/size]
Right at the top. Why does this have to be repeated on a daily basis?
Can you please move my thread to the right forum? I can't find a way to do it.
Anyhow, to answer you question... you "adb remount" is disabled in production releases... just rooting does not allow this.
You need a modified boot image where ro.secure=0 in default.props, instead of ro.secure=1. The ro.secure flag in the boot image indicates whether the root filesystem can be remounted as read/write... 0 indicated it can be... 1 indicated it cannot be.
If ro.secure=0, this is referred to as insecure boot.
Most custom ROMs have this by default... some rooted stock ROMs do not have this...
Will the Modified GRI40 (2.3.3 Gingerbread) ROM from this
http:// forum.xda-developers.com/showthread.php?t=968396
Does what I need? Thanks.
Or you can also use these commands to mount and unmount the system partition as writable:
Code:
mount -o remount,rw /dev/block/mtdblock3 /system
mount -o remount,ro /dev/block/mtdblock3 /system
Thank you. That seems to be an easier solution for me.
But after I did
$ adb shell
$ su
# mount -o remount,rw /dev/block/mtdblock3 /system
Click to expand...
Click to collapse
I go to another shell and i did
adb push sqlite3 /system
failed to copy 'sqlite3' to '/system/sqlite3': Read-only file system
$ adb push sqlite3 /system/bin
failed to copy 'sqlite3' to '/system/bin/sqlite3': Permission denied
Click to expand...
Click to collapse
It still does not let me push 'sqlite3' to /system or /system/bin
That is what I need.
Thank you for any more pointers.
hap497 said:
Thank you. That seems to be an easier solution for me.
But after I did
I go to another shell and i did
It still does not let me push 'sqlite3' to /system or /system/bin
That is what I need.
Thank you for any more pointers.
Click to expand...
Click to collapse
Don't try to combine adb commands with shell commands.
Copy/move/push the file to your sdcard first.
Then open a root shell, mount it as rw, then copy the file from your sdcard to the directory you want.
Thanks. but I get 'failed on '/sdcard/sqlite3' - Cross-device link'
$ su
# mount -o remount,rw /dev/block/mtdblock3 /system
# mv /sdcard/sqlite3 /system/
failed on '/sdcard/sqlite3' - Cross-device link
# ls -l /sdcard/sqlite3
----rwxr-x system sdcard_rw 24120 2010-10-16 22:04 sqlite3
Click to expand...
Click to collapse
and i have tried:
# mv /mnt/sdcard/sqlite3 /system/bin/
failed on '/mnt/sdcard/sqlite3' - Cross-device link
# ls -l /mnt/sdcard/sqlite3
----rwxr-x system sdcard_rw 24120 2010-10-16 22:04 sqlite3
Click to expand...
Click to collapse
I get the 'sqlite3' from SuperOneClickv1.7-ShortFuse.zip.
Wholly crap, don't use the mv command! Bad idea!!! mv does not move the data, it moves the hardlink to the data! Thank your lucky stars mv wouldn't let you do it.
Use cp instead. cp will actually copy the data to where you're going.
Thank you. But I don't have 'cp' in my adb shell.
# cp
cp: not found
# /system/bin/cp
/system/bin/cp: not found
Click to expand...
Click to collapse
From here:
http://android-tricks.blogspot.com/2009/02/cp-on-android.html
I use 'cat' command to move to /system/bin
How do you have mv but not cp? Do you not have BusyBox installed?
No. I just need to search 'BusyBox' on Android market and install it? That is?
hap497 said:
Thank you. But I don't have 'cp' in my adb shell.
From here:
http://android-tricks.blogspot.com/2009/02/cp-on-android.html
I use 'cat' command to move to /system/bin
Click to expand...
Click to collapse
The cat command will work fine, no busybox needed: cat source_file > dest_file
efrant said:
The cat command will work fine, no busybox needed: cat source_file > dest_file
Click to expand...
Click to collapse
Woah there partner. Cat shouldn't be used on binary files, only ascii files. While it might work fine, it is not the recommended practice and really should not be done.
OP, Yes, BusyBox can be installed from the market.
GldRush98 said:
Woah there partner. Cat shouldn't be used on binary files, only ascii files. While it might work fine, it is not the recommended practice and really should not be done.
Click to expand...
Click to collapse
Really? I was unaware of that. It worked every time I used it.
efrant said:
Really? I was unaware of that. It worked every time I used it.
Click to expand...
Click to collapse
On standard Unix/Linux/etc. systems, cat works fine for binary files. It's only under DOS that cat or type shouldn't be used for binaries.
back in my ADB days.. itd say remount failed or w.e but i could still access my phone..
but i dont know.. ever since i switched to linux i stopped using ADB.. hahah

[TUT] Linux in chroot on your iconia

So, many of you want to run a full-size linux on your iconia. Unfortunately due to the fact that acer are a bunch of stupid mofos not releasing kernel source code and do not allow to flash unsigned ROMs we'll have to run it in chroot within android.
First thing to do is to get yourself a rootfs of linux. You can use angstrom, ubuntu.. I'm building debian using multistrap, the config is below. You'd better use pre-built ubuntu/backtrack and skip up to somewhere between steps 4 and 5, unless you have experience with dpkg and apt-get.
Code:
[General]
arch=armel
directory=/home/alexander/builds/multistrap
cleanup=false
retainsources=true
allowrecommends=false
noauth=true
unpack=true
aptsources=Grip
debootstrap=Debian
[Debian]
packages=screen openssh-server alsa-utils wireless-tools wpasupplicant nmap netcat
source=http://ftp.uk.debian.org/debian
keyring=debian-archive-keyring
suite=sid
[Grip]
packages=locales
keyring=emdebian-archive-keyring
source=http://www.emdebian.org/grip
suite=sid
Now we need to get it to iconia somehow. Running it from microsd would be incredibly slow and internal ssd is formatted to vfat. So let's loop mount it.
1. Create the loopback image
Code:
#700 mb
dd if=/dev/zero of=debian.img bs=10M count=70
mkfs.ext2 -f debian.img
2. Mount it as you always do.. on your desktop yet
Code:
mkdir /mnt/debian
mount -o loop -t ext2 debian.img /mnt/debian
3. Copy the desired files.. As a root user, you can cd to the rootfs (generated by multistrap) and
Code:
tar cvp . | tar xvp -C /mnt/debian
4. unmount the image.. (umount /mnt/debian) and copy to the /sdcard. I copy to the /sdcard/linux/debian.img. Also, I use the /sdcard/linux/uroot directory to mount the image on the tablet.
5. now, you need adb or terminal emulator and superuser permissions ('teh rewt')
Now let's make some script, name it android_sh and put it to /bin in /sdcard/linux/uroot. And make it executable (chmod +x /bin/android_sh)
Code:
#!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
export USER=root
export HOME=/root
export TERM=linux
if [ -z "`pidof Xtightvnc`" ] ; then
vncserver -geometry 1280x740 -depth 8
else
kill -9 `pidof Xtightvnc`
rm /tmp/.X11-unix/X*
rm /tmp/.X*lock
fi
/bin/bash -
Ok. now make another script, in /sdcard/linux
Code:
#!/bin/sh
LOOPBASE=/sdcard/linux
LOOPFILE=debian.img
LOOPTARGET=uroot
cd $LOOPBASE
if [ -z "`grep $LOOPBASE/$LOOPTARGET /proc/mounts`" ]; then
echo "mounting $LOOPFILE"
mount -o loop -t ext2 $LOOPBASE/$LOOPFILE $LOOPBASE/$LOOPTARGET
else
echo "$LOOPFILE already mounted"
fi
for i in dev proc sys
do
echo "processing $i"
if [ -z "`grep $LOOPBASE/$LOOPTARGET/$i /proc/mounts`" ]
then
echo "mounting $i"
mount -o bind /$i $LOOPBASE/$LOOPTARGET/$i
else
echo "$i already mounted"
fi
done
if [ -z "`grep $LOOPBASE/$LOOPTARGET/dev/pts /proc/mounts`" ]
then
mount -t tmpfs none $LOOPBASE/$LOOPTARGET/dev/pts
fi
echo "chroot into $LOOPBASE/$LOOPTARGET"
chroot $LOOPBASE/$LOOPTARGET /bin/android_sh
now, execute it (sh /sdcard/linux/chroot.sh). You should be in root shell now. If you're building debian using multistrap, configure the packages (dpkg-configure -a). Remember I told you to keep out of debian? Dash package is somewhat broken so you may need to lurk through mailing lists to make it install.. And you need to manually add your sid/testing mirrors to the aptitude config.
So what now? Install tightvnc server (in debian/ubuntu, use apt-get update; apt-get install tightvncserver), exit the shell and launch chroot.sh again.
If you're building rootfs yourself, don't forget to install some x desktop environment. I use lxde on debian, it is lightweight and starts automatically with tightvnc
Now, you can use the vnc client on android to connect to your X11. When chrooting, tightvnc wil tell you the number of x session, so use it as the last digit of the port (5901, 5902 etc). I welcome suggestions on how to improve the android_sh to cleanly kill all tightvnc servers and remove temporary files so that the port number is always the same
In the end you may or may not get something similiar to this:
http://img820.imageshack.us/img820/9076/img3159qm.jpg
P.S.
I recommend you to install Hacker's Keyboard which will give you the tab key, esc and arrows simultaneously and allow to use cool software like vim and emacs without pain
https://market.android.com/details?id=app-org.pocketworkstation.pckeyboard
U.B.D.Man...
Cool...But I got stucked at the first step. Where can I get debian.img?
you create a new file named debian.img using dd, then you format it to ext2 using mkfs.. well. you can just take backtrack image from xoom. essentially it's just ubuntu with some software added
I'm just curious why you chose ext2 as opposed to ext4? Given that the filesystem is actually a file on a filesystem, I sort of understand ext2, especially considering you can mount it with the ext4 driver now.
This probably sounds like a stupid question, but for some reason I cannot use bash?
It may be that my paths are not configured properly, but i dont have a bin at the "/" level. I have looked in /system/bin and /system/xbin, but have not found bash there either.
I installed busybox and have been able to perform root tasks, so I am not sure what I missed.
because.. you don't have bash.. you should have it in your chroot. if you need it in android, just install it (like http://forum.xda-developers.com/showthread.php?t=537827)
I installed bash according to the link you posted, but I still don't have a /bin outside of /system. I did change the above scripts to reflect this by saying:
#!/system/bin (but then I get the error 'event not found')
My prompt reads: "sh-3.2#" after reboot, which I understand is bash replacing the stock terminal.
I tried creating the /bin directory in the root, but even with root terminal, it said it was read only. Do I have to remount the root and then create a /bin directory?
When I rooted, I don't remember their being a lengthy discussion about bash installation, or the creation of a /bin directory.
I welcome all suggestions, as I am trying to learn more about the inner workings of the tablet, but still have little experience.
you need bash only in the linux in chroot and therefore do not need to modify scripts.
anyway,
mount -o remount,rw /system
cp bash /system/bin
chmod 755 /system/bin/bash
mount -o remount,ro /system
then you can start bash by typing 'bash' in shell
Hello,
I have tried and I still can't get it run. I am not used to Linux stuffs and scared that I may screwed up my tab. Can you please pack the required files and upload it so that we can follow easier? something like this http://www.secmaniac.com/may-2011/backtrack-5-on-motorola-xoom-in-10-minutes-or-less/ would be great.
Thank you.
PS: I sincerely want to get BackTrack on my tab so that I can run R on this
moved to http://forum.xda-developers.com/showthread.php?t=1094237
sp3dev said:
because.. you don't have bash.. you should have it in your chroot. if you need it in android, just install it (like http://forum.xda-developers.com/showthread.php?t=537827)
Click to expand...
Click to collapse
I ended up installing bash, but I still had problems with chroot and getting the scripts to run, so I decided to reverse what I was doing. In the process of trying to remove the bash shell and replace with the stock sh, I must have messed something up.
I tried a factory reset, and when I loaded back up again, I can't get wifi to connect. My suspicion is that there is at least two separate things wrong:
-My shell is somewhere in permission limbo or non-existant
I try running >adb shell and I get:
"- exec '/system/bin/sh' failed: No such file or directory (2) -"​
-The permissions on my wpa_supplicant are probably messed up, hence I can't connect to wifi
Any suggestions?
Well I tried a few more things:
-Tried copying over bash to /system/bin, got an error that it is a read-only file system. Funny, because I need shell (chmod?) in order to repair the shell, those bastards.
-Tried installing apk using adb, got same message about 'sh' missing. I think I will have to reflash a system.img, but I can't seem to find the Wifi-US with a working link.
Any help would be much appreciated.
Hey guys, could you upload and send me the link of a video of this working? Cause I love the idea of it but I'm not sure if its really practical
Sent from my A500 using XDA Premium App

[How to] Linux (Backtrack5) and OpenOffice3

Backtrack5 and OpenOffice3.0
xMemphisx said:
Backtrack (http://www.backtrack-linux.org)
Backtrack-Linux.org, home of the highest rated and acclaimed Linux security distribution to date. BackTrack is a Linux-based penetration testing arsenal that aids security professionals in the ability to perform assessments in a purely native environment dedicated to hacking. Regardless if you’re making BackTrack you Install BackTrack, boot it from a Live DVD or thumbdrive, the penetration distribution has been customized down to every package, kernel configuration, script and patch solely for the purpose of the penetration tester.
Here is a guide to getting ARM Backtrack Running on the Iconia A500 (tested on Wifi Only Version, running 3.0.1)
After much frustration I have gotten the GUI part of the backtrack 5 arm release working with the Motorola Xoom.
This has only been tested to work on the Iconia A500 . But it should work just fine with any other device that supports linux, and should work especially well on anything with a dual-core processor (G2X, Atrix, etc.)
Pre-requisites:
- Rooted Iconia A500
- Busybox installed (Find on market Busybox installer)
- androidVNC from the Android Market
- Terminal Emulator from the Android Market (which you should already have)
- Backtrack 5 for ARM with Gnome downloaded and setup (check the README file, and follow the instructions.)
Link: Backtrack 5 http://www.backtrack-linux.org/downloads/. This tutorial will assume you put Backtrack 5 in the folder /sdcard/BT5 like the README says.
Code:
Extract the zip file to your internal SDCARD folder (/SDCARD/BT5)
Open Terminal emulator and type
su
cd /sdcard/BT5
gunzip bt5.img.gz (take about 7-10mins)
sh bootbt
Code:
cd /sdcard/BT5
su
sh bootbt
BackTrack will start up in shell. You will get a red line that says "[email protected]:". To verify if you type:
Code:
ls pentest
It should echo back the folders in pentest, stuff like 'backdoors','database',etc.
At this point enter the following commands:
Code:
export USER=root
vncpasswd
When you type in 'vncpasswd' this is to the the password for the tightvncserver. Since I only connect locally I just use 'qwerty' for my password, and then confirm the password. [Edit] Apparently you can skip this step, as the default password for vnc is simply, 'toortoor' (root backwards, twice).
When it asks if you want to create a view only password just type 'n' and hit enter. After you have your password setup for vnc start the server up.
Code:
[COLOR="Red"]startvnc 1280x800[/COLOR]
When this happens you will get a message confirming that "New 'X' Desktop is localhost:1" and a bunch of other random stuff below it (it isn't important unless there are errors listed).
At this point, press the "HOME" button and then open the application "androidVNC".
-In the "Nickname" box, you can name it whatever you like.
-In the "password" entry, use your password (mine is 'qwerty').
-In the "Address" box you can type in localhost (or leave it blank).
****Change the port from 5900 to 5901.
I also recommend setting the color-depth to 24-bit. After that press the "connect" button, and bam! You're rocking Backtrack 5 on your Iconia A500!!
Code:
In order to exit:
- Go back to Terminal
- Type [B]stopvnc[/B]
- Type [B]exit[/B]
you are back to android terminal environment and ur androidvncviewer will get disconnected.
Click to expand...
Click to collapse
p-ille said:
I tested openoffice 3 and it works like a charm. It is not present in the original backtrack repository, so I had to add another source. I used the Debian repository. From the backtrack terminal I typed:
Code:
add-apt-repository deb *repository address* stable main contrib non-free
apt-get update
apt-get install openoffice.org
You can find the debian mirror for your country at
Code:
debian.org/mirror/list
Click to expand...
Click to collapse
For those who want to access SDCard/USBDrive from within BB5, please follow this:
p-ille said:
I did it!
To mount sdcard, external sd and usb storage in backtrack, you have to modify the bootbt script like this (changes in red):
Code:
perm=$(id|cut -b 5)
if [ "$perm" != "0" ];then echo "This Script Needs Root! Type : su";exit;fi
mount -o remount,rw /dev/block/mmcblk0p5 /system
export kit=/sdcard/BT5
export bin=/system/bin
export mnt=/data/local/mnt
[B][COLOR="Red"]export stor=$mnt/root/storage
export sdcard=$stor/sdcard
export extsd=$stor/external_sd
export usb=$stor/usb_storage[/COLOR][/B]
mkdir -p $mnt
export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
export TERM=linux
export HOME=/root[I]
[COLOR="Blue"]export USER=root[/COLOR][/I]
if [ -b /dev/loop2 ]; then
echo "Loop device exists"
else
busybox mknod /dev/loop2 b 7 0
fi
mount -o loop,rw,noatime -t ext2 $kit/bt5.img $mnt[B][COLOR="Red"]
echo "mounting storage devices in $stor..."
mkdir -p $sdcard
mkdir -p $extsd
mkdir -p $usb
busybox mount --bind /mnt/sdcard $sdcard
busybox mount --bind /mnt/external_sd $extsd
busybox mount --bind /mnt/usb_storage $usb[/COLOR][/B]
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
busybox sysctl -w net.ipv4.ip_forward=1
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "127.0.0.1 localhost bt5" > $mnt/etc/hosts
busybox chroot $mnt /bin/bash
echo "Shutting down BackTrack ARM for Iconia A500"
[B][COLOR="Red"]umount $sdcard
umount $extsd
umount $usb[/COLOR][/B]
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
Click to expand...
Click to collapse
Very nice indeed, will try it out very soon.............
Awesome, just what I have been looking for. I will try this when I get home tonight!
Thanks
lpachuong said:
Here is a guide to getting ARM Backtrack Running on the Iconia A500 (tested on Wifi Only Version, running 3.1)
Click to expand...
Click to collapse
3.1? maybe you means 3.0.1?
After
export USER=root
Click to expand...
Click to collapse
You/can type
startvnc
Click to expand...
Click to collapse
without the need to -geometry 1280x800, and afterward after your session type
stopvnc
Click to expand...
Click to collapse
for a clean disconnect.
Just a faster easier way.
I got I/O errors while mounting devpts and sysfs (bootbt script)
peyotll said:
I got I/O errors while mounting devpts and sysfs (bootbt script)
Click to expand...
Click to collapse
I had the same errors when i had ubuntu installed/and was trying to do this along side.. what I had to do was factory reset (I did so to get rid of ubuntu, there's probably an easier way) then tried backtrack again with no problem
Agosh13 said:
3.1? maybe you means 3.0.1?
Click to expand...
Click to collapse
Hahahaha...I wish =)
Btw, please let me know if you have any special script/suggestion about this topic. I will update the original one so that everyone can get updated.
I'm trying to get OpenOffice running...sadly the ARM version is not that stable. Anyone has any resource on it?
Works perfectly! Thanks for this!
Thanks very much for this guide!
I'm having a strange issue though, hopefully someone can help. When I press the "m" key, rather than type the letter "m", it opens up the mail icon in the tool bar. Every other letter works fine, and I can't seem to find a way to edit this keyboard shortcut.
Anyone else have this issue, or now how to correct this?
thanks a lot - it will work for me without any error or something else
i use the latest update from acer (A500_1.141.01_EMEA_CUS7)
hmm, is there any trick to log off an turn off the system ? when i exit everthing an try to start again i will only see the backtrack wallpaper...
also i got an error in term-emu when i type in "exit".
I added the OP for how to exit.
Thanks for the guide, I have been waiting for something like this!
koprofile said:
Thanks very much for this guide!
I'm having a strange issue though, hopefully someone can help. When I press the "m" key, rather than type the letter "m", it opens up the mail icon in the tool bar. Every other letter works fine, and I can't seem to find a way to edit this keyboard shortcut.
Anyone else have this issue, or now how to correct this?
Click to expand...
Click to collapse
doble-tap (right click) the mail icon in the tool bar and choose to remove it from panel. It should remove the keyboard shortcut also.
lpachuong said:
Hahahaha...I wish =)
I'm trying to get OpenOffice running...sadly the ARM version is not that stable. Anyone has any resource on it?
Click to expand...
Click to collapse
I tested openoffice 3 and it works like a charm. It is not present in the original backtrack repository, so I had to add another source. I used the Debian repository. From the backtrack terminal I typed:
Code:
add-apt-repository deb *repository address* stable main contrib non-free
apt-get update
apt-get install openoffice.org
You can find the debian mirror for your country at
Code:
debian.org/mirror/list
Thank you very much for this guide.
It works like a charm.
Just one question.
I suppose you use a bluetooth keyboard, because the virtual one doesn't seem to work with Backtrack. But is it possible to use a mouse ? Because my big fingers don't match the tiny icons and menu choices !!!
Thanks again.
p-ille said:
Code:
add-apt-repository deb *repository address* stable main contrib non-free
apt-get update
apt-get install openoffice.org
You can find the debian mirror for your country at
Code:
debian.org/mirror/list
Click to expand...
Click to collapse
Thank you for ur script. I haven't had time to play with it due to exams.Anyway, I added them to the original post so that everyone can find it easier.
Regarding to the keyboard...i tried with usb keyboard and it worked fine. I have a BT keyboard but haven't tried it yet. I don't think the mouse will work bcz it is restricted by the VNCViewer
Hi
Tanks for tour tutorial, but i'm having some issue running backtrack:
Code:
# sh bootbt
Loop device exists
ioctl LOOP_SET_FD failed: Bad file number
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
net.ipv4.ip_forward = 1
bootbt: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
bootbt: cannot create /data/local/mnt/etc/hosts: directory nonexistent
chroot: can't execute '/bin/bash': No such file or directory
Shutting down BackTrack ARM For Xoom
failed.
failed.
failed.
failed.
#
I did check the md5sum of the archive,ok. Busybox ok.
Tanks for your help.
When it asks if you want to create a view only password just type 'n' and hit enter. After you have your password setup for vnc start the server up.
Code:
Code:
startvnc 1280x800
When this happens you will get a message confirming that "New 'X' Desktop is localhost:1" and a bunch of other random stuff below it (it isn't important unless there are errors listed).
Click to expand...
Click to collapse
is it possible to use a different resolution? I tried to use 1280x768 (WXGA read on Wikipedia) but it didn't work.
Hi, Alberto
edit:
Now it works fine! thank you!
Sorry for my first post.
I just realize that I had confused the downloaded archive (.7 z, wich contain all stuff) and the compressed image (. gz), so I did not unpack image before running bootbt.
Unfortunately, the extraction of master archive did not work due to the soft used to extract .7z.
As i mentionned before I've checked the whole archive md5sum but did not check the extracted files.
bt5.img.gz was only 12.59 MB, extracted with androzip. (don't use it, at least for .7z!!)
interesting....
is the wifi adapter working in monitor mode???

[HOWTO] Add init.d to stock ROM + a few other goodies

I have been resisting the urge to flash a custom ROM for a bit, but I really miss having init.d support. So I read a few threads for other phones and rolled my own.
Warnings
I borrowed bits and pieces from various places. If you don't know what init.d is, you probably don't want to do this. If you aren't willing to take responsibility for bricking your tablet, don't do this. Seriously, the risk of bricking is very low, but if you aren't comfortable booting into an adb shell from recovery, maybe this is not for you. Strongly suggest a nandroid backup before you get started so if you totally bork things you can just hit rewind.
Note: The latest CWM may prompt you on a reboot that the ROM may overwrite the bootloader and offer to fix it for you. Don't do that. The init.d hack takes over the bootloader install script, but does not change your bootloader! If you accidentally do let it fix things for you, just rebuild the install-bootloader.sh file. The other steps should be fine.
Prerequisites
First, you need root, busybox, and some sort of terminal (either adb, or some terminal you like using on the tablet).
I have found that I like Busybox Installer (from the market; https://play.google.com/store/apps/details?id=com.jrummy.busybox.installer) but for some reason it doesn't create new symlinks unless you click advanced install.
Let's get to it!
In the shell (don't type # or anything after #):
Code:
su # get root
mount -o remount,rw /system # get access to /system (4.04 seems to mount ro as is usual; seems like the original mounted rw)
which run-parts # if you don't see /system/xbin/run-parts you need to install/reinstall busybox; if it is somewhere else, note it
mkdir /system/etc/init.d
Create a file called sysinit -- we are going to put it in /system/bin. You can edit it in place with vi, mount your tablet and edit it on your computer, or create it on the computer and push it via adb. Whatever.
Here's the file (you do need the # and the things after it in the file!):
Code:
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
/system/bin/logwrapper /system/xbin/run-parts /system/etc/init.d
Note that if your run-parts is not in /system/xbin (from the which command) then fix the above to reflect your reality.
In the shell, make it executable
Code:
chmod 755 /system/bin/sysinit
Now go in the init.d directory and create some things you want to run at start up. For example:
Code:
cd /system/etc/init.d
echo '#!/system/bin/sh' >99test # note: you do need the first # in this line but not the 2nd!
echo 'date >>/data/tmp/init.d-log.txt' >>99test
chmod 755 99test
Here's a more practical one (yes, you need the # signs). Name it something like 10diskperf -- don't forget to chmod it.
Code:
#!/system/bin/sh
# Set disk read aheads to 1024
chmod 777 /sys/block/mmcblk0/queue/read_ahead_kb
echo "1024" > /sys/block/mmcblk0/queue/read_ahead_kb
chmod 777 /sys/block/mmcblk1/queue/read_ahead_kb
echo "1024" > /sys/block/mmcblk1/queue/read_ahead_kb
chmod 777 /sys/devices/virtual/bdi/179:0/read_ahead_kb
echo "1024" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
Or here is one to tweak some TCP parameters (25sysctl):
Code:
#!/system/bin/sh
sysctl -w net.core.rmem_max=524288
sysctl -w net.core.wmem_max=524288
sysctl -w net.ipv4.tcp_rmem=6144 87380 524288
sysctl -w net.ipv4.tcp_wmem=6144 87380 524288
Whatever files you put in, you need to remember to make them executable (chmod 755).
Finally, you need to kick it all off at start up. The hack for that is we are going to create /system/etc/install-recovery.sh which apparently runs on each boot.
Code:
cd /system/etc
echo '#!/system/bin/sh' >install-recovery.sh
echo '/system/bin/sysinit' >>install-recovery.sh
chmod 755 install-recovery.sh
Tips and troubleshooting
If you are too lazy to cut and paste I have the files here (View attachment init.d-support.zip) that you can just move to the right places and change permission. If you are really lazy there is lightly tested install script below.
I like to try running the whole thing before a reboot to see if I get any errors:
Code:
/system/etc/install-recovery.sh
I'd suggest putting the 99test file in first. Verify that you get the expected file in /data/tmp and then reboot and check again. Then you can remove 99test.
Same goes for adding new scripts. Try running them from the shell to see if they throw errors before you reboot!
If you have trouble, see if this looks right:
Code:
ls -ld /system/etc/install-recovery.sh /system/bin/sysinit /system/etc/init.d /system/xbin/run-parts
-rwxr-xr-x root root 39 2012-07-14 10:00 install-recovery.sh
-rwxr-xr-x root root 140 2012-07-14 10:01 sysinit
drwxrwxrwx root root 2012-07-14 10:10 init.d
lrwxrwxrwx root root 2012-07-14 09:55 run-parts -> /system/xbin/busybox
For the brave
The install-init.d zip file (View attachment install-init.d.zip) contains a lightly tested script that SHOULD do the install steps for you.
Send the file to your android to someplace that can execute code (e.g., /system/xbin; I had to use adb to put it on the sdcard and then move it to /systemxbin in the shell since I don't have the adb root kernel installed).
Code:
cd /system/xbin # or wherever you have it
chmod 755 install-init.d
./install-init.d
It performs rude checks to see if init.d exists, and tries to handle moving or missing busybox. It only installs 99test as a script.
Let me know if this works or doesn't work for you.
For the extra brave: There is no reason this should only work on the Samsung. This ought to work on pretty much most stock ROMs as long as they execute install-recovery.sh on start up.
Scripts
What do you put in your init.d? If you post anything cool I'll put it up here in the op.
One that gave me some real gains in I/O performance required a new version of the tune2fs executable. By default, it is part of busybox but the busybox one only has a few simple options. I've included a stand alone version and the script 10disktune here View attachment disktune.zip. Unpack the zip and put the 10disktune in /system/etc/init.d (don't forget to chmod) and put tune2fs in /system/bin (chmod that too). Note that busybox has one in /system/xbin but the script specifically calls out the one in /system/bin.
Here's one that will zipalign your apks on each boot
Code:
#!/system/bin/sh
for apk in /data/app/*.apk ; do
zipalign -c 4 $apk
ZCHECK=$?
if [ $ZCHECK -eq 1 ]; then
zipalign -f 4 $apk /cache/$(basename $apk)
if [ -e /cache/$(basename $apk) ]; then
cp -p -f /cache/$(basename $apk) $apk
rm /cache/$(basename $apk)
fi;
fi;
done;
Fin
Corrections welcome. I considered using exec or . to load some of this into one shell but given that it runs once at startup, I figured it is fine as is.
All files for reference
View attachment init.d-support.zip
View attachment install-init.d.zip
View attachment disktune.zip
Great guide, gonna try it tonight.
Sent from a GNote, hell yeah!
SirRhor said:
Great guide, gonna try it tonight.
Sent from a GNote, hell yeah!
Click to expand...
Click to collapse
I'm curious how it went. If you ran into any issues, let me know so I can update the op. Thanks!
Hmm did anyone get this to work?
wd5gnr said:
Hmm did anyone get this to work?
Click to expand...
Click to collapse
I did it on my Galaxy Nexus.
It works great, I had a bit of problem with the sysinit file, but when I downloaded your zip file and used your sysinit, it worked, so it must be a problem from my side
Thanks for this, I can finally use "Odex Me"
aavan said:
I did it on my Galaxy Nexus.
It works great, I had a bit of problem with the sysinit file, but when I downloaded your zip file and used your sysinit, it worked, so it must be a problem from my side
Thanks for this, I can finally use "Odex Me"
Click to expand...
Click to collapse
Great, just wanted to be sure I hadn't made any typos/errors in the guide.
A lot of init.d files collected here: http://forum.xda-developers.com/showthread.php?t=1227269
Also build.prop things, etc.
Thanks, I use your guide and worksperfect for my RK3066 devices. Very simple to understand all steps and what we are doing to our system, perfect for me. Thanks again dude
Melch1zedeK said:
Thanks, I use your guide and worksperfect for my RK3066 devices. Very simple to understand all steps and what we are doing to our system, perfect for me. Thanks again dude
Click to expand...
Click to collapse
Glad to help!
What is thhe utility of this?
moliverac8 said:
What is thhe utility of this?
Click to expand...
Click to collapse
Init.d is how Linux and many Android (which is kind of Linux, after all) systems manage executing commands on boot up.
The /etc/init.d files run in numerical order as root and you can do things like change system settings, manipulate the file system, etc.
See the init.d section linked below for some ideas.
http://forum.xda-developers.com/showthread.php?t=1227269
Question? what is the difference in this method and running a script?
wd5gnr said:
Init.d is how Linux and many Android (which is kind of Linux, after all) systems manage executing commands on boot up.
The /etc/init.d files run in numerical order as root and you can do things like change system settings, manipulate the file system, etc.
See the init.d section linked below for some ideas.
http://forum.xda-developers.com/showthread.php?t=1227269
Click to expand...
Click to collapse
I use the "swap memory script" and was wondering if it would also work this way with the init.d If so would there be any benefit this way over the current way of running it one way or the other? One drawback I see running the script as is is that I have to wait once the system has fully booted until the script has run and I see the Smanager screen to let me know that my memory has been remounted.
Thanks for the info and the learning process.
Here is the script and the link.
http://forum.xda-developers.com/showthread.php?t=1961097
Code:
sleep 5
mount -o remount,rw /
mount -t vfat -o umask=0000 /dev/block/vold/179:25 /mnt/sdcard
sleep 5
mount -o bind /data/media /mnt/extSdCard
As long as the device is ready to mount at boot time and doesn't get remounted, ought to work. Backup and try it
External memory wasn't ready
wd5gnr said:
As long as the device is ready to mount at boot time and doesn't get remounted, ought to work. Backup and try it
Click to expand...
Click to collapse
Thanks for the guide, but I think that the external memory was not ready to be mounted at that time. it didn't see the card till after boot. It was worth a shot, Reverted back to the script in /data and all worked again,
Note: I didn't find /system/xbin/run-parts however, I did find /system/bin/run-parts and changed the path to reflect that, I don't think this was an issue but I'm not 100% sure.

Categories

Resources