[BRAINSTORM] Booting directly into recovery - LG Optimus Black

For reference, these are my thoughts on the matter.
We have 3 ways to do this:
1. Get hold of SBL, change it and flash it
Currently impossible afaik.
2. Get an init.d bash script to reboot into recovery if key is pressed
Most likely possible taking these 2 assumptions into account:
a) Bash allows to detect a pressed key, something like this:
Code:
_key()
{
local kp
ESC=$'\e'
_KEY=
read -d '' -sn1 _KEY
case $_KEY in
"$ESC")
while read -d '' -sn1 -t1 kp
do
_KEY=$_KEY$kp
case $kp in
[a-zA-NP-Z~]) break;;
esac
done
;;
esac
printf -v "${1:-_KEY}" "%s" "$_KEY"
}
_key x
case $x in
$'\e[15~') reboot recovery ;;
esac
Replacing this key code for one of OB's.
But for this, we need assumption number 2:
b) Key codes mapping is the same for recoveries.
Now, while this is the method of the greatest chance to work, it is also fairly useless. Developers will often break the boot before the init.d scripts are ran. So, this code should be ran before. Hence, the third method.
3. Start a custom service in init.rc (@ ramdisk) that will detect pressed key
This would be the perfect solution as it can't be broken from kernel (zImage) or system changes. However, init.rc has its own programming language (android init language) and there's no way to run this kind of listener.
However, it is possible to run an external script located for example in /system/bin/. These can be both an executable compiled from c (higher chances of working) or a bash scripting like the aforementioned one (lower chances of working since android probably doesn't start a console on boot).
Code for this would be something like:
Code:
service exampleservice /system/bin/exampleservice
user exampleservice
group exampleservice
oneshot
So uh, am I missing anything?
Anyone has other ideas?

a lot of times i heared about pressing "G" and "Power" would boot into some kind of save mode... if thats true i guess its easyer to reprogramm that keycombo to do something else... so does that keycombo anything? i couldnt figure out^^
Sent from my LG-P970 using XDA App

Are others devices has the key combination code in SBL?
I wish I have enough knowledge about android system so i can help...

i04055 said:
Are others devices has the key combination code in SBL?
I wish I have enough knowledge about android system so i can help...
Click to expand...
Click to collapse
Yes there are devices heaving the key-combo in SBL if that answers your question. The "Samsung Galaxy S GT-I9000" e.g. has them there afaik. With that device it was possible flashing the SBL to add a "booting directly into recovery" key-combo...
So I don´t know why there should not be a solution to do the same to the OB but Noejn surely has good reason for telling its impossible.
But hey what about booting into recovery on every system startup and only boot into the system through the recovery? It´s a "quick & dirty" solution even if its possible but better than developing the way we do isn´t it? I´m not sure if its easier to change the startup that way than to add or modify a key-combo but maybe someone here does?

I'm sure (or hope..) someone can, but perhaps we should move this Thread to another part of the Forum so someone with the knowledge how to do this will read it.

d0n22 said:
But hey what about booting into recovery on every system startup and only boot into the system through the recovery? It´s a "quick & dirty" solution even if its possible but better than developing the way we do isn´t it? I´m not sure if its easier to change the startup that way than to add or modify a key-combo but maybe someone here does?
Click to expand...
Click to collapse
Yeah, i prefer that way if poosibble rather than nothing.
But if put it that way, when the phone get bootloop is it still posibbe to boot into recovery?
Sent from my LG-P970 using XDA App

This is how it's done on Xperia X8 phone.
The /system/bin/chargemon is usb-charge daemon that is being hijacked on boot (it's binary is replaced with this script)
Original chargemon is copied into "charger" to keep it's functionality.
Than "sleep 3" waits for any keypress, and checks the dump, if keys were pressed, it launches the recovery binary.
quite simple.
Code:
#!/system/bin/busybox sh
/system/bin/charger
cat /dev/input/event1 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck -o -f /data/local/tmp/xrecovery ]
then
rm -f /data/local/tmp/xrecovery
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /dev/block/mtdblock1
umount -l /dev/block/mtdblock2
umount -l /dev/block/mtdblock3
# Mount recovery partition
cd /
rm -r /sbin
rm -f etc
tar -xf /system/bin/xrecovery.tar
# Umount /system
umount -l /dev/block/mtdblock0
# chroot
chroot / /init
fi
# remount rootfs rw
mount -o remount,rw rootfs /
chmod 0777 /dev -R
chown 0.2000 /dev/oncrpc -R
cd /
rm init*
rm logo.rle
rm default.prop
tar -xf /system/bin/ramdisk.tar
mkdir -p /minicm
cd /minicm
tar -xf /system/bin/ramdisk.tar
# Umount /system, data and cache
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
rmdir /system /data /cache /mnt

racht said:
This is how it's done on Xperia X8 phone.
The /system/bin/chargemon is usb-charge daemon that is being hijacked on boot (it's binary is replaced with this script)
Original chargemon is copied into "charger" to keep it's functionality.
Than "sleep 3" waits for any keypress, and checks the dump, if keys were pressed, it launches the recovery binary.
quite simple.
Code:
#!/system/bin/busybox sh
/system/bin/charger
cat /dev/input/event1 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck -o -f /data/local/tmp/xrecovery ]
then
rm -f /data/local/tmp/xrecovery
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /dev/block/mtdblock1
umount -l /dev/block/mtdblock2
umount -l /dev/block/mtdblock3
# Mount recovery partition
cd /
rm -r /sbin
rm -f etc
tar -xf /system/bin/xrecovery.tar
# Umount /system
umount -l /dev/block/mtdblock0
# chroot
chroot / /init
fi
# remount rootfs rw
mount -o remount,rw rootfs /
chmod 0777 /dev -R
chown 0.2000 /dev/oncrpc -R
cd /
rm init*
rm logo.rle
rm default.prop
tar -xf /system/bin/ramdisk.tar
mkdir -p /minicm
cd /minicm
tar -xf /system/bin/ramdisk.tar
# Umount /system, data and cache
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
rmdir /system /data /cache /mnt
Click to expand...
Click to collapse
yeah ,from this we can see what is running before logo screen and we can mod that file

so.. is that mean we can boot to recovery mode same as x8?

racht said:
This is how it's done on Xperia X8 phone.
The /system/bin/chargemon is usb-charge daemon that is being hijacked on boot (it's binary is replaced with this script)
Original chargemon is copied into "charger" to keep it's functionality.
Than "sleep 3" waits for any keypress, and checks the dump, if keys were pressed, it launches the recovery binary.
quite simple.
Code:
#!/system/bin/busybox sh
/system/bin/charger
cat /dev/input/event1 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck -o -f /data/local/tmp/xrecovery ]
then
rm -f /data/local/tmp/xrecovery
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /dev/block/mtdblock1
umount -l /dev/block/mtdblock2
umount -l /dev/block/mtdblock3
# Mount recovery partition
cd /
rm -r /sbin
rm -f etc
tar -xf /system/bin/xrecovery.tar
# Umount /system
umount -l /dev/block/mtdblock0
# chroot
chroot / /init
fi
# remount rootfs rw
mount -o remount,rw rootfs /
chmod 0777 /dev -R
chown 0.2000 /dev/oncrpc -R
cd /
rm init*
rm logo.rle
rm default.prop
tar -xf /system/bin/ramdisk.tar
mkdir -p /minicm
cd /minicm
tar -xf /system/bin/ramdisk.tar
# Umount /system, data and cache
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
rmdir /system /data /cache /mnt
Click to expand...
Click to collapse
soundes quite promising... have you tried it?

Can this be usefull?
http://forum.xda-developers.com/showthread.php?t=991276

Noejn have you abandoned us ? Or are u planning to take a look at this ? Would be nice if u get OB up and running

recovery
Hi,
has there been any success with booting into recovery mode?
BR,
J

logitec said:
Hi,
has there been any success with booting into recovery mode?
BR,
J
Click to expand...
Click to collapse
No,I try to boot directly into recovery through boot.img,but I get a big "error" form the LG Security Team!

Hijacking a daemon would work if Optimus Black had those binaries. I took a quick glance at a backup and I didn't see chargemon in /system/bin.
Besides, a xRecovery is limited as it's dependent on system files so a /format can't be done which isn't really that "comfy", especially when changing fs.
But yeah, better than nothing. Still, the method you described is only possible in Xperia phones, as far as I know.
I still say injecting a service on the init.rc is the way to go.
However, I can't test this now.
racht said:
This is how it's done on Xperia X8 phone.
The /system/bin/chargemon is usb-charge daemon that is being hijacked on boot (it's binary is replaced with this script)
Original chargemon is copied into "charger" to keep it's functionality.
Than "sleep 3" waits for any keypress, and checks the dump, if keys were pressed, it launches the recovery binary.
quite simple.
Code:
#!/system/bin/busybox sh
/system/bin/charger
cat /dev/input/event1 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck -o -f /data/local/tmp/xrecovery ]
then
rm -f /data/local/tmp/xrecovery
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /dev/block/mtdblock1
umount -l /dev/block/mtdblock2
umount -l /dev/block/mtdblock3
# Mount recovery partition
cd /
rm -r /sbin
rm -f etc
tar -xf /system/bin/xrecovery.tar
# Umount /system
umount -l /dev/block/mtdblock0
# chroot
chroot / /init
fi
# remount rootfs rw
mount -o remount,rw rootfs /
chmod 0777 /dev -R
chown 0.2000 /dev/oncrpc -R
cd /
rm init*
rm logo.rle
rm default.prop
tar -xf /system/bin/ramdisk.tar
mkdir -p /minicm
cd /minicm
tar -xf /system/bin/ramdisk.tar
# Umount /system, data and cache
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
rmdir /system /data /cache /mnt
Click to expand...
Click to collapse

Good news, I'm getting close.

ok, thank you for everithing

Noejn said:
Good news, I'm getting close.
Click to expand...
Click to collapse
good news indeed^^ im working on it as well but im not feeling like getting close :-\ pls let me know what you did and how you did it as soon as its done... again thank you very much for your efforts!
Sent from my LG-P970 using XDA App

d0n22 said:
good news indeed^^ im working on it as well but im not feeling like getting close :-\ pls let me know what you did and how you did it as soon as its done... again thank you very much for your efforts!
Sent from my LG-P970 using XDA App
Click to expand...
Click to collapse
Well, I've succeed injecting the script on boot.
However, I'm getting some problems on the event0 > keycheck; I don't think at this time of boot /dev entries are up.
But I've already thought of a workaround and I'll test it tomorrow.

I´m thinking, if i compile kernel of ubuntu and install it in recovery partition, not possible then run ubuntu in native mode from sdcard with dualboot?

Related

Script Making

Tell me what I'm doing wrong here. I'm trying to make a script that will remove some apps whenever I flash a new rom. Here's what I thought would work:
Code:
mount -o remount,rw /dev/block/mtdblock3 /system
cd /system/app
rm com.amazon*.apk
rm Mail.apk
rm Development.apk
rm LatinIME.apk
To use it I type:
Code:
$ su
# sh /sdcard/apps.sh
and it just fails at every line. Any help would be appreciated.
On the first line try
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
or your could shortcut it by using
mount /system
Stupid question, but do you have the permissions set to allow root access?
I've done that a few times to realize what my "mistake" was.
well you could just make a script for your PC something along the lines of
Code:
@echo off
adb remount
adb shell rm /system/app/com.amazon*.apk
adb shell rm /system/app/Mail.apk
adb shell rm /system/app/Development.apk
adb shell rm /system/app/LatinIME.apk
adb shell reboot
and rename it to a .bat or .cmd file
jackslim said:
On the first line try
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
or your could shortcut it by using
mount /system
Click to expand...
Click to collapse
Ok so I did that and the script appears to be working. I'll test it when Cyanogen release another update with amazon... Adding the -t yaffs2, what exactly did that do?
The -t is a trigger saying that your going to specify what type of filesystem your mounting, yaffs2 is the type of filesystem

Newb terminal command questions

What's the difference between these two (at least why they use the mount command, remount command, or shell command?)
su
mount -o remount,rw /dev/mtdblock3 /system
rm [whatever i want]
mount -o remount,ro /dev/mtdblock3 /system
and
adb remount
adb shell rm [whatever i want]
The first is a terminal command from the phone. (Only requires the phone)
The second is through adb to the phone. (Involves a properly configured adb, computer, usb cable, and phone)
evilkorn said:
The first is a terminal command from the phone. (Only requires the phone)
The second is through adb to the phone. (Involves a properly configured adb, computer, usb cable, and phone)
Click to expand...
Click to collapse
Wow, so people manage to type out all that craziness on the phone huh.
Thanks!
Anytime. Doubt they do that all the time, it would be easier to just make a script if you have to do that more than once. I just use root explorer, it has a button that mounts /system/ -rw.
I'm not sure about other terminals, but you can create aliases in Better Terminal Emulator
alias rw='mount -o remount,rw /dev/mtdblock3 /system'
alias ro='mount -o remount,ro /dev/mtdblock3 /system'
so now all you have to do is type rw or ro and it executes the full command. Or you can create scripts:
su
mount -o remount,rw /dev/mtdblock3 /system
cd /system/bin
echo "#! /system/bin/sh" | tee ro rw
echo "mount -o remount,rw /dev/mtdblock3 /system" >> rw
echo "mount -o remount,ro /dev/mtdblock3 /system" >> ro
chmod 755 rw ro
Same thing, except it executes the scripts instead of an alias.

[Q] How to convert stock ROM from rfs to ext4?

Hi sorry if i sound noob but i would like to try converting my stock rom from .rfs to ext4 without breaking anything (My setup is exactly as described in my signature). I understand that ketut has created a script to make this happen.
ketut.kumajaya said:
Just want to share my command list to convert Galaxy Ace firmware from rfs to ext4.
Code:
cd /home/user/rfs2ext4
dd if=/dev/zero of=system.rfs bs=4096 count=53696
losetup /dev/loop0 system.rfs
mkfs.ext4 -T ext4 -b 4096 -m 0 -J size=4 -O ^resize_inode,^ext_attr,^huge_file,^has_journal /dev/loop0
tune2fs -c 100 -i 100d -m 0 /dev/loop0
mkdir /tmp/ext4
sudo mount /dev/loop0 /tmp/ext4
chmod 755 fix-*.sh
cp fix-*.sh /tmp
mkdir /tmp/rfs
sudo mount -o loop source/system.rfs /tmp/rfs
sudo cp -a /tmp/rfs/* /tmp/ext4
cd /tmp/ext4
sudo ../fix-system.sh
cd /home/user/rfs2ext4
sudo umount /tmp/ext4
sudo umount /tmp/rfs
dd if=/dev/zero of=data.rfs bs=4096 count=46400
losetup /dev/loop0 data.rfs
mkfs.ext4 -T ext4 -b 4096 -m 0 -J size=16 -O ^resize_inode,^ext_attr,^huge_file /dev/loop0
tune2fs -c 100 -i 100d -m 0 /dev/loop0
mount /dev/loop0 /tmp/ext4
sudo mount -o loop source/data.rfs /tmp/rfs
sudo cp -a /tmp/rfs/* /tmp/ext4
cd /tmp/ext4
sudo ../fix-data.sh
cd /home/user/rfs2ext4
sudo umount /tmp/ext4
sudo umount /tmp/rfs
dd if=/dev/zero of=csc.rfs bs=4096 count=6464
losetup /dev/loop0 csc.rfs
mkfs.ext4 -T ext4 -b 4096 -m 0 -J size=4 -O ^resize_inode,^ext_attr,^huge_file /dev/loop0
tune2fs -c 100 -i 100d -m 0 /dev/loop0
mount /dev/loop0 /tmp/ext4
sudo mount -o loop source/csc.rfs /tmp/rfs
sudo cp -a /tmp/rfs/* /tmp/ext4
cd /tmp/ext4
sudo ../fix-csc.sh
cd /home/user/rfs2ext4
sudo umount /tmp/ext4
sudo umount /tmp/rfs
tar -H ustar -c boot.img recovery.img data.rfs system.rfs > CODE_S5830XWKPN_CL375596_REV03_blackhawk.tar
md5sum -t CODE_S5830XWKPN_CL375596_REV03_blackhawk.tar >> CODE_S5830XWKPN_CL375596_REV03_blackhawk.tar
mv CODE_S5830XWKPN_CL375596_REV03_blackhawk.tar CODE_S5830XWKPN_CL375596_REV03_blackhawk.tar.md5
tar -H ustar -c csc.rfs > CSC_S5830OXXKP7_CL375596_REV03_blackhawk.tar
md5sum -t CSC_S5830OXXKP7_CL375596_REV03_blackhawk.tar >> CSC_S5830OXXKP7_CL375596_REV03_blackhawk.tar
mv CSC_S5830OXXKP7_CL375596_REV03_blackhawk.tar CSC_S5830OXXKP7_CL375596_REV03_blackhawk.tar.md5
tar -H ustar -c arm11boot mibib oemsbl qcsbl > APBOOT_S5830XWKPN_CL375596_REV03.tar
md5sum -t APBOOT_S5830XWKPN_CL375596_REV03.tar >> APBOOT_S5830XWKPN_CL375596_REV03.tar
mv APBOOT_S5830XWKPN_CL375596_REV03.tar CAPBOOT_S5830XWKPN_CL375596_REV03.tar.md5
tar -H ustar -c amss > MODEM_S5830XWKP6_CL375596_REV03.tar
md5sum -t MODEM_S5830XWKP6_CL375596_REV03.tar >> MODEM_S5830XWKP6_CL375596_REV03.tar
mv MODEM_S5830XWKP6_CL375596_REV03.tar MODEM_S5830XWKP6_CL375596_REV03.tar.md5
Click to expand...
Click to collapse
My question is how do you do it? Do you create a .sh script with this and then just run it using script manager or do you have to run this script in recovery?
Thanks
you can do this without scipt it's easy, first,flash CF-Root kernel in recovery , then go to the app drawer then open the EXT4 app, then covert to ext4 this operation will take about 2-3 min in recovery,of course you need to have CWM4,at the end it wiil reboot you phone so enjoy it
Press the thanks butom if I helped
that ketut's script can only be use on odin files, cannot be use on already installed rom. btw cfroot ext4manager app should be able to do it directly from the phone.
slaid480 said:
you can do this without scipt it's easy, first,flash CF-Root kernel in recovery , then go to the app drawer then open the EXT4 app, then covert to ext4 this operation will take about 2-3 min in recovery,of course you need to have CWM4,at the end it wiil reboot you phone so enjoy it
Press the thanks butom if I helped
Click to expand...
Click to collapse
already have CF Root kernel and CWM 5.0.26
an0nym0us_ said:
that ketut's script can only be use on odin files, cannot be use on already installed rom. btw cfroot ext4manager app should be able to do it directly from the phone.
Click to expand...
Click to collapse
ketut mentioned it is possible to do so on a pre-existing ROM but he doesn't recommend it haha.
Hmmm, i do not know why i don't have the ext4manager app even though i am on CF Root b82 kernel. Do i have to download the ext4manager app separately?
=====================================================================================================================
EDIT
I found the ext4manager on chainfire's post. Will install v1.3 and do the necessary file system conversion... and pray it works!
=========================================================
Update
It was my tardiness that led me to use chainfire's original ext4manager where i should have been using the version modified by ketut!
It worked like a breeze, install and the whole thing was done under a minute in recovery. I am very very happy with the results for i managed to gain about 400 points in Quadrant. Well, i couldn't get a OC kernel to work with my Stock ROM but this mod is ain't exactly that bad in coaxing out some performance.
slaid480 said:
you can do this without scipt it's easy, first,flash CF-Root kernel in recovery , then go to the app drawer then open the EXT4 app, then covert to ext4 this operation will take about 2-3 min in recovery,of course you need to have CWM4,at the end it wiil reboot you phone so enjoy it
Press the thanks butom if I helped
Click to expand...
Click to collapse
hey i have installed and tried that but it seems like ext4 manager is showing no ext4 partitions found ? did it converted to ext4 or still am on rfs
Lijop said:
hey i have installed and tried that but it seems like ext4 manager is showing no ext4 partitions found ? did it converted to ext4 or still am on rfs
Click to expand...
Click to collapse
did you use ext4manager from ketut's thread?
http://forum.xda-developers.com/attachment.php?attachmentid=714285&d=1315543936
ext4manager MUST detect your cf root kernel. if it does, it will automatically show the various partitions and the file system applicable.
happily1986 said:
did you use ext4manager from ketut's thread?
http://forum.xda-developers.com/attachment.php?attachmentid=714285&d=1315543936
ext4manager MUST detect your cf root kernel. if it does, it will automatically show the various partitions and the file system applicable.
Click to expand...
Click to collapse
CF-Root-S5830-v3.7-b82-ex. am using this. chainfire stuff
Lijop said:
CF-Root-S5830-v3.7-b82-ex. am using this. chainfire stuff
Click to expand...
Click to collapse
thats just the kernel itself. scroll down and find CF Root S5830 ext4 v1.3 in the post by ketut if you want to. btw the link i posted earlier on is the actual download link for the ext4 manager that has been modified to work for S5830 by ketut.
Will this method work on all Galaxy ACE versions. My wife has the version for Latin America, same as the one sold in Brazil and Chile.
Not sure about the ROM version for this one though.
Does stock ROM kernel even support ext4???
could u help for installing CF Root ?
i have a stock rom 2.3.3
thanks in advance
http://acetips.wordpress.com/2011/10/11/flash-cf-root-ace-gb/
ducutu said:
http://acetips.wordpress.com/2011/10/11/flash-cf-root-ace-gb/
Click to expand...
Click to collapse
Like a Michael Jackson music video...

Ubuntu on Ideos X6

There are threads on this site and elsewhere showing the steps to boot ubuntu on android phones. Our Ideos X6 comes with a powerful hardware so i believe we can run ubuntu on it. But it seems that the kernel must support loop devices. Can anyone make a custom kernel supporting loop devices.
Or has anyone successful in running Ubuntu on Ideos X6.
Our kernel have support for loop device. Take this little instruction how install ubuntu oneiric, also the same process for debian just write distribution name and correct url in debootstrap.
1. this stage you must complete on your linux pc.
Code:
#debootstrap part on PC
sudo apt-get install debootstrap
sudo dd if=/dev/zero of=ubuntu.img seek=838860800 bs=1 count=1
sudo mke2fs -F ubuntu.img
sudo mkdir ubuntu
sudo mount -o loop ubuntu.img ubuntu/
sudo debootstrap --arch armel --foreign oneiric ubuntu http:/ports.ubuntu.com/ubuntu-ports/
sudo umount ubuntu
sudo rm -r ubuntu
2. push this ubuntu.img to sdcard on your phone.
Code:
adb push ubuntu.img /sdcard/ubuntu.img
3. create this script as ubuntu.sh on your sdcard too
Code:
echo "Setting some stuff up.."
export bin=/system/bin
export img=/mnt/sdcard/ubuntu.img
export mnt=/data/local/ubuntu
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
mkdir $mnt
echo "Mounting the Linux Image"
busybox losetup /dev/block/loop7 $img
mount -t ext2 -o noatime,nodiratime /dev/block/loop7 $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
echo "Setting Up Networking"
busybox sysctl -w net.ipv4.ip_forward=1
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "Mounting sdcard in /mnt"
mkdir $mnt/mnt/sdcard
busybox mount --bind /mnt/sdcard/ $mnt/mnt/sdcard
echo "Entering CHROOT "
echo " "
busybox chroot $mnt /bin/bash
echo " "
echo "Shutting down CHROOT"
umount $mnt/mnt/emmc
umount $mnt/mnt/sdcard
busybox sysctl -w net.ipv4.ip_forward=0
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
busybox losetup -d /dev/block/loop7
4. So now we connect to device, run superuser permission, and chroot to ubuntu
Code:
sudo adb shell
su
sh /sdcard/ubuntu.sh
5.run continue deboostrap
Code:
/debootstrap/debootsrap --second-stage
6. setup apt
Code:
echo 'deb http:/ports.ubuntu.com/ubuntu-ports/ oneiric main' >/etc/apt/sources.list
apt-get clean
apt-get update
7. add root password
Code:
passwd root
8. exit from ubuntu shell with 'exit' and run it again sh /sdcard/ubuntu.sh from terminal emulator on your device or via adb shell.
So, now ubuntu install successfully on your phone and you may install openssh and vnc server.
P.S. http:/ correct it with two //, I can't push correct link to forum. its denied post urls.
Error
I followed your steps exactly as given and changed / to // in http i am getting the following output when i ran ubuntu.sh. kindly help
# sh ubuntu.sh
Setting some stuff up..
mkdir failed for /data/local/ubuntu, File exists
Mounting the Linux Image
losetup: /dev/block/loop7
mount: Device or resource busy
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
Setting Up Networking
net.ipv4.ip_forward = 1
ubuntu.sh: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexistent
ubuntu.sh: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexistent
ubuntu.sh: cannot create /data/local/ubuntu/etc/hosts: directory nonexistent
Mounting sdcard in /mnt
mkdir failed for /data/local/ubuntu/mnt/sdcard, No such file or directory
mount: mounting /mnt/sdcard/ on /data/local/ubuntu/mnt/sdcard failed: No such file or directory
Entering CHROOT
chroot: can't execute '/bin/bash': No such file or directory
Shutting down CHROOT
failed.
failed.
net.ipv4.ip_forward = 0
failed.
failed.
failed.
failed.
losetup: /dev/block/loop7: Device or resource busy
Possbile what loop7 device already busy on your phone.
ry this command to see it
Code:
busybox losetup
And try manual steps which in script to see which step is failed.
When I type
Code:
#busybox losetup
nothing happens
when i type
Code:
#busybox losetup /dev/block/loop7 /mnt/sdcard/ubuntu.img
losetup: /dev/block/loop7
Code:
#mount -t ext2 -o noatime,nodiratime /dev/block/loop7 /data/local/ubuntu
mount: Device or resource busy
the second line is the outputfrom the command.
Do you phone have block devices in /dev/block/ ?
just checked using root explorer. there are many loop# files in /dev/block folder
You may try with UC kernel, or try with ext3 file system. I suppose what your kernel without support ext2.
i tried with UC v5. It supports ext2,ext3 and ext4. Still getting same error.
Should i convert my android filesystem to ext2,3,0r 4. If yes how to do it?
No, you don't need do converting. Problem with loop device or mount, try to see busybox losetup after mount image to block device, it's must show what image mounted to block device. If it's ok, try different option for mount.
I don't have anymore ideas why it doesn't work.
This scenario successful work on my phone.
Can you tell me what ROM you are using
Sent from my CSL-MI410 using XDA App
Last rom from wellcom (2.3-V318E)
now it works. Installed ubuntu. But i am now unable to install any package. when i try to install tightvncserver i get error message
E: Unable to locate package tightvncserver
actally i am not able to install any package
i have checked the /etc/apt/sourcels.list and it contains the required entry and i also did
apt-get clean
apt-get update
and it updates without any error
You need add another repositories to /etc/sources.list such as universe, multiverse, restricted with the same path.

[Q] mount in init.d script

hello, i have that script:
Code:
#!/system/bin/sh
rm -R /cache/download /sd-ext/download
mkdir /cache/download /sd-ext/download
chmod 0771 /cache/download /sd-ext/download
chown 1000:2001 /cache/download /sd-ext/download
mount -o bind /sd-ext/download /cache/download
And i don't know why in mount i have:
Code:
/dev/block/mmbblk0p2 on /cache/download\040(deleted) type ext3 ...
What is this "\040(deleted)"? This same i have in /proc/mounts
http://bytes.com/topic/c/answers/712378-why-backslash-space-combo-escape-sequence-040-a
In a string or character literal, the sequence \040 denotes the octal
value of the character (your C textbook should explain this). 040
octal is 32 decimal, which happens to be the ASCII code for the space
character (though C doesn't require ASCII).
Click to expand...
Click to collapse
It's a space? Idk though for sure
Emmm, no

Categories

Resources