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
Related
NEW DEBIAN.img
http://www.multiupload.com/FEO9PZLOCP
This image has internet working and very nice and neat.
To use image copy to ext2 partition and mount
You will need an ext2 partition, you can use my rom and follow its install instructoins and these images and my rom work together perfectly!
http://forum.xda-developers.com/showthread.php?p=16969687#post16969687
download the mount.zip it contains linux a terminal command and linuxboot.sh using adb
http://www.multiupload.com/SDOPA3GVSP
This requires either an ext2 partition or, The img file on your sdcard/debain.img. Using ext2 partition is what is recomended.
adb push linux /system/bin/
adb push linuxboot.sh /system/bin/
Click to expand...
Click to collapse
busybox mount -o rw,remount /
mkdir /mnt/linux
mkdir /sdcard/debain
mount -o rw,loop -t ext2 /sdcard/debain.img /sdcard/debain
mount -o rw -t ext2 /dev/block/mmcblk0p2 /mnt/linux
dd if=/sdcard/debain of=/mnt/linux
Click to expand...
Click to collapse
Now just type :
linux
Click to expand...
Click to collapse
in the terminal and you will be connected
On first boot
linux
Click to expand...
Click to collapse
this should put you into a localhost:#
once in local host type:
nano /etc/init.android/rc_enter.shnow add this to the file
There should already be this inside:
if [ 1 -eq 1 ]; then echo nameserver 192.168.1.1 > /etc/resolv.conf; fi
/etc/init.d/hostname.sh start
Click to expand...
Click to collapse
ADD :
vncserver -kill :1
rm -r tmp
mkdir tmp
cd tmp
mkdir .X11-unix
cd ..
vncserver
Click to expand...
Click to collapse
To connect to vncserver use any vncserver app and use the following info:
username: localhost
password: android
host: localhost
port: 5901
Click to expand...
Click to collapse
the new debian.img is roughly 2.5 gigs so I would make enough room on your ext2 partition for 2.5 gigs at least, if you have any problems let me know
OLD
_________________________________________________________________________________________________________________________________________________
OK everyone here it is. Debian and Ubuntu works on ERIS. I have an image that you can download and extract to /sdcard/Ubuntu/ or /sdcard/debian Download One of the .rars below. To use correctly you must have a 2.2 foryo rom, and flash conaps defauctcfs7 loop enabled kernal
Also need a few other files that I have either told you how to or were to download. Follow the instructions and you will be fine.
I am sorry this is not A SELF INSTALLER or an APK BY any means, You must start from scratch and compile your debian, but I have shown the way with Conaps help you can easily install debian from this tutorial.
Debian with vncserver download and extract and push to /sdcard/debian
Ubuntu with vncserver, icewb-UI, and synaptic packagemanager, and firefox, download and extract and push to /sdcard/ubuntu
For Debian
in terminal type:
su
insmod /system/lib/modules/loop.ko
sh /sdcard/debian/installer.sh
chroot debian /bin/bash
For Ubuntu Version
in terminal type:
su
insmod /system/lib/modules/loop.ko
sh /sdcard/ubuntu/mount.sh
chroot ubuntu /bin/bash
to start tightvncserver and connect threw pocket cloud type:
vncserver -geometry 480x320 {-geometry 480x320 is optional}
password:android
repeat:android
open pocket cloud
server: localhost
password:android
port:5901
Special thanks to Conap for creating his new DecafuctCFSv7.zip
Thanks to workshed for a nice keyboard fix
1. download Conap's loop kernal obviously.
2. Recomend downloading and installing conaps CELB (NOT CELEB LOL) ROM, But any 2.2 rom will work
Or Dualrom with loop kernal DualRomLoop
There is a tutorial on how to partitoin your sdcard there, although if you want to run dual rom with debian on second rom I would make my partition sizes as follows:
mkpartfs primary fat32 512B 300MB
mkpartfs primary ext2 300MB 550MB
mkpartfs primary ext2 550MB 900MB
mkpartfs extended 900MB 7948MB
mkpartfs logical ext2 900MB 975MB
mkpartfs logical fat32 975MB 7948
3. Install or flash conaps loop kernal, and conaps celb rom
4. Download this Linux.rar and extract to
/sdcard/debian/*files*here
or
/sdcard/ubuntu/*files*here
Then wait for your phone to boot, and follow the rest of the instructions; I would let the phone idle for a few minutes just to let it settle down
5. Download Swapper from the market, Not Swapper 2. install and create a swap.swp file of 256 megs the most you can, and make sure its running when you continue with the steps so dont exit it, press home instead of the back arrow
DEBIAN
In the terminal type:
su
insmod /system/lib/modules/loop.ko
sh /sdcard/debian/installer.sh
Then an easy chroot:
chroot /debian /bin/bash/
For UBUNTU
In the terminal type:
su
insmod /system/lib/modules/loop.ko
sh /sdcard/ubuntu/mount.sh
Then an easy chroot:
chroot ubuntu /bin/bash/
Or you can Install via gscript by running installer.sh in gscript then an easy chroot by typing in the terminal:
chroot /debian /bin/bash/
MAKE SURE TO SET YOUR PATH IN THE TERMINAL @ localhost:/ export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
first if that doesnt work try export USER=/root
One time install type:
/scripts/onetime.sh
A little clean up:
cd tmp
rm -r .X*
cd ..
gpg --recv-keys 9AA38DCD55BE302B
gpg --export 9AA38DCD55BE302B | apt-key add -
apt-get update
apt-get install tightvncserver
apt-get install lxde
to start tightvncserver and connect threw pocket cloud type:
vncserver -geometry 480x320
password:android
repeat:android
open pocket cloud
server: localhost
password:android
port:5901
Originally Posted by Conap
6. Open up Terminal Emulator and type:
su
insmod system/lib/modules/loop.ko
busybox mount -o remount,rw /
mkdir debian
busybox mknod /dev/loop0 b 7 0
mount -o loop,noatime sdcard/debian/debian.img debian
mount --bind /dev/pts /debian/dev/pts
mount --bind /proc /debian/proc
mount --bind /sys /debian/sys
sysctl -w net.ipv4.ip_forward=1
chroot /debian /bin/bash
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
cd tmp
rm -r .X*
cd ..
If you have problems make sure that you have succesfully installed Conaps Loop
by puting the loop.ko in your sdcard and by typing:
su
cd /sdcard
insmod loop.ko
If your phone reboots you probably need to make sure swapper is running correctly and you have task killer to kill most tasks
GOOD LUCK!
Sounds cool
This is the same spot I am at although I did it a little different. What I am stuck on is getting a ui running. Any luck with that? also anything i apt-get seems to fail...
screenies?
list of wat is and isn't working?
great job though
My sd card is partitoned for Darktremor with a linux swap. Would I still need Swapper?
Sent from my ERIS using XDA App
Well i did the steps this way instead of using scripts.
1. insmod system/lib/modules/loop.ko
2. busybox mount -o remount,rw /
Forgot to write a step: mkdir image
3. busybox mknod /dev/loop0 b 7 0
4. mount -o loop,noatime sdcard/debian.img image
5 .cp -r image/* sd-ext/
6. mkdir data/local/debian/
7. mount -t ext2 /dev/block/mmcblk0p2 /data/local/debian
8. mount --bind /dev/pts /data/local/debian/dev/pts
9. mount --bind /proc /data/local/debian/proc
10. mount --bind /sys /data/local/debian/sys
11. sysctl -w net.ipv4.ip_forward=1
12. chroot /data/local/debian /bin/bash
Now if you don't want to partition your sd card I beleive you can just chroot into the img itself instead of copying the files so you would skip steps 5-7 and change the paths in the other steps from data/local/debian/ to image/ This image was only 1.4 GB which could be made bigger i believe if you wanted more room. The debian.img just goes on the fat32 portion of your sd card. This was done using celbfroyo but all cm roms mount an ext partition as sd-ext i beleive. If your not using a cm rom you would probably need to mount the ext partition yourself.
Tuckface1 said:
screenies?
list of wat is and isn't working?
great job though
Click to expand...
Click to collapse
no screenies cause at this point we are just at a command prompt of debian with no ui...when we get a ui I will get some screenies for you. I am getting an internet connection.
Conap said:
no screenies cause at this point we are just at a command prompt of debian with no ui...when we get a ui I will get some screenies for you. I am getting an internet connection.
Click to expand...
Click to collapse
ok I am getting ui with xwindows server but for some reason cant see login. I get a grey screen when connected to vnc
but under terminal I have web, and debian shell so its close
mjgdroid said:
ok I am getting ui with xwindows server but for some reason cant see login. I get internet with wget but doesnt let me download kde idk what ui are you going to get?
Click to expand...
Click to collapse
i was attempting to get icewm but would take anything at this point. How do you get the ui with xwindows? i was trying through the androidvnc app. Is there a different app?
Conap said:
i was attempting to get icewm but would take anything at this point. How do you get the ui with xwindows? i was trying through the androidvnc app. Is there a different app?
Click to expand...
Click to collapse
apt-get install tightvncserver (return)
apt-get install lxde (return)
i am using pocket cloud light
OK my phone just rebooted due to low memory I will be right back, but I posted what I did after I installed /ontime/sript.sh
then
apt-get install tightvncserver (return)
apt-get install lxde (return)
at wich point I can connect threw pockect cloud light , now I justneed a xwindows file or something
Any idea on how to get terminal not to shut out of localhost after we close it?
mjgdroid said:
Any idea on how to get terminal not to shut out of localhost after we close it?
Click to expand...
Click to collapse
are you running it on the phone or through adb?....i still get could not connect to server in vnc and cloud ...
phone.... adb seems messy to me, and I want to know it works while I'm doing it : ok stupid stupid me, just realized why u are yousing adb lol omg
eventually i would assume we would want a script to run on phone to start it which should be simple...i did get lxde ui to load
mjgdroid said:
apt-get install tightvncserver (return)
apt-get install lxde (return)
i am using pocket cloud light
Click to expand...
Click to collapse
Conap said:
eventually i would assume we would want a script to run on phone to start it which should be simple...i did get lxde ui to load
Click to expand...
Click to collapse
can you log into debian I get a grey screen on pocket cloud maybe a different vnc?
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\System32>adb devicess
'adb' is not recognized as an internal or external command,
operable program or batch file.
C:\Windows\System32>adb devices
'adb' is not recognized as an internal or external command,
operable program or batch file.
C:\Windows\System32>cd c:\
c:\>cd c:\sdk\tools
c:\sdk\tools>adb devices
List of devices attached
HT9C2HG16524 device
c:\sdk\tools>adb shell
# su
su
su
su
# su
# insmod /sdcard/loop.ko
insmod /sdcard/loop.ko
# su
su
s#su
su
# insmod /sdcard/loop.ko
insmod /sdcard/loop.ko
insmod: init_module '/sdcard/loop.ko' failed (File exists)
# sh /sdcard/debian/bootdeb.sh
sh /sdcard/debian/bootdeb.sh
modprobe: chdir(2.6.29-DecaFuctCFS-dirty-512f5dee): No such file or directory
←[H←[JAndroid Filesytem remounted as read/write
←[H←[Jmount: can't setup loop device: No such file or directory
mount: mounting devpts on /data/local/mnt/dev/pts failed: No such file or direct
ory
mount: mounting proc on /data/local/mnt/proc failed: No such file or directory
mount: mounting sysfs on /data/local/mnt/sys failed: No such file or directory
Custom Linux Pseudo Bootstrapper V1 - by Charan Singh
WEB: http://www.maharajafarms.com
EML: [email protected]
Starting init process
INIT: Debian booting.....
Running Linux Kernel
net.ipv4.ip_forward = 1
AutoMounter started
Type EXIT to end session
Make sure you type EXIT for a clean kill of Debian, Phone will reboot after shut
down!
chroot: can't execute '/bin/bash': No such file or directory
Shutting down Debian
Processes killed......
Loopback device shutdown - success
Debian down
by Charan Singh
http://www.maharajafarms.com
[email protected]
Rebooting device to ensure clean shutdown so debian doesnt eat memory ........
.
c:\sdk\tools>su
'su' is not recognized as an internal or external command,
operable program or batch file.
c:\sdk\tools>cd c:\sdk\tools
c:\sdk\tools>adb shell
# insmod /sdcard/loop.ko
insmod /sdcard/loop.ko
# busybox mount -o remount,rw /
busybox mount -o remount,rw /
# busybox mkno /dev/loop0 b 7 0
busybox mkno /dev/loop0 b 7 0
mkno: applet not found
# busybox mknod /dev/loop0 b 7 0
busybox mknod /dev/loop0 b 7 0
# sh /sdcard/debian/bootdeb.sh
sh /sdcard/debian/bootdeb.sh
modprobe: chdir(2.6.29-DecaFuctCFS-dirty-512f5dee): No such file or directory
←[H←[JAndroid Filesytem remounted as read/write
mknod: /dev/loop2: File exists
←[H←[JCustom Linux Pseudo Bootstrapper V1 - by Charan Singh
WEB: http://www.maharajafarms.com
EML: [email protected]
Starting init process
INIT: Debian booting.....
Running Linux Kernel
net.ipv4.ip_forward = 1
AutoMounter started
Type EXIT to end session
Make sure you type EXIT for a clean kill of Debian, Phone will reboot after shut
down!
xauth: (argv):1: bad display name "localhost:1" in "add" command
New 'X' desktop is localhost:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost:1.log
localhost:/# apt-get update
apt-get update
Hit http://ftp.de.debian.org lenny Release.gpg
Hit http://ftp.de.debian.org lenny Release
Ign http://ftp.de.debian.org lenny/main Packages/DiffIndex
Hit http://ftp.de.debian.org lenny/main Packages
Reading package lists... Done
W: There is no public key available for the following key IDs:
9AA38DCD55BE302B
W: You may want to run apt-get update to correct these problems
localhost:/#
How do I get rid of the error no public key available for the folowing id's says to run apt-get update, but if i do that i get this error again to run apt-get update endless looop
pocket cloud and tightvncserver working
This sounds promising, but what ui do you hope to run in the end?
Sent from my FroyoEris using XDA App
Nevermind. I read the original thread. Good luck to you all.
Sent from my FroyoEris using XDA App
to get rid of the key error i ran
gpg --recv-keys 9AA38DCD55BE302B
gpg --export 9AA38DCD55BE302B | apt-key add -
(Thanks to workshed for figuring that part out)
i still was having trouble running apt-get install whatever though...
i am able to log in through vnc and cloud now....
Not sure why but each time I chroot in I have to go in and remove all the .X files and directories from the tmp/ folder. Also have to run the command:
export HOME=/root
that can be added to bash.rc once i manage to edit it
I then run vncserver and it asks for a password.
then through cloud or androidvnc i use localhost and port 5901 and put in the password i entered above. I can't seem to get a keyboard on androidvnc so i think i'm gonna try cloud again.
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???
I'm posting this in a new thread as requested...
There is a simple way to preapare a custom Ubuntu image file compiled for ARMEL with only the packages and functionalities you need.
For this procedure you will need
- a linux machine with working ADB (I tried it on a x64 ubuntu machine)
- a rooted Iconia A500 with busybox installed
- a little knowledge about what you're doing, but just a little.
1. Install Rootstock
on your linux machine, open up the terminal and type
Code:
sudo apt-get install rootstock
If you use at least Ubuntu Karmic, it should automatically pull all the dependencies, otherwise you'll have to manually install Qemu and a newer debootstrap.
2. Create the tarball
you're ready to download the packages and prepare the tarball.
Remember: rootstock doesn't automatically include a kernel, so you'll have to manually include it in the package list
Here's the syntax for a basic run (run "man rootstock" for all the parameters):
Code:
sudo rootstock \
--fqdn [COLOR="Red"]<YOUR_CHOSEN_HOSTNAME>[/COLOR] \
--login [COLOR="Red"]<YOUR_CHOSEN_USERNAME>[/COLOR] \
--password [COLOR="Red"]<YOUR_CHOSEN_PASSWORD>[/COLOR] \
--imagesize [COLOR="Red"]<IMAGE_SIZE_IN_GB>[/COLOR]G \
--seed [COLOR="Red"]<LIST_OF_PACKAGES_SEPARATED_BY_COMMAS>[/COLOR]
Here's an example for a 2GB image with OMAP kernel and a complete Kubuntu-desktop distribution:
Code:
sudo rootstock \
--fqdn ubuntu \
--login ubuntu \
--password ubuntu \
--imagesize 2G \
--seed linux-image-omap,kubuntu-desktop
In --seed you can specify whatever package you want. You could start with just the kernel and build-essential, then add whatever you need. A good start could be like this:
Code:
--seed linux-image-omap,build-essential,lxde,tightvncserver,openssh-server
This will give you a running ubuntu with a very light, performance-oriented desktop environment (lxde) with ssh and vnc.
Remember: It's still possible to add new packages with apt-get from chroot whenever you want.
Once you have chosen the packages you want, you just have to press enter and rootstock will automatic download the packages and prepare the tarball.
You'll end up with a file named "armel-rootfs-<TIMESTAMP>.tgz"
3. Prepare the img file
This is very easy and quick:
Code:
dd if=/dev/zero of=arm_ubuntu.img bs=1MB count=0 seek=[COLOR="Red"]<SIZE_IN_MB>[/COLOR]
The seek parameter defines the size in MB of your image. make it as large as you want, it should at least be as big as the size you selected for the tarball (2G in my example).
Remember: 1 GB = 1024 MB
Now we format the image. Since the Iconia supports ext4 file system, we can use it!
Code:
mkfs.ext4 -F arm_ubuntu.img
You may want to pass other flags to define advanced options, labels and reserved blocks, but this is the least you need to make it work.
4. Decompress
Now we have to mount the img file in a loop:
Code:
sudo mount -o loop arm_ubuntu.img /mnt
and decompress the tarball into it.
Code:
sudo tar -C /mnt -zxf armel-rootfs-<TIMESTAMP>.tgz
It's done!
[OPTIONAL]
This is the right time to put custom scripts in /mnt/usr/bin like this one to start the vnc server with the correct geometry for the A500:
Code:
#!/bin/bash
rm -fr /tmp/.X1*
vncserver -geometry 1280x752
NB: the A500 screen is 1280x800, but the honeycomb statusbar (1280x48px) is always on top. To avoid panning to show the ubuntu menu bar, we just subtract those 48 pixels from the ubuntu vertical resolution.
Now we just umount it.
Code:
sudo umount /mnt
5. Load on the tablet and get it running
The script to mount and boot is derived from the one in the Backtrack 5 Thread.
Load the img file on the tablet with
Code:
adb push arm_ubuntu.img /sdcard/ubuntu/arm_ubuntu.img
It will take a loooong time and there's no progress bar, so just have faith.
Next, we prepare the boot script. The only thing you need to do is to put your username in (the one you chose in rootstock).
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/ubuntu
export bin=/system/bin
export mnt=/data/local/mnt
mkdir -p $mnt
export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
export TERM=linux
export USER=[B][COLOR="Red"]<THE_USERNAME_YOU_CHOSE_BEFORE>[/COLOR][/B]
export HOME=/home/$USER
export stor=$mnt/home/$USER/storage
export sdcard=$stor/sdcard
export extsd=$stor/external_sd
export usb=$stor/USB_storage
if [ -b /dev/loop2 ]; then
echo "Loop device exists"
else
busybox mknod /dev/loop2 b 7 0
fi
mount -o loop,rw,noatime -t ext4 $kit/arm_ubuntu.img $mnt
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
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 ubuntu" > $mnt/etc/hosts
busybox chroot $mnt /bin/bash
echo "Shutting down Ubuntu ARM for Iconia A500"
umount $sdcard
umount $extsd
umount $usb
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
Once done, we can save the file as startubuntu and adb push it to the tab. (the same folder as the img is fine)
Done! We run it by invoking the startubuntu script from the android terminal emulator (must be in superuser mode)
I hope you found this how-to useful.
And we use this distro via our tablets ssh client?
EDIT: sorry my bad Never read code while tired
Hi,
i am running ubuntu natty.
and i got this error:
...
Setting up wireless-crda (1.13) ...
Setting up linux-image-2.6.38-8-omap (2.6.38-8.42) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.38-8-omap
/bin/df: Warning: cannot read table of mounted file systems: No such file or directory
Not sure if it is fatal. rootstock has created successful the rootfs
reida010 said:
Hi,
i am running ubuntu natty.
and i got this error:
...
Setting up wireless-crda (1.13) ...
Setting up linux-image-2.6.38-8-omap (2.6.38-8.42) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.38-8-omap
/bin/df: Warning: cannot read table of mounted file systems: No such file or directory
Not sure if it is fatal. rootstock has created successful the rootfs
Click to expand...
Click to collapse
Same happened to me. Totally not fatal. the tarball is good.
For everyone out there:
I would like your help with testing. I have a crash on start problem with firefox in all the images I tried. Does any of you have the same issue?
Hi,
i get
Code:
Loop device exists
then i did
Code:
echo "$kit/arm_ubuntu.img"
and i get
Code:
/sdcard/ubuntu/arm_ubuntu.img
but then i get
Code:
mount: cannot setup loop device: No such file or directory
any ideas?
Because of firefox.
i read a while ago a tweet about a bug in meego and ubuntu in firefox for arm.
when it is this bug then you should try firefox trunk because it is fixed.
but i cannot refind it :-(
edit:
bugzilla.mozilla.org/show_bug.cgi?id=634594
I was searching for that today, thanks mate. Nice Tutorial =D
reida010 said:
Hi,
but then i get
Code:
mount: cannot setup loop device: No such file or directory
any ideas?
edit:
bugzilla.mozilla.org/show_bug.cgi?id=634594
Click to expand...
Click to collapse
i have the same problem. You should make loop file not in /mnt/sdcard, but in /mnt/external_sd.
Kh_Shad said:
i have the same problem. You should make loop file not in /mnt/sdcard, but in /mnt/external_sd.
Click to expand...
Click to collapse
That would apply only if you put the image file in the external MicroSD, if you have put it in the internal memory (as described in the tutorial) the path is /mnt/sdcard. Also, the speed of the internal memory is better.
Hi,
i found out how i can make it work
but it's strange.
i don't works when i do
Code:
sh ./startubuntu
but with this it works fine:
Code:
/system/bin/sh ./startubuntu
Is this maybe because i didn't use adb.
Someone told me that copy paste might change the permissions (what the ****! really?)
on my tablet startubuntu is not executable.
And it doesn't change anything when i do chmod 755 startubuntu
but after moving it to /system/bin chmod works fine.
After then i can always just run
Code:
su
startubuntu
and ubuntu is up and running.
(many thanks by the way :-D)
Sorry guys, will this method produce a native Ubuntu install similair to how Wubi works? Or is this like the chroot methods were we have to VNC into the distro from within Android?
It is native!!!
but you need vnc to access the xserver
On my n900 i used xephyr but i don't think this is working for android because afaik they don't use X. (n900 is so cool for linux geeks ;-D)
edit:
if you mean with 'native' that it will replace android -> no -> it is a chroot
Yeah that answered my question. Thank you
I'm not going to bother until there is a native distro running with full system resources. I guess with the current bootloader situation that day may never come :-(
It failed in creating the image for me... and it seems like a error in the package linux-image-2.6.38-8-omap
[TRIM]
Need to get 37.4 MB of archives.
After this operation, 98.3 MB of additional disk space will be used.
Get:1 //ports.ubuntu.com/ubuntu-ports/ natty/main wireless-crda armel 1.13 [15.0 kB]
Get:2 //ports.ubuntu.com/ubuntu-ports/ natty/main linux-image-2.6.38-8-omap armel 2.6.38-8.42 [19.8 MB]
Get:3 //ports.ubuntu.com/ubuntu-ports/ natty/main devio armel 1.2-1build1 [16.9 kB]
Get:4 //ports.ubuntu.com/ubuntu-ports/ natty/main flash-kernel armel 2.28ubuntu19 [13.1 kB]
Get:5 //ports.ubuntu.com/ubuntu-ports/ natty/universe kubuntu-mobile armel 1.218 [2720 B]
Get:6 //ports.ubuntu.com/ubuntu-ports/ natty/main linux-firmware all 1.52 [17.5 MB]
Get:7 //ports.ubuntu.com/ubuntu-ports/ natty/main linux-image-omap armel 2.6.38.8.22 [2394 B]
Fetched 37.4 MB in 5min 29s (113 kB/s)
Selecting previously deselected package wireless-crda.
(Reading database ... 9309 files and directories currently installed.)
Unpacking wireless-crda (from .../wireless-crda_1.13_armel.deb) ...
Selecting previously deselected package linux-image-2.6.38-8-omap.
Unpacking linux-image-2.6.38-8-omap (from .../linux-image-2.6.38-8-omap_2.6.38-8.42_armel.deb) ...
Done.
Selecting previously deselected package devio.
Unpacking devio (from .../devio_1.2-1build1_armel.deb) ...
Selecting previously deselected package flash-kernel.
Unpacking flash-kernel (from .../flash-kernel_2.28ubuntu19_armel.deb) ...
Selecting previously deselected package kubuntu-mobile.
Unpacking kubuntu-mobile (from .../kubuntu-mobile_1.218_armel.deb) ...
Selecting previously deselected package linux-firmware.
Unpacking linux-firmware (from .../linux-firmware_1.52_all.deb) ...
Selecting previously deselected package linux-image-omap.
Unpacking linux-image-omap (from .../linux-image-omap_2.6.38.8.22_armel.deb) ...
Setting up wireless-crda (1.13) ...
Setting up linux-image-2.6.38-8-omap (2.6.38-8.42) ...
Running depmod.
Failed to run depmod
dpkg: error processing linux-image-2.6.38-8-omap (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up devio (1.2-1build1) ...
No apport report written because MaxReports is reached already
Setting up flash-kernel (2.28ubuntu19) ...
Setting up kubuntu-mobile (1.218) ...
E: Second stage build in chroot failed !
E: Please see the log to see what went wrong.
Setting up linux-firmware (1.52) ...
I: Cleaning up...
dpkg: dependency problems prevent configuration of linux-image-omap:
linux-image-omap depends on linux-image-2.6.38-8-omap; however:
Package linux-image-2.6.38-8-omap is not configured yet.
dpkg: error processing linux-image-omap (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
Errors were encountered while processing:
linux-image-2.6.38-8-omap
linux-image-omap
E: Sub-process /usr/bin/dpkg returned an error code (1)
I: Umounting temporary Image
I keep getting a failure also!
Ceck out both of my log files below.
tholmewood said:
Sorry guys, will this method produce a native Ubuntu install similair to how Wubi works? Or is this like the chroot methods were we have to VNC into the distro from within Android?
Click to expand...
Click to collapse
It is a chroot/vnc method, currently the only method available to run linux on this device, because of the locked bootloader... I seriously hope for a chance to dual boot in the future.
i was wondering what packages are needed in order to create an ubuntu netbook Edition? Is the A500 powerful enough for that kind of interface?
Thought you guys might be interested in this post.
http://forum.xda-developers.com/showpost.php?p=15156543&postcount=64
Have fun!
@p-ille
Have you tried firefox daily?
Did it work?
reida010 said:
@p-ille
Have you tried firefox daily?
Did it work?
Click to expand...
Click to collapse
Not really, my job is killing me these days... I'll try it asap!
sent from my Iconia A500
p-ille said:
Not really, my job is killing me these days... I'll try it asap!
sent from my Iconia A500
Click to expand...
Click to collapse
You realize what a pain that tutorial is to follow? Could you please provide a pre built image at least if asking for scripts is probably way too much?
OK, I spent a couple of hours figuring out how loop mounting works. The problem is that the mount command in both toolbox and busybox supports only one loop device. I modified the toolbox version to allow the specification of a new loop device.
Here is how to make a 500mb loop-mounted ext2 system at /mnt/myloop , with the system being stored in /storage/sdcard/myext2system.img
Step 1. Make sure you have root. Download bettermount*.zip to your PC from here. Copy the "bettermount" file from the zip file to /data/local/ (or some other location). One way of doing that is with:
Code:
adb push bettermount /data/local
on the PC. Or you can mount your device to USB, copy bettermount to storage, and then in a root shell copy it to /data/local. Or if you have RW root, you can install bettermount in /bin or some other convenient location.
Start a shell on the device, either via adb or an on-device terminal (not recommended unless you have an external keyboard). Switch to root:
Code:
su
Then make bettermount executable:
Code:
chmod 755 /data/local/bettermount
The following steps assume you're still in your root shell.
Step 2. Create ext2 file system in a file. (Skip this if you already have one.)
Code:
dd if=/dev/zero of=/storage/sdcard/myext2system.img bs=1M count=500
mke2fs /storage/sdcard/myext2system.img
mke2fs will give you a warning that this isn't a block special device, but just press "y" and "enter".
Step 3. Create a loop device node for the ext2 file system. The problem here is that the OS uses loop device nodes for apps moved to external storage and one for the system squashfs, and it only has enough loop device nodes for those purposes--any loop device nodes in /dev/block are already in use. On the assumption that you aren't going to have more than 253 apps moved to storage, we're going to create a loop device node numbered 255. If you like, you can check that there isn't already one with that number with
Code:
ls /dev/block/loop*
So, let's create the loop device node:
Code:
mknod -m640 /dev/block/loop255 b 7 255
Step 4. Create a mount point:
Code:
mkdir /mnt/myloop
Step 5. Mount myext2filesystem.img:
Code:
/data/local/bettermount -t ext2 -orw,exec,noatime,nodiratime,sync,loop=/dev/block/loop255 /storage/sdcard/myext2system.img /mnt/myloop
Enjoy your new file system at /mnt/myloop !
You will have to repeat Steps 3-5 after every boot, or else you can make a script that runs every time you boot. You could simply put the commands for 3-5 into a Script Manager script set to run on boot, or there may be some better, more unixy way (but I haven't had any luck editing startup scripts).
What to do with your shiny new filesystem? Well, you could move not just apps but also their libraries to external storage (you can also do that by remounting your external storage in exec mode).
arpruss said:
OK, I spent a couple of hours figuring out how loop mounting works. The problem is that the mount command in both toolbox and busybox supports only one loop device. I modified the toolbox version to allow the specification of a new loop device.
Here is how to make a 500mb loop-mounted ext2 system at /mnt/myloop , with the system being stored in /storage/sdcard/myext2system.img
Step 1. Make sure you have root. Download bettermount*.zip to your PC from here. Copy the "bettermount" file from the zip file to /data/local/ (or some other location). One way of doing that is with:
Code:
adb push bettermount /data/local
on the PC. Or you can mount your device to USB, copy bettermount to storage, and then in a root shell copy it to /data/local. Or if you have RW root, you can install bettermount in /bin or some other convenient location.
Start a shell on the device, either via adb or an on-device terminal (not recommended unless you have an external keyboard). Switch to root:
Code:
su
Then make bettermount executable:
Code:
chmod 755 /data/local/bettermount
The following steps assume you're still in your root shell.
Step 2. Create ext2 file system in a file. (Skip this if you already have one.)
Code:
dd if=/dev/zero of=/storage/sdcard/myext2system.img bs=1M count=500
mke2fs /storage/sdcard/myext2system.img
mke2fs will give you a warning that this isn't a block special device, but just press "y" and "enter".
Step 3. Create a loop device node for the ext2 file system. The problem here is that the OS uses loop device nodes for apps moved to external storage and one for the system squashfs, and it only has enough loop device nodes for those purposes--any loop device nodes in /dev/block are already in use. On the assumption that you aren't going to have more than 253 apps moved to storage, we're going to create a loop device node numbered 255. If you like, you can check that there isn't already one with that number with
Code:
ls /dev/block/loop*
So, let's create the loop device node:
Code:
mknod -m640 /dev/block/loop255 b 7 255
Step 4. Create a mount point:
Code:
mkdir /mnt/myloop
Step 5. Mount myext2filesystem.img:
Code:
/data/local/bettermount -t ext2 -orw,exec,noatime,nodiratime,sync,loop=/dev/block/loop255 /storage/sdcard/myext2filesystem.img /mnt/myloop
Enjoy your new file system at /mnt/myloop !
You will have to repeat Steps 3-5 after every boot, or else you can make a script that runs every time you boot. You could simply put the commands for 3-5 into a Script Manager script set to run on boot, or there may be some better, more unixy way (but I haven't had any luck editing startup scripts).
What to do with your shiny new filesystem? Well, you could move not just apps but also their libraries to external storage (you can also do that by remounting your external storage in exec mode).
Click to expand...
Click to collapse
Which version of busybox were you testing with? I haven't had a problem with multiple loop devices...
I've been using the stock busybox: 1.7.2.
Do you use -oloop=/dev/block/loopNN to specify the device?
I just tried 1.16.0 from the Titanium Backup website. No luck. I created /dev/block/loop222. Then:
Code:
# /tmp/busybox mount -t ext2 -oloop=/dev/block/loop222 /storage/10.img /mnt/myloop
mount: can't setup loop device: No such file or directory
# bettermount -t ext2 -oloop=/dev/block/loop222 /storage/10.img /mnt/myloop
# (works!)
I also tried just plain -oloop, without the =/dev/block/loop222, and it didn't work.
arpruss said:
I've been using the stock busybox: 1.7.2.
Do you use -oloop=/dev/block/loopNN to specify the device?
I just tried 1.16.0 from the Titanium Backup website. No luck. I created /dev/block/loop222. Then:
Code:
# /tmp/busybox mount -t ext2 -oloop=/dev/block/loop222 /storage/10.img /mnt/myloop
mount: can't setup loop device: No such file or directory
# bettermount -t ext2 -oloop=/dev/block/loop222 /storage/10.img /mnt/myloop
# (works!)
I also tried just plain -oloop, without the =/dev/block/loop222, and it didn't work.
Click to expand...
Click to collapse
I can't remember if mount was symlinked to busybox at the time, but I just used the standard "mount -o loop disk1.img /mnt/disk". I may have even been on a custom kernel and had a crosscompiled mount, so good work, this is probably going to be a common problem for people.
The problem with busybox seems to be that it thinks /dev/block/loop0 is free, but it's not. Doing losetup -f returns /dev/block/loop0.
If you could mount the loopdevice in init.rc this would be the easiest way to expand the 300MB /data problem with archos.
Also it might be the best way in CM7 until its stable for the persistent Data between revisions.
fzelle said:
If you could mount the loopdevice in init.rc this would be the easiest way to expand the 300MB /data problem with archos.
Also it might be the best way in CM7 until its stable for the persistent Data between revisions.
Click to expand...
Click to collapse
I have had no luck adding anything to init.rc with the rw root.
Moreover, /storage and /storage/sdcard get mounted quite late in the boot process--late enough that I think one can't just move the /data directory there. I suppose one might be able to mount them earlier in the process, but I haven't been able to figure out how to run anything in an init script. If anybody knows how to do it, please speak up!
What one could do, however, is mount the loop from an app's on-boot notification, and then symlink individual app files.
It looks like with a better busybox than the one included with the device, one can also use losetup to specify the loop device--see here.
I built a full 1.18.5 version of Busybox, and it does loop mounting just right. You can replace Step 1 of my HOWTO with fetching my modified busybox and putting it in /data/local, from http://code.google.com/p/busybox-for-android/downloads/list
Then step 3 is not needed.
Step 4 should be replaceable with the very simple:
Code:
/data/local/busybox mount -orw,exec,noatime,nodiratime,sync,loop /storage/sdcard/myext2system.img /mnt/myloop
Or if you're pressed for time, and want to use default mount options:
Code:
/data/local/busybox mount -oloop /storage/sdcard/myext2system.img /mnt/myloop
But if you want to implement this is inside an app, depending on your license needs, you may want to use the longer method, since busybox is GPL while bettermount is Apache 2.
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.