How to Run(Chroot) Linux(Ubuntu/Debian,etc.) in your Milestone 2 - Milestone 2 General

Chrooting Linux on Android is a very popular topic, and you can find many tutorials online. I am not going to post a detailed how to here.. but, I will explain the generalized steps for the process! If anyone have any questions or need help, feel free to ask!
Get Root Access on your phone
There are many ways to get root access; Easiest will be using z4root or SuperOneClick ! Rooting is mandatory because: You need to install Busybox; Need to mount file system, etc..​
Install SuperUser App from the Market
This application allows you to grant Root access to other applications (when needed). Depending on how you rooted your phone, superuser.apk may be already installed on your phone.​
Install Busybox App from the Market
Depending on how you rooted your phone, Busybox may be already installed on your phone. In any case install this app from the market and update your busybox to the latest version. Busybox is a set of commonly used linux commands, which are not available in android by default. Eg: cp, chroot, etc.​
Install Connectbot from Android market
Connect bot is a terminal client application for android. There are other alternatives but, I recommend Connectbot! Also Connectbot has SSH support, so if you are installing an SSH server on your Ubuntu, you can connect to it using connectbot and you may totally skip the VNC for GUI. Anyway, note that you need a terminal app to start the chroot daemon!​
Install AndroidVNCViewer from Android market
With androidVNCViewer we can get GUI access to our ubuntu! This App works so fine in my Milestone 2 with Ubuntu; It even supports mouse pointer!​
Download/build a Linux rootfs for your flavour of linux
Now, you need the Ubuntu/Debian/Other linux file system for your Phone's processor. Like most of the Android phones, Milestone 2 uses an ARM processor. And Ubuntu offers full support for ARM processors. It is so easy to build ubuntu for ARM(OMAP) platform using rootstock/bootstrap method. I used rootstock method for Ubuntu as explained here.
PS: For your first time, make sure you build, "Ubuntu Lucid" (just use the --seed/-s parameter of rootstock command. I was not able to use 11.04(Natty). Once you get Lucid to work, you can surely try yourself for the other versions! )​
Create a mountable .img file with a size suited for you
From rootstock, you will get a .tgz file! You will need to convert this to a mountable .img file.
In order to create an empty ubuntu.img file, use the followed command in your ubuntu-desktop's terminal; the last arguement (2048) specifies size of the Ubuntu rootfs (If you need much disk space when you are in ubuntu, use a large value here. Normally 2GB will be sufficient for you; even with GUI/VNC).
Code:
dd if=/dev/zero of=ubuntu.img bs=1MB count=0 seek=2048
Next, format our empty ubuntu.img with a suitable ext2/ext3/ext4 file system!
For Milestone 2, you should use ext3 (I think it does not support ext2). ext4 is supported only in Gingerbird+. So, you should use the appropriate command based on your mobile
Code:
mkfs.ext2 -F ubuntu.img
mkfs.ext3 -F ubuntu.img
mkfs.ext4 -F ubuntu.img
You can find out the suitable file system by opening Connectbot in your mobile and entering the followed command. In the output, look for words ext2/ext3/ext4!
Code:
su
mount
Once you format ubuntu.img with appropriate file system. We should temporarily mount the ubuntu.img in a somewhere and we should extract the armel-rootfs-xx.tgz to it. You can use these commands
Code:
sudo mount -o loop ubuntu.img /mnt
sudo tar -C /mnt -zxf armel-rootfs--xx.tgz
sudo umount /mnt
Download(and modify) or create a Shell script for automatically mounting your Chroot image
This is the most important part, we have to run a set of commands in our android shell to get into the ubuntu. To make things easier, we will write these command-sequence in a shell script, and whenever we need we simple call this script. Cool isn't it?. Basically this is what this script should do:
Code:
1. Check if there exists an ubuntu.img file as we specify in command line
2. Create a loop device with the ubuntu.img - ie. Make android(linux) believe that ubuntu.img is a mountable device.
3. Mount the newly created loop device to a folder. My script mounts the image to /data/local/chrootos
4. Set some environment variables in the shell
5. Mount the [I]devpts, proc, sysfs[/I] for the ubuntu!
6. Run the Chroot command. This command actually changes the root of file system to a new directory we specify. ie. we fake [B]/data/local/chrootos[/B] as the rootfs![B]/[/B]
Create a folder in your Phone's SD Card and copy one or more(If you want to choose between: Debian/Ubuntu/Puppy/etc) .img files and your shell script for booting linux into it.
Create a folder named .chroot in your SD Card. If you have a "." as the first character, this folder will be hidden in the Android File Browser. And will avoid you accidentally modifying these files.​
Get into your Phone's Shell through ConnectBot / USB-ADB / Terminal Emulator
Enter su in the terminal to get root access
Remount your Android filesystem to get write access to your phones
By default, the android file system is read only. So in order to write to the files sytem, we have to remount it with the following command.
Code:
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
Copy your bootscript to /system/bin so that you can easily start your LinuxIf you have downloaded my bootscript, the file name will be bl - short for boot linux. So, once you copied you will have your shell script at /system/bin/bl. Once we copy the shell script to the bin directory, it will work as a shell command.​
Start your linux and customize it
If you have done everything correctly so far, you can now boot into your ubuntu.img with the following command. Note that you do not need to specify the full file name "ubuntu.img".
Code:
bl ubuntu
Start your linux and customize it
If Chroot was a success, you will see the ubuntu shell prompt. And then you can start installing more stuff, etc. [email protected]:​
Downloads & Screenshots
Screenshots: http://goo.gl/PzVI0
My Shell Script for starting linux: http://goo.gl/il3nJ
My ubuntu.img: Coming Soon​Password
Code:
arunraj.in
Common Errors
The most common error will be when we are dealing with the "loop device". Because, according to the apps installed in your device, there may not be a free loop device available. If you are facing errors, feel free to ask me and I will try and help!​

Thanks, man! When I have time I'm gonna try it out.
Sent from my Milestone 2 XDA App

thanks for tutorial. will try this soon

Script didn't work :/

Gongui20 said:
Script didn't work :/
Click to expand...
Click to collapse
Do you get any error message?

Thanks !
It's very interesting.I will try it when I have some free time.

echo "Linux Chrooter: Chroot!"
chroot $mnt /bin/bash
Click to expand...
Click to collapse
/bin/bash didnt exist or something like that.

Gongui20 said:
/bin/bash didnt exist or something like that.
Click to expand...
Click to collapse
I think there was no free loop device available for mounting the image.
could run these commands as root and send me the output(the txt files created)?
Code:
mount > mount-list.txt
losetup -f > losetup1.txt
losetup /dev/block/loop1 /sdcard/.chroot/ubuntu.img > losetup2.txt

losetup1.txt
/dev/loop0
Click to expand...
Click to collapse
mount-list.txt
rootfs / rootfs ro,relatime 0 0
tmpfs /dev tmpfs rw,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
/dev/block/mmcblk1p21 /system ext3 ro,noatime,nodiratime,barrier=1,data=ordered 0 0
/dev/block/userdata /data ext3 rw,nosuid,nodev,noatime,nodiratime,errors=continue,barrier=1,data=ordered 0 0
/dev/block/cache /cache ext3 rw,nosuid,nodev,noatime,nodiratime,errors=continue,barrier=1,data=ordered 0 0
tmpfs /tmp tmpfs rw,relatime,size=2048k 0 0
/dev/block/pds /pds ext3 rw,nosuid,nodev,noatime,nodiratime,barrier=1,data=ordered 0 0
/dev/block/preinstall /preinstall ext3 rw,nosuid,nodev,noatime,nodiratime,barrier=1,data=ordered 0 0
/dev/block/vold/179:1 /mnt/sdcard vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/179:1 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
tmpfs /mnt/sdcard/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
/dev/block/dm-0 /mnt/asec/com.rovio.angrybirdsrio-1 vfat ro,dirsync,nosuid,nodev,noexec,relatime,uid=1000,fmask=0222,dmask=0222,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/dm-1 /mnt/asec/com.rovio.angrybirds-1 vfat ro,dirsync,nosuid,nodev,noexec,relatime,uid=1000,fmask=0222,dmask=0222,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/dm-2 /mnt/asec/org.xbmc.android.remote-2 vfat ro,dirsync,nosuid,nodev,noexec,relatime,uid=1000,fmask=0222,dmask=0222,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
Click to expand...
Click to collapse
losetup2.txt is empty.

Yeap, I faced the same error when I was doing it. If you notice the mount-list.txt, you can see that AngryBirds application is using /dev/block/dm-0 and /dev/block/dm-1. /dev/block/dm-2 is also in use.
You could try this:
Edit the script bl and replace /dev/block/loop1 in the script with /dev/block/dm-3. It might just do the trick.

Hey check this out:
http://androlinux.com/android-ubuntu-development/how-to-install-ubuntu-on-android/

Works on Asus TF101
Hi
Thanks for the guide. I got it running on my Asus TF101. I had to modify your script slightly :
The /system filesystem is mounted as ext4 (not yaffs)
The /system fs is mounted from /dev/block/mmcblk0p1
/dev/block/mmcblk0p1 /system ext4 rw,relatime,barrier=1,data=ordered 0 0
Click to expand...
Click to collapse
Apart from that no other changes were necessary.

Need Help!!!!
hi ~ I just put the img file in /sdcard/.chroot/.linux/ ,named ubuntu.img and edited the Script
but when I run the script ,there is a problem in line:
mount -t ext3 /dev/block/loop1 $mnt
it said:
Device or resourc busy
I have tried thousand ways and cost 5 days,but I can't solve it.....
can you help me?
sorry for my poor english...
losetup1.txt
/dev/loop0
I also replace /dev/block/loop1 in the script with /dev/block/dm-5,but I need use command :"mknod /dev/block/dm-5 b 7 0" first.

the error Screenshots and mount

echoeye said:
the error Screenshots and mount
Click to expand...
Click to collapse
Hi,
Which is your Mobile ?
Also -- Did you see reply #7, #8 on page 1 of this thread ?

There is another way to mount it without using the option -oloop
If you look into /dev/block you are going to find 8 loop devices, from loop0 to loop7. As android doesn't use that many loop devices it should be enough. You can mount it like this:
Code:
losetup /dev/block/loop7 /sdcard/ubuntu/ubuntu.img
mount -t ext3 /dev/block/loop7 /mnt/ubuntu
If your phone doesn't have a free loop device, you can create a new one, like this:
Code:
mknod /dev/block/loop99 b 7 99
losetup /dev/block/loop99 /sdcard/ubuntu/ubuntu.img
mount -t ext3 /dev/block/loop99 /mnt/ubuntu

The problem is you have apps installed to the sd card (and getting mount points busy), when it happens here I just open Titanium Backup and move External apps to internal.
No matter what I tried here, this script wouldn't work... So I used DebOnDroid app from defy forum, and when updated to GB. The app stopped working also, so I moved the ubuntu.img to /data/local/ and mounted from there, works like a charm!
This is the script I'm using /system/bin/buntu:
Code:
export mnt=/data/local/debian
export PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin
export TERM=linux
export HOME=/root
export USER=root
echo "Linux Chrooter: Setup Networking"
sysctl -w net.ipv4.ip_forward=1
#necessary mount points
busybox mount -o loop $mnt/../debian.img $mnt
busybox mount -t devpts devpts $mnt/dev/pts
busybox mount -t sysfs sysfs $mnt/sys
busybox mount -t proc proc $mnt/proc
#extra mount points
busybox mount -o rw /system $mnt/mnt/s
busybox mount /data $mnt/mnt/d
busybox mount /sdcard $mnt/mnt/sd
echo "Linux Chrooter: Chroot!"
chroot $mnt /bin/bash
umount $mnt/sys
umount $mnt/proc
umount $mnt/dev/pts
umount $mnt/mnt/*
#somehow the commented lines didn't work...
#umount $mnt/mnt/d
#umount $mnt/mnt/s
umount $mnt
PS: when I copy a binary from ubuntu to /system/bin and chmod, it won't exec, why?
Sent from my Milestone 2 XDA App

r2beta0 said:
There is another way to mount it without using the option -oloop
If you look into /dev/block you are going to find 8 loop devices, from loop0 to loop7. As android doesn't use that many loop devices it should be enough. You can mount it like this:
Code:
losetup /dev/block/loop7 /sdcard/ubuntu/ubuntu.img
mount -t ext3 /dev/block/loop7 /mnt/ubuntu
If your phone doesn't have a free loop device, you can create a new one, like this:
Code:
mknod /dev/block/loop99 b 7 99
losetup /dev/block/loop99 /sdcard/ubuntu/ubuntu.img
mount -t ext3 /dev/block/loop99 /mnt/ubuntu
Click to expand...
Click to collapse
thank you very very very very very very very very very very very very very very very much!!!!
I made it!!!
oh yeah!~~~~

How is this different from using an app like linuxinstaller? Well, apart from doing it manually and the nerdy way of course?
Is it safer? I am intrigued by the possibility of having a working ubuntu in my pocket, but am wondering if I should go this way or try the app.
great guide though... i think this is the push i needed to finally try this.

Nice job! but i got this..
Nice job!
I got this
#bl ubuntu
bl: permission denied
#
;/

Related

RA 1.6.2 SDcard woes.

Alright, So I'm trying to enable JIT on my phone, but I'm running into a problem where when I cd into /sdcard and try to ls, the directory shows as empty. Trying to cd into anything gives me this
Code:
/sbin/sh: cd: can't cd to /sdcard/dusted
My question is, what are the commands to mount my sdcard with -rw permissions?
abcdfv said:
Alright, So I'm trying to enable JIT on my phone, but I'm running into a problem where when I cd into /sdcard and try to ls, the directory shows as empty. Trying to cd into anything gives me this
Code:
/sbin/sh: cd: can't cd to /sdcard/dusted
My question is, what are the commands to mount my sdcard with -rw permissions?
Click to expand...
Click to collapse
try mount -a
or
try mount /sdcard/
mount -a returns
Code:
mount: mounting /dev/block/mmcblk0p2 on /system/sd failed: no such file or directory
mount /sdcard returns
Code:
mount: mounting /dev/block/mmcblk0p1 on /sdcard failed: device or resource busy
Then try:
Code:
mkdir /system/sd
mount -a
Code:
mkdir /system/sd
mkdir: canot create directory '/system/sd': File exists
Tried a different SDcard. Same problem.
Also, the JIT guide can be misleading. At first I thought it meant to do all of this while the phone is in recovery. Needless to say, that does not work.
I got the same results as you, so maybe that is the problem.
The phone needs to be fully booted.
whats happens when you do a 'adb remount'?
Code:
remount failed: invalid argument
Tried killing the adb server and restarting it. Still a no go.
abcdfv said:
Code:
mkdir /system/sd
mkdir: canot create directory '/system/sd': File exists
Tried a different SDcard. Same problem.
Click to expand...
Click to collapse
Looks like the ext partition on the SD card is missing. Did you repartition adding both ext and swap?
I don't run a2sd
abcdfv said:
I don't run a2sd
Click to expand...
Click to collapse
Then it's not going to mount /system/sd since that is a2sd.
I'm not trying to mount an ext partition. I'm trying to mount the sdcard itself.
abcdfv said:
I'm not trying to mount an ext partition. I'm trying to mount the sdcard itself.
Click to expand...
Click to collapse
Your errors above seem to indicate that the sd card is mounted. As to wether its readable is another matter. What do you get when your do a:
Code:
ls /sdcard
Have you tried rebooting into recovery?
Boot the phone into Android.
Open ADB and type mount.
Paste the results here.
From Android
Code:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Administrator>cd /android/tools
C:\android\tools>adb shell
# mount
mount
rootfs / rootfs ro 0 0
tmpfs /dev tmpfs rw,mode=755 0 0
devpts /dev/pts devpts rw,mode=600 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
tmpfs /sqlite_stmt_journals tmpfs rw,size=4096k 0 0
none /dev/cpuctl cgroup rw,cpu 0 0
/dev/block/mtdblock3 /system yaffs2 ro 0 0
/dev/block/mtdblock5 /data yaffs2 rw,nosuid,nodev 0 0
/dev/block/mtdblock4 /cache yaffs2 rw,nosuid,nodev 0 0
/dev/block//vold/179:1 /sdcard vfat rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=
1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,s
hortname=mixed,utf8,errors=remount-ro 0 0
#
From recovery
Code:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Administrator>cd /android/tools
C:\android\tools>adb shell
/ # mount
mount
rootfs on / type rootfs (rw)
tmpfs on /dev type tmpfs (rw,mode=755)
devpts on /dev/pts type devpts (rw,mode=600)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
/dev/block/mtdblock4 on /cache type yaffs2 (rw,nodev,noatime,nodiratime)
/ #

[Q] How to uninstalling from console

I recently got the SGS G3 I5800 and tried uninstall the preinstalled apps. Because i do not trust closed source software on Android for several reasons i tried to remove the preinstalled apps with ConnectBot local. I did root the phone but i do not have the rights to remove or modify any .apk or .odex in /system/app.
If i try chown or chmod to set new user/group rights i just get the output that it is readonly. Is there some kind of special trick to remove those apps or change the rights? I mean, if i am root and the user and the group rights for a package are root:root i would guess that i am able to delete those files, at least that's how it works on linux. I checked the rights also by using the ls -l command, i should be able to.
I rooted the phone with the instructions from here but i did not update busybox, i wanted to build it myself.
Any idea how to uninstall without fancy applications?
Interested in this as well! I haven't tried anything so far but was thinking about just removing the files from system/app. Is that the way it's supposed to be done?
Sent from my Nexus One using XDA App
Ok i found out what the problem was and here is a solution, which i take no responsibility for when somebody f**ks up their phone.
You need the Android-SDK from Google to get adb shell and of course your phone must be rooted.
Your phone must be set to debugging mode which can be enabled by selecting the checkbox USB-debugging under Options->Applications-Development.
So this is how it works:
After installating the sdk, open command promt by pressing the Windows-key + R and typing "cmd". Go to the installation path of the android-sdk by typing:
cd c:\Program Files\Android\android-sdk-windows\platform-tools .
Code:
adb shell
su
Check your phone for popups if you gain root access via remote. There will be a popup-dialog from the superusers app.
Code:
mount
The result should look something like this:
Code:
rootfs / rootfs rw 0 0
tmpfs /dev tmpfs rw,mode=755 0 0
devpts /dev/pts devpts rw,mode=600 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
tmpfs /sqlite_stmt_journals tmpfs rw,size=4096k 0 0
/dev/block/stl6 /system rfs rw,vfat,llw,check=no,gid/uid/rwx,iocharset=cp437 0 0
/dev/block/stl7 /data rfs rw,nosuid,nodev,vfat,llw,check=no,gid/uid/rwx,iocharse
t=cp437 0 0
/dev/block/stl8 /cache rfs rw,nosuid,nodev,vfat,llw,check=no,gid/uid/rwx,iochars
et=cp437 0 0
/dev/block/stl4 /efs rfs rw,nosuid,nodev,vfat,llw,check=no,gid/uid/rwx,iocharset
=cp437 0 0
/dev/block//vold/179:1 /sdcard vfat rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=
1015,fmask=0702,dmask=0602,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,s
hortname=mixed,utf8,errors=remount-ro 0 0
#
This is a bit complex for none average users. There are a few partitions, which basically means that the storage is split into pieces. Applications are stored in /system/app and /system is a partion itself, you need to look for it.
So my phone tells me it is /dev/block/stl6 but the problem is that it's mounted as read only, so there is no way to write on it without remounting it and that's what we do.
Code:
mount -o remount,rw /dev/block/stl6 /system
Now navigate to the application directory by writing
Code:
cd /systems/app
Now all you got to do is find the application you hate/don't want and delete it, but be carefull, you could screw up the phone.
As an example
Code:
rm Email.apk
If you are done deleting apps, mount the partion as readonly with
Code:
mount -o remount,ro /dev/block/stl6 /system
and to close the root-session type in
Code:
exit
Done
codeInTheShell said:
Code:
mount -o remount,rw /dev/block/stl6 /system
Click to expand...
Click to collapse
It suffices to issue
Code:
mount -o remount,rw /system
and
Code:
mount -o remount,ro /system
afterwards.
So it is not necessary to have a look first at the output of mount and to remember what is mounted where.
Code:
mount -o remount,rw /dev/block/stl6 /system
This is the only way to remount with ConnectBot local and with adb, the other way doesn't work at least it doesn't work local.
Buy and download RootExplorer from market and if you have a rooted phone u can delete preinstalled apps from /system/app.
In RE you must set rw filesystem by tap that option in /system/app folder.
Cheers
Sent from my GT-I5800 using Tapatalk
Dude ... srsly read before you post ...
and if I want to only temporarily remove an app? can I move the app to sd using root explorer and when I want to use it again just move it back to system/app?
Sent from my Nexus One using XDA App
Not sure, i just wanted to find out how to remove apps without an app like root explorer. You could probably move or copy them to your sdcard and if you want them back you could reinstall them ... give it a try, but before that backup your apps

About data2loop to increase stability

My English is poor, so I only give the code, without more explanation.
code modiy from ownhere's data2ext
create 3rd ext4 partion for loopback device.
Please note '-o sync,commit=5',This will enhance the stability.
Code:
$BUSYBOX mknod /dev/loop0 b 7 0
$BUSYBOX losetup /dev/loop0 /dev/block/mmcblk3p3
$BUSYBOX mount -t ext4 -o sync,commit=5,barrier=1,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /dev/loop0 /mnt/asec/extdata
you can turn off journal for speed:
Code:
/system/bin/tune2fs -O ^has_journal /dev/block/mmcblk3p3
Code:
busybox ls -lL /dev/loop*
brw------- 1 0 0 7, 0 Jan 9 19:17 /dev/loop0
brw------- 1 0 0 7, 1 Jan 9 19:17 /dev/loop1
brw------- 1 0 0 7, 2 Jan 9 19:17 /dev/loop2
brw------- 1 0 0 7, 3 Jan 9 19:17 /dev/loop3
brw------- 1 0 0 7, 4 Jan 9 19:17 /dev/loop4
brw------- 1 0 0 7, 5 Jan 9 19:17 /dev/loop5
brw------- 1 0 0 7, 6 Jan 9 19:17 /dev/loop6
brw------- 1 0 0 7, 7 Jan 9 19:17 /dev/loop7
Scoring won't be so high, but stability will increase a lot
Hi Chenglu, I've actually already tried to modify your original data2loop script to use ext4 and run it with a kernel with ext4 built in. It actually benchmarks great on first boot, somewhat better than the original ext2 data2loop version, but the tablet won't boot again, it crashes sometime during boot and I have to wipe data and restart.
Not sure if the sync,commit=5 options will make a difference - maybe I'll give that a try and see if it helps...
EDIT: No, it still pukes out on reboot, those options don't make a difference. I've attached my inandop.sh file here. If you diff this with yours, there are only a few changes, and I'm just not sure why it doesn't work. Any ideas?
Chenglu...
Thanks... this should help... but I am still very concerned with this approach..
Even though you are performing a sync you still can not guarantee that the data has been flushed out.. Flushing will depend on what other operations are in queue within the I/O sub system. In addition, right now you have a commit of every 5 seconds which honestly again leaves room for possible corruption. Again should help as this setting is meant for removable storage...
Lastly DO NOT turn off the Journal. yes it will speed up the file system BUT at a HUUGE risk of data loss in the event of unclean shutdown. This is your only fail safe that ensures filesystem consistency even across unclean shutdown.
Generally I agree with this approach for many situations but NOT your entire system partition or critical data partitions...
These devices are too portable with unreliable power sources (not the battery but the ability for it to reboot on its own and the ability for you to accidentally power it off)..
I for one am against this performance boost...
Chenglu said:
My English is poor, so I only give the code, without more explanation.
code modiy from ownhere's data2ext
create 3rd ext4 partion for loopback device.
Please note '-o sync,commit=5',This will enhance the stability.
Code:
$BUSYBOX mknod /dev/loop0 b 7 0
$BUSYBOX losetup /dev/loop0 /dev/block/mmcblk3p3
$BUSYBOX mount -t ext4 -o sync,commit=5,barrier=1,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /dev/loop0 /mnt/asec/extdata
you can turn off journal for speed:
Code:
/system/bin/tune2fs -O ^has_journal /dev/block/mmcblk3p3
Code:
busybox ls -lL /dev/loop*
brw------- 1 0 0 7, 0 Jan 9 19:17 /dev/loop0
brw------- 1 0 0 7, 1 Jan 9 19:17 /dev/loop1
brw------- 1 0 0 7, 2 Jan 9 19:17 /dev/loop2
brw------- 1 0 0 7, 3 Jan 9 19:17 /dev/loop3
brw------- 1 0 0 7, 4 Jan 9 19:17 /dev/loop4
brw------- 1 0 0 7, 5 Jan 9 19:17 /dev/loop5
brw------- 1 0 0 7, 6 Jan 9 19:17 /dev/loop6
brw------- 1 0 0 7, 7 Jan 9 19:17 /dev/loop7
Click to expand...
Click to collapse
Fast internal storage and ext4 partion is the fundamental solution.
loopback device In some respects have an advantage.
I dont dispute the performance gain... but at a risk. Everyone should be aware of this and accept the risk... If you do then thats fine...
I guess I'm more conservative when it comes to my data.
Chenglu said:
Fast internal storage and ext4 partion is the fundamental solution.
loopback device In some respects have an advantage.
Click to expand...
Click to collapse
rcgabriel said:
Hi Chenglu, I've actually already tried to modify your original data2loop script to use ext4 and run it with a kernel with ext4 built in. It actually benchmarks great on first boot, somewhat better than the original ext2 data2loop version, but the tablet won't boot again, it crashes sometime during boot and I have to wipe data and restart.
Not sure if the sync,commit=5 options will make a difference - maybe I'll give that a try and see if it helps...
EDIT: No, it still pukes out on reboot, those options don't make a difference. I've attached my inandop.sh file here. If you diff this with yours, there are only a few changes, and I'm just not sure why it doesn't work. Any ideas?
Click to expand...
Click to collapse
your busybox support ext4?
Chenglu said:
your busybox support ext4?
Click to expand...
Click to collapse
good point, that was a mistake. I am now using a statically compiled version of mkfs.ext4 that seems to work. Mount doesn't need explicit ext4 support in busybox, should just work. And I think I'm using a version of fsck that supports ext4.
EDIT: Okay, I'm using mkfs.ext4 which I've tested from the command line and it is clearly making a real ext4 filesystem. Also using a version of es2fsck that ought to work with ext4. These are both from the Desire forums, but seem to be generic ARM binaries so they seem to run on our G Tablet.
Still same result - works on first boot, not thereafter.
Maybe I need to use a version of busybox that explicitly supports ext4? Trying that next.
BTW, I got the binaries I'm using from the data2ext.zip file here: http://forum.xda-developers.com/showthread.php?t=859419
Also - ownhere's script looks pretty badass. We should consider using something based on that.
EDIT2: I am using busybox, mkfs.ext4 and e2fsck from the Desire forums, so it should support ext4 fully. Nonetheless, the exact same screen flicker followed by screen shutting off occurs with this. Attached is my updated inandop.sh. This is just baffling.
rcgabriel said:
good point, that was a mistake. I am now using a statically compiled version of mkfs.ext4 that seems to work. Mount doesn't need explicit ext4 support in busybox, should just work. And I think I'm using a version of fsck that supports ext4.
EDIT: Okay, I'm using mkfs.ext4 which I've tested from the command line and it is clearly making a real ext4 filesystem. Also using a version of es2fsck that ought to work with ext4. These are both from the Desire forums, but seem to be generic ARM binaries so they seem to run on our G Tablet.
Still same result - works on first boot, not thereafter.
Maybe I need to use a version of busybox that explicitly supports ext4? Trying that next.
BTW, I got the binaries I'm using from the data2ext.zip file here: http://forum.xda-developers.com/showthread.php?t=859419
Also - ownhere's script looks pretty badass. We should consider using something based on that.
EDIT2: I am using busybox, mkfs.ext4 and e2fsck from the Desire forums, so it should support ext4 fully. Nonetheless, the exact same screen flicker followed by screen shutting off occurs with this. Attached is my updated inandop.sh. This is just baffling.
Click to expand...
Click to collapse
I'm working on this as well...
Took a look at your script. It looks like you've put everything (including busybox) into /system/bin instead of /system/xbin? Your environment variable for busybox shows /system/bin...
Just wanted to confirm...
rcgabriel said:
EDIT2: I am using busybox, mkfs.ext4 and e2fsck from the Desire forums, so it should support ext4 fully. Nonetheless, the exact same screen flicker followed by screen shutting off occurs with this. Attached is my updated inandop.sh. This is just baffling.
Click to expand...
Click to collapse
I'm unable to get the loop file to mount as ext4 with ADB after it fails...
I'm not sure if/why it actually mounted in the first place, but I'm thinking this is a kernel issue. Are you positive that your kernel supports ext4? Also, I'm thinking ext4 might need to be compiled into the kernel instead of a module.
I could be wrong, though....
Also check which mount binary you are using. Busybox has one, but there is also a "mount" sometimes linked to the "toolbox" binary in /system/bin.
Ok so I (sort of) got it working.
After getting a kernel that is known working with ext4, the system was able to mount the partition again. I was getting the vegan "loop", so I went in with ADB and saw that the partition was mounted but all of the files were gone.
I then booted into CW and mounted USB, and at the same time on my PC I extracted my /data/data folder from a recent clockwork backup and copied it to /sdcard. I then unmounted USB and mounted /system and /sdcard from CW. Then from ADB I copied the data folder over to /mnt/asec/extdata and fixed the perms. I created empty folders for app-private and anr because they were empty on my backup (other than a traces.txt file in anr).
After bouncing the tab it booted up, but some of my settings were blown away. No big deal. Quadrant crashes at the I/O test part, but it might be because I don't have an Internet connection. The wifi is broken with the kernel I'm using.
Let me know if you still can't get things mounted. I'll test this more tomorrow when I get a fixed kernel.
I'm going to start working on the alternate approach of adding a 3rd partition...
anlog said:
Ok so I (sort of) got it working.
After getting a kernel that is known working with ext4, the system was able to mount the partition again. I was getting the vegan "loop", so I went in with ADB and saw that the partition was mounted but all of the files were gone.
I then booted into CW and mounted USB, and at the same time on my PC I extracted my /data/data folder from a recent clockwork backup and copied it to /sdcard. I then unmounted USB and mounted /system and /sdcard from CW. Then from ADB I copied the data folder over to /mnt/asec/extdata and fixed the perms. I created empty folders for app-private and anr because they were empty on my backup (other than a traces.txt file in anr).
After bouncing the tab it booted up, but some of my settings were blown away. No big deal. Quadrant crashes at the I/O test part, but it might be because I don't have an Internet connection. The wifi is broken with the kernel I'm using.
Let me know if you still can't get things mounted. I'll test this more tomorrow when I get a fixed kernel.
I'm going to start working on the alternate approach of adding a 3rd partition...
Click to expand...
Click to collapse
The kernel should support ext4, I built it myself with ext4 enabled in the config file. And yeah, I put the busybox executable in /system/bin so it wouldn't conflict with the one in /system/xbin that Vegan already has. I also dumped mkfs.ext4 in /system/bin.
What I realized is that busybox has a nasty habit of failing partially at doing things - I keep assuming that it's exactly like the stock Linux command line tools, and it's not always identical. I ended up tearing out the important stuff and running it as a standalone test script from the command line to see what was happening.
Mkfs.ext4 runs with no obvious issues (I see it creates a journal at the end, so I know it's creating an ext4 filesystem now).
But then I got an error:
Code:
mount: mounting /dev/loop0 on /mnt/asec/extdata failed: Invalid argument
followed by:
Code:
umount: can't umount /mnt/asec/extdata: Invalid argument
e2fsck 1.41.6 (30-May-2009)
ext2fs_check_if_mount: Can't check if filesystem is mounted due to missing mtab file while determining whether /data/ext4 is mounted.
/system/bin/e2fsck: Superblock invalid, trying backup blocks...
/system/bin/e2fsck: Bad magic number in super-block while trying to open /data/ext4
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
mount: mounting /dev/loop0 on /mnt/asec/extdata failed: Invalid argument
So mount failed to mount the file device that was created - that would seem to be a big issue. And then e2fsck failed to fsck it that one I'm baffled by.
I don't really understand how this "partially works" when it runs from inandop.sh but seems to fail entirely when I run it from the command line, but I sense that it "works once" because something it's getting sometimes written as ext4 sometimes as ext2/3 and that's leading obviously to corruption. Will figure more out later when I have time. I may just try adapting ownhere's script directly, he's obviously put a ton of thought into filesystem stuff and I'm not an expert in that area at all.
rcgabriel said:
The kernel should support ext4, I built it myself with ext4 enabled in the config file. And yeah, I put the busybox executable in /system/bin so it wouldn't conflict with the one in /system/xbin that Vegan already has. I also dumped mkfs.ext4 in /system/bin.
What I realized is that busybox has a nasty habit of failing partially at doing things - I keep assuming that it's exactly like the stock Linux command line tools, and it's not always identical. I ended up tearing out the important stuff and running it as a standalone test script from the command line to see what was happening.
Mkfs.ext4 runs with no obvious issues (I see it creates a journal at the end, so I know it's creating an ext4 filesystem now).
But then I got an error:
Code:
mount: mounting /dev/loop0 on /mnt/asec/extdata failed: Invalid argument
followed by:
Code:
umount: can't umount /mnt/asec/extdata: Invalid argument
e2fsck 1.41.6 (30-May-2009)
ext2fs_check_if_mount: Can't check if filesystem is mounted due to missing mtab file while determining whether /data/ext4 is mounted.
/system/bin/e2fsck: Superblock invalid, trying backup blocks...
/system/bin/e2fsck: Bad magic number in super-block while trying to open /data/ext4
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
mount: mounting /dev/loop0 on /mnt/asec/extdata failed: Invalid argument
So mount failed to mount the file device that was created - that would seem to be a big issue. And then e2fsck failed to fsck it that one I'm baffled by.
I don't really understand how this "partially works" when it runs from inandop.sh but seems to fail entirely when I run it from the command line, but I sense that it "works once" because something it's getting sometimes written as ext4 sometimes as ext2/3 and that's leading obviously to corruption. Will figure more out later when I have time. I may just try adapting ownhere's script directly, he's obviously put a ton of thought into filesystem stuff and I'm not an expert in that area at all.
Click to expand...
Click to collapse
I was able to reboot 5 times and it kept the settings for me. I just couldnt test all apps because wifi was broken with the kernel I was using. I can test more today.
Are you sure that your ext4 format is completing? I got an mtab error when first trying to create the journal, so I just changed the script to format it with the -O ^has_journal option and it competed.
Vegan runs fine for me with latest busybox...
modify init.rc for mount ext4 /data
you must have tune2fs mkfs.ext4 e2fsck binary file.
Code:
#!/system/bin/sh
##get highest priority
/system/bin/renice -20 -r -g $$
ECHO_TARGET=/misc/inandop.log
BUSYBOX="/system/bin/busybox"
#data2loop by xiaolu
echo "try data2loop" >> $ECHO_TARGET
if [ "`$BUSYBOX df /dev/loop0 | grep loop`" != "" } ; then
exit 0
fi
$BUSYBOX ln -s /dev/block/loop0 /dev/loop0
$BUSYBOX ln -s /dev/block/loop1 /dev/loop1
$BUSYBOX ln -s /dev/block/loop2 /dev/loop2
$BUSYBOX ln -s /dev/block/loop3 /dev/loop3
$BUSYBOX ln -s /dev/block/loop4 /dev/loop4
$BUSYBOX ln -s /dev/block/loop5 /dev/loop5
$BUSYBOX ln -s /dev/block/loop6 /dev/loop6
$BUSYBOX ln -s /dev/block/loop7 /dev/loop7
if [ ! -e /data/system.firstrun.finish ];
then
# first run data not create do nothing, data2loop after reboot
#/system/bin/mkfs.ext4 -b 4096 -m 0 -F -L userdata /dev/block/mmcblk3p2
#/system/bin/tune2fs -o journal_data_writeback /dev/block/mmcblk3p2
#/system/bin/e2fsck /dev/block/mmcblk3p2
#/system/bin/tune2fs -O ^has_journal /dev/block/mmcblk3p2
$BUSYBOX mkdir /data/anr
$BUSYBOX touch /data/system.firstrun.finish
exit 0;
fi
$BUSYBOX umount /cache
echo "0" > /data/misc/screen_lock_status
$BUSYBOX chown 1000.1000 /data/misc/screen_lock_status
$BUSYBOX chmod 644 /data/misc/screen_lock_status
$BUSYBOX mkdir /mnt/asec/extdata
/system/bin/tune2fs -o journal_data_writeback /dev/block/mmcblk3p2
$BUSYBOX mount -t ext4 -o remount,barrier=0,nobh,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /dev/block/mmcblk3p2 /data
result=$?
echo "mount mmcblk3p2:$result" >> $ECHO_TARGET
$BUSYBOX chown 1000.1000 /data
$BUSYBOX chmod 771 /data
echo "+++Need create loopback device for data, please wait... " >> $ECHO_TARGET
if [ ! -e /data/data2loop.finish ];
then
if [ -e /dev/block/mmcblk3p3 ];
then
echo "+++Found mmcblk3p3, will use it for /data/data, create ext4 fs on it now..." >> $ECHO_TARGET
/system/bin/mkfs.ext4 -b 4096 -m 0 -F -L extdata /dev/block/mmcblk3p3
/system/bin/tune2fs -o journal_data_ordered /dev/block/mmcblk3p3
/system/bin/e2fsck -y -v -f /dev/block/mmcblk3p3
#/system/bin/tune2fs -O has_journal /dev/block/mmcblk3p3
/system/bin/tune2fs -O ^has_journal /dev/block/mmcblk3p3
$BUSYBOX mount -t ext4 -o loop,commit=5,barrier=1,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /dev/block/mmcblk3p3 /mnt/asec/extdata
result=$?
echo "mount /dev/block/mmcblk3p3:$result" >> $ECHO_TARGET
else
echo "+++Need create 512M ext2 loopback device for data, please wait... " >> $ECHO_TARGET
$BUSYBOX dd if=/dev/zero of=/data/ext2 bs=1048576 count=512
$BUSYBOX mke2fs -m 0 -F -L datadata /data/ext2
echo "+++Loopback device create done... " >> $ECHO_TARGET
$BUSYBOX mount -o loop,errors=continue,noatime,nodiratime,nosuid,nodev /data/ext2 /mnt/asec/extdata
fi
$BUSYBOX chown 1000.1000 /mnt/asec/extdata
$BUSYBOX chmod 771 /mnt/asec/extdata
for i in data app-private anr ; do
if [ ! -d /mnt/asec/extdata/$i ] ; then
$BUSYBOX mkdir /mnt/asec/extdata/$i;
fi
$BUSYBOX chown 1000.1000 /mnt/asec/extdata/$i;
$BUSYBOX chmod 771 /mnt/asec/extdata/$i;
#if [ ! -h /data/$i ] ; then
$BUSYBOX cp -a /data/$i /mnt/asec/extdata/;
$BUSYBOX rm -rf /data/$i;
$BUSYBOX ln -s /mnt/asec/extdata/$i /data/$i;
result=$?
echo "ln -s:$result" >> $ECHO_TARGET
#fi
done
$BUSYBOX umount /mnt/asec/extdata
$BUSYBOX touch /data/data2loop.finish
fi
if [ -e /dev/block/mmcblk3p3 ];
then
/system/bin/e2fsck -y -v -f /dev/block/mmcblk3p3
#/system/bin/tune2fs -O ^has_journal /dev/block/mmcblk3p3
/system/bin/tune2fs -o journal_data_writeback /dev/block/mmcblk3p3
$BUSYBOX mknod /dev/loop0 b 7 0
$BUSYBOX losetup /dev/loop0 /dev/block/mmcblk3p3
#$BUSYBOX mount -t ext4 -o sync,commit=5,barrier=1,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /dev/loop0 /mnt/asec/extdata
$BUSYBOX mount -t ext4 -o barrier=1,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /dev/loop0 /mnt/asec/extdata
result=$?
echo "mount /dev/loop1:$result" >> $ECHO_TARGET
else
/system/bin/e2fsck -y -v -f /data/ext2
$BUSYBOX mount -o loop,errors=continue,noatime,nodiratime,nosuid,nodev /data/ext2 /mnt/asec/extdata
fi
$BUSYBOX chown 1000.1000 /mnt/asec/extdata
$BUSYBOX chmod 771 /mnt/asec/extdata
$BUSYBOX mkdir /data/cache
$BUSYBOX mount -o bind /data/cache /cache
$BUSYBOX chmod 777 /cache
sync;
exit 0;
Code:
rootfs / rootfs rw,relatime 0 0
tmpfs /dev tmpfs rw,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
/dev/block/mtdblock3 /system yaffs2 ro,relatime 0 0
/dev/block/mtdblock6 /logodata yaffs2 rw,nosuid,nodev,relatime 0 0
/dev/block/mmcblk3p2 /data ext4 rw,nosuid,nodev,noatime,nodiratime,barrier=0,nobh,data=writeback 0 0
/dev/block/mtdblock0 /misc yaffs2 rw,nosuid,nodev,relatime 0 0
/dev/loop0 /mnt/asec/extdata ext4 rw,nosuid,nodev,noatime,nodiratime,barrier=0,data=writeback 0 0
/dev/block/mmcblk3p2 /cache ext4 rw,nosuid,nodev,noatime,nodiratime,barrier=0,nobh,data=writeback 0 0
/dev/block/vold/179:17 /mnt/sdcard2 vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=07
02,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/179:17 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmas
k=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
tmpfs /mnt/sdcard2/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
/dev/block/vold/179:25 /mnt/sdcard vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=070
2,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/179:25 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmas
k=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
tmpfs /mnt/sdcard/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
chenglu can you post the instructions on how to create a third partition and mount that instead of creating a loop file? I want to test that today.
Thanks,
anlog said:
chenglu can you post the instructions on how to create a third partition and mount that instead of creating a loop file? I want to test that today.
Thanks,
Click to expand...
Click to collapse
Code:
busybox fdisk /dev/block/mmcblk3 -l
Disk /dev/block/mmcblk3: 16.0 GB, 16097738752 bytes
4 heads, 16 sectors/track, 491264 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk3p1 1 397087 12706776 83 Linux
/dev/block/mmcblk3p2 397088 458497 1965120 83 Linux
/dev/block/mmcblk3p3 458498 491264 1048544 83 Linux
reboot into recovery mode
Code:
busybox fdisk /dev/block/mmcblk3
The number of cylinders for this disk is set to 491264.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): m
m
Command Action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
"d" delete a partition 1 and 2
"n" create primary partition 1 2 3
busybox mkdosfs /dev/block/mmcblk3p1
mkfs.ext4 -b 4096 -m 0 -F -L userdata /dev/block/mmcblk3p2
In your instructions it looks like partition 3 isn't referenced, but instead you're formatting /data as ext4 instead of ext3? Or am I missing something???
Add the -O ^huge_file file option to your mkfs.ext4 when formating the partition. (it won't work with this feature since it requires special kernel option that brakes compatibility with existing modules)
mkfs.ext4 -O ^huge_file ........
Report back...
anlog said:
I was able to reboot 5 times and it kept the settings for me. I just couldnt test all apps because wifi was broken with the kernel I was using. I can test more today.
Are you sure that your ext4 format is completing? I got an mtab error when first trying to create the journal, so I just changed the script to format it with the -O ^has_journal option and it competed.
Vegan runs fine for me with latest busybox...
Click to expand...
Click to collapse

Alternative to Apps2SD

After looking at the file system of the X10 and noticing lots of empty space on the /system partition and the fact I wanted more space for apps but didn't want to use my class 2 SD card (that is already pretty full!), I decided to try moving some of my larger apps and pointing to the new location using symlinks (like what apps2sd does). Got over 70mb extra space and no probs no far. New apps will just be installed in /data/app/ as before.
Goes without saying that you do this at your own risk and to make a backup first!
This hack of course requires root! And busybox installed.
First copy the apk file to /system/app2/ say (/system/app/ is already used for some system apps so I decided not to copy their so I could keep them separate.)
Check this is done correctly (I used root explorer) but if the command completed with no errors it should be ok. May need to mount /system as read/write.
Then delete the original file and create a symlink to the new file. (If the first step was done incorrectly this step will remove the app!)
I used an app called Scripter to read QR codes I generated from http://qrcode.kaywa.com/ (use text mode) with the code I wrote on my PC, just scan your comp screen with phone camera and it gives you the option to execute the text. (Or you could spend hours typing it in by hand.) adb didn't work for step 2 when I tried it (access denied).
If step 1 says access denied use root explorer to mount /system as read write and try again or use adb to copy the apps ("adb shell" then use the "busybox cp /data/app/com.rovio.angrybirds.apk /system/app2/com.rovio.angrybirds.apk" command)
Example with angrybirds:
First find the name of the .apk file (I used root explorer and navagated to /data/app/ and ordered by size) in this case "com.rovio.angrybirds.apk"
Copy it:
busybox cp /data/app/com.rovio.angrybirds.apk /system/app2/com.rovio.angrybirds.apk
Delete old file and create symlink:
busybox rm /data/app/com.rovio.angrybirds.apk
busybox ln -s /system/app2/com.rovio.angrybirds.apk /data/app/com.rovio.angrybirds.apk
I used notepad "find and replace" to change "com.rovio.angrybirds.apk" to the name of a different app and repeated.
Here are the names of the apps I moved (to save you typing out the names, all near the top of the list in terms of size).
com.polarbit.krazyracers.apk
com.rovio.angrybirds.apk
com.skype.raider.apk
com.fring.apk
com.qype.radar.apk
com.galcon.igalcon.apk
Hope this helps people who like me want more space for apps without using their SD card. Any probs ask here and hopefully I or someone else can help.
Shaun
i wonder if this really works
not calling into question what you say but I think in the long run is able to consume more resources (or at least the same) due to the fact that they also use a folder within the system...
just a thought
but hey, if it works ... WOW
I'd like to see it implemented in a sh script, accepting app name to move as a command line argument.
Or, even better - an apk, which lists all apps installed, and does moving selected ones. Should not be difficult to implement.
thanks for this, but can i do it on HTC Wildfire where it could actually matter?
and btw, currently my system folder has 175MB free space, how low do you think would be too low? how much free space really has to be free?
If by more resources you mean phone memory? Then yes it consumes the same amount of memory but as /system is on a different partition it consumes the memory in a different place (kind of like a different hard drive in your comp, google partitioning).
I'd love to make this into an app but have no idea where to start, prob wouldn't be too hard though, just a gui that passes busybox commands to the shell, with maybe some safe guards, say leave 50meg free, check its copied correctly ect, wonder if other phones have free space in /system as well? No idea with the script either or how to build a safeguard if command 1 fails don't do 2 and 3, but if someone can run a script they can prob do this.
Yeah should work on other phones if /system is mounted on a different partition and has free space. Run "df" (without quotes) in terminal or using adb run "adb shell" after you've connected to your phone and then "df" and post your output here and I'll let you know. My phone starts to complain (memory low message in status bar) and drop sms messages (really bad bug/feature!) when I get below 50meg, hence the reason for me doing this.
I tried to do the same thing but use /nand (internal storage) and link is created in /data/app but doesnt appear in drawer
It looks permission are the problem
have you tried Link2SD?
This is the only thing that is simple enough for everyone
Adolf1994 said:
have you tried Link2SD?
This is the only thing that is simple enough for everyone
Click to expand...
Click to collapse
Tried and couldnt have my SD recognize by my tablet after making the second partition.
I really like to make link2sd work but as soon I create the secont FAT32 or ext2 or ext3 card disapear
enotar said:
Tried and couldnt have my SD recognize by my tablet after making the second partition.
I really like to make link2sd work but as soon I create the secont FAT32 or ext2 or ext3 card disapear
Click to expand...
Click to collapse
tablet? what kind of tablet? if you partitioned the card wrong, it could cause unexpected things. I prefer to do it with SuperOS(formerly Super Ubuntu) distro or any kind of Ubuntu.
if that tablet is 2.1 then this should work, but if it's 2.2+ then app2sd is exactly you need.
Adolf1994 said:
tablet? what kind of tablet? if you partitioned the card wrong, it could cause unexpected things. I prefer to do it with SuperOS(formerly Super Ubuntu) distro or any kind of Ubuntu.
if that tablet is 2.1 then this should work, but if it's 2.2+ then app2sd is exactly you need.
Click to expand...
Click to collapse
Tablet: HSG-X5A-G 2.1
I format with a PC with Ubuntu and not recognize I even try with minitool on another PC
I did on ubuntu with 8gb SD Card X6 and gparted:
delete all partition on SD card apply
create a partition (1) of 8gb primary FAT32 apply
resize to 7.5gb this partition apply
create 0.5gb partition (2) with the free space after resize primary FAT32 apply.
set partition (1) active
put the card in tablet
and no detection of the card.
If I delete the 500 meg (2) partition the sdcard is imediately recognize after putting back in the tablet.
I even try second partition with ext2 or ext3 try too formating with clockwork recovery menu.I try too to copy to the new formated SD the dir Android, Android-secure and Lost.Dir...... Nothing work.
The second partition make my SD unrecognizable.
I even try to create a linux swap file of 32 meg and no chance too.
If someone can explain me why?
did you use cwm to format things? for now avoid things like this
if you have root(have you?), then please download irssi connectbot from market, open it, set the pulldown list to 'local' at the bottom and give it a name, enter.
then open the newly created connection, issue these commands and post the results here(with the sd card working):
Code:
$ su <- after this allow superuser access
# mount
Adolf1994 said:
did you use cwm to format things? YES
if you have root(have you?), YES
Click to expand...
Click to collapse
Result with my working 16gb card:
rootfs / rootfs ro 0 0tmpfs /dev tmpfs rw,mode=755 0 0
devpts /dev/pts devpts rw,mode=600 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
tmpfs /sqlite_stmt_journals tmpfs rw,size=4096k 0 0
tmpfs /broadcasting tmpfs rw,size=1024k 0 0
/dev/block/mtdblock2 /system yaffs2 ro 0 0
/dev/block/mtdblock5 /data yaffs2 rw,nosuid,nodev 0 0
/dev/block/mtdblock4 /cache yaffs2 rw,nosuid,nodev 0 0
/dev/block/ndda1 /nand vfat rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fma
sk=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block//vold/179:1 /sdcard vfat rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
if you put in the partitioned card, does Android notifies you to format it or doesn't even do that?
if it notifies you, please try to issue this command as superuser:
Code:
mount /dev/block//vold/179:1 /sdcard -t vfat -o rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro
Adolf1994 said:
if you put in the partitioned card, does Android notifies you to format it or doesn't even do that?
Click to expand...
Click to collapse
Dont even do that, no message at all
then issue the command anyway, and see if it works, if not, then post the results here
I create the second partition on the card (space was free) as primary and FAT32 put back the card in the tablet.
As the card was not recognize i use PC with adb:
adb remount
adb shell
su
mount /dev/block//vold/179:1 /sdcard -t vfat -o rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro
I get :
mount /dev/block//vold/179:1 /sdcard -t vfat -o rw,dirsync,nosuid,nodev,noexec,u
id=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset
=iso8859-1,shortname=mixed,utf8,errors=remount-ro
Usage: mount [-r] [-w] [-o options] [-t type] device directory
oh, the sequence that matters!
then type this:
Code:
mount -o rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro -t vfat /dev/block//vold/179:1 /sdcard
Adolf1994 said:
oh, the sequence that matters!
then type this:
Code:
mount -o rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro -t vfat /dev/block//vold/179:1 /sdcard
Click to expand...
Click to collapse
Result:
Usage: mount [-r] [-w] [-o options] [-t type] device directorymount -o rw,dirsyn
c,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,c
odepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro -t vfat
/dev/block//vold/179:1 /sdcard
Usage:: not found
Re runing give me this now:
mount -o rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,
allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=
remount-ro -t vfat /dev/block//vold/179:1 /sdcard
[1] + Stopped (signal) mount -o rw,dirsync,nosuid,nodev,noexec,uid=1000,g
id=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-
1,shortname=mixed,utf8,errors=remount-ro -t vfat /dev/block//vold/...
well, it looks like it's too high for me.
try to find the tablet's subforum and/or another senior member with the same tablet.
hope you can solve it
and please post here the things you found
Thank you very much to try....

[Q] Anyone use AdFree on CM7?

Got AdFree installed, but it says it can't find space to write the hosts file.
Using CM7 final on SD card installed with verygreen's method.
Same here
Sent from my PC36100 using XDA App
danbutter said:
Using CM7 final on SD card installed
Click to expand...
Click to collapse
There's your problem.
AdFree probably freaks out when it sees how you have Android setup on your sd card.
It runs flawlessly for me with CM7 emmc.
Paul22000 said:
There's your problem.
AdFree probably freaks out when it sees how you have Android setup on your sd card.
It runs flawlessly for me with CM7 emmc.
Click to expand...
Click to collapse
+1
Agreed, works perfect on emmc
Works fine on my uSD. It just copy the host file to /system/etc/ so running on SD or emmc makes no different.
Confirmed Functional
I used adfree on nightlies in the SD card...decided to install final release on emmc and also didn't have problems.
I'm running CM7 off SD card. Adfree can't find the right mount point to remount.
1) I pulled the Adfree hosts file off another Android device (I attached it in a zip).
2) I then made the NC system partition writeable by using 'adb remount'
3) I pushed the hosts file to the NC: 'adb push hosts /system/etc/hosts'
if step 2) doesn't work, here are manual instructions. You need adb or terminal emulator with root permissions (hence the # that precedes each command):
# alias mount="busybox mount"
# mount
rootfs on / type rootfs (ro)
tmpfs on /dev type tmpfs (rw,mode=755)
devpts on /dev/pts type devpts (rw,mode=600)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
tmpfs on /mnt/asec type tmpfs (rw,mode=755,gid=1000)
tmpfs on /mnt/obb type tmpfs (rw,mode=755,gid=1000)
/dev/block/mmcblk0p2 on /rom type vfat (rw,noatime,nodiratime,uid=1000,gid=1000,fmask=0117,dmask=0007,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,errors=remount-ro)
/dev/block/mmcblk1p2 on /system type ext4 (ro,barrier=1,data=ordered)
/dev/block/mmcblk1p3 on /data type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk0p7 on /cache type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/sys/kernel/debug on /sys/kernel/debug type debugfs (rw)
/dev/block/vold/179:20 on /mnt/sdcard type vfat (rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/block/vold/179:20 on /mnt/secure/asec type vfat (rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
tmpfs on /mnt/sdcard/.android_secure type tmpfs (ro,size=0k,mode=000)
/dev/block/vold/179:8 on /mnt/emmc type vfat (rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/block/dm-0 on /mnt/asec/dk.logisoft.aircontrol-1 type vfat (ro,dirsync,nosuid,nodev,uid=1000,fmask=0222,dmask=0222,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)​
The red line is the one we care about. DO NOT PROCEED IF YOURS IS DIFFERENT.
To make it read-write:
# mount -o rw,remount -t ext4 /dev/block/mmcblk1p2 /system
To make it read-only:
# mount -o ro,remount -t ext4 /dev/block/mmcblk1p2 /system
joobu said:
I'm running CM7 off SD card. Adfree can't find the right mount point to remount.
1) I pulled the Adfree hosts file off another Android device (I attached it in a zip).
2) I then made the NC system partition writeable by using 'adb remount'
3) I pushed the hosts file to the NC: 'adb push hosts /system/etc/hosts'
Click to expand...
Click to collapse
Yep, this should work... I still see ads all over though. Same places I don't see them on my Nexus One.
Did this actually work for you? Although really I can't imagine why it wouldn't.
I replaced my hosts file the harder manual way.
Maybe check to see if the hosts file was actually replaced. The hosts file should be around 700 kB
I'm encountering a problem with adfree and the nook color running cm7. I see others have it installed and running fine. First time using this app.
I have downloaded adfree and when i try and download and install hosts by clicking the button it gives me an error stating" unable to locate a partition to remount to write the host files to"
Anybody know whats wrong and how to solve?
Look at my post with the manual instructions.
don't need to, its on my evo that I tether from and I see no ads on the nook or my pc
Fix Permisions
I ran "Fix Permissions" from TWRP touch recovery and that did the trick for me.

Categories

Resources