[HOWTO] install and run Ubuntu inside phone

TheGrammarFreak

Senior Member
Jul 29, 2010
2,820
678
0
twitter.com
no progress yet was not even begin xD

for the dual boot, see if we can modify the boot process and integret a boot menu.
at the moment, no android can do this

@areicko, are you in fake recovery ?
I think it's entirely possible. Something like fake flash, but with boot menu instead? I'll have a look at chroot-ing meego. Possibly.

Sent from my Legend using XDA App
 

LilNes

Member
Mar 30, 2008
40
0
0
I have tested to boot on SD card, but when i launch

Code:
fastboot -c 'root=/dev/mmcblk0p2 rw rootfs=ext2 init=/sbin/init rootwait noinitrd' boot zImage
but don't work ...

we have a valide zImage for the Lengende ?
 

TheGrammarFreak

Senior Member
Jul 29, 2010
2,820
678
0
twitter.com
I have tested to boot on SD card, but when i launch

Code:
fastboot -c 'root=/dev/mmcblk0p2 rw rootfs=ext2 init=/sbin/init rootwait noinitrd' boot zImage
but don't work ...

we have a valide zImage for the Lengende ?
There are a couple of potential problems here. I'm not sure what fastboot is like on our legend, I have a feeling that some commands don't work...

The image we use at the moment was made with chroot in mind I assume... I'm not sure though.

Sent from my Legend using XDA App
 

LilNes

Member
Mar 30, 2008
40
0
0
I try
Code:
fastboot -c 'root=/dev/mmcblk0p1
and its work, but nothing on the screen ^^

fastboot -c work fine, but the cmd not ...
remplace mmcblk0p2 (nexus one) by mmcblk0p1 for the legend =)

And when i try

Code:
fastboot -c 'root=/dev/mmcblk0p1' boot zImage
I have zImage not found =D

Edit : we have ext2 module on the legend ?
 

Zionator

Senior Member
Jan 28, 2009
2,120
640
198
Birmingham
www.Infowars.com
Help!!!

Hi.
Good work on porting ubuntu i cant wait to play around with it :D but upon trying to do so i stumbled upon some errors :eek:
Is there anyone who can see what i am doing wrong here :confused:
This is what i have done.

adb devices :
List of devices attached
HT04WNX03463 recovery

adb shell :
~ # cd /sdcard/ubuntu/
cd /sdcard/ubuntu/
/sdcard/ubuntu # ls
ls
bootubuntu fsrw mountonly ubuntu.img ubuntu.sh unionfs

/sdcard/ubuntu # sh ./ubuntu.sh
sh ./ubuntu.sh
modprobe: chdir(2.6.29-e3993620): No such file or directory
←[H←[Jmkdir: can't create directory '/data/local/mnt': File exists
←[H←[Jrm: can't remove '/system/bin/fsrw': No such file or directory
rm: can't remove '/system/bin/bootubuntu': No such file or directory
rm: can't remove '/system/bin/unionfs': No such file or directory
rm: can't remove '/system/bin/mountonly': No such file or directory
chmod: su: No such file or directory
←[H←[J
Ubuntu Chroot Bootloader v0.11
Ubuntu Bootloader is now installed!
This process does NOT damage Android OS!
Original Installer by Charan Singh
Modified for Ubuntu Chroot by Max Lee at NexusOneHacks.net
Modified by Snakehult
To enter the Debian Linux console just type 'bootubuntu'

/sdcard/ubuntu # sh ./bootubuntu
sh ./bootubuntu
net.ipv4.ip_forward = 1
Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4
Setting localhost on /etc/hosts
Brought to you by NexusOneHacks.net and the open source community!

Modified by Snakehult
ver 0.1
[email protected]:/#

I then boot into azure and do following...

adb devices :
List of devices attached
HT04WNX03463 device

adb shell :
# bootubuntu
bootubuntu
losetup: /dev/block/loop5
mount: mounting /dev/block/loop5 on /data/local/ubuntu failed: Device or resourc
e busy
mount: mounting devpts on /data/local/ubuntu/dev/pts failed: No such file or dir
ectory
mount: mounting proc on /data/local/ubuntu/proc failed: No such file or director
y
mount: mounting sysfs on /data/local/ubuntu/sys failed: No such file or director
y
net.ipv4.ip_forward = 1
Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4
bootubuntu: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexist
ent
bootubuntu: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexist
ent
Setting localhost on /etc/hosts
bootubuntu: cannot create /data/local/ubuntu/etc/hosts: directory nonexistent
Brought to you by NexusOneHacks.net and the open source community!

Modified by Snakehult
ver 0.1
chroot: can't execute '/bin/bash': No such file or directory
Shutting down Ubuntu
umount: can't umount /data/local/ubuntu/dev/pts: No such file or directory
umount: can't umount /data/local/ubuntu/proc: No such file or directory
umount: can't umount /data/local/ubuntu/sys: No such file or directory
umount: can't umount /data/local/ubuntu: Invalid argument
losetup: /dev/loop5: Device or resource busy
 

TheGrammarFreak

Senior Member
Jul 29, 2010
2,820
678
0
twitter.com
I got exactly the same errors !

Can anyone help us ?

Thanks ;-)
It seems that loop5 causes issues too. Try opening bootubuntu in notepad++ (windows) or any text editor (linux) and changing all the "loop5" to "loop1" then saving it and putting it on your /sdcard/ubuntu folder. Then follow the steps in the first post again.

If it goes wrong again follow the same procedure, but change to "loop5" or "loop2". I know this is a pain but it's the only way I've found to fix it.

What the problem is is that the loopback device (loop1, loop2 or loop5, whichever you use) is sometimes busy for no good reason, so you need to use another one. A potential "be all and end all" solution is to change the scripts so that that check for which loopback device is free, and use that. But as I'm no good at scripting I wouldn't know how. I'll look into doing it, but someone else may well beat me to it

What you need to remember about this is that it's a very "nerdy" thing to do, and should be approached with a 'can do' attitude. It seems that there is no one loopback device that's always free, so we need to change the scripts often to keep booting it.

Anyhoo, I'll read up on these scripts, and see if I can work out a simple "if ... then ... else" procedure that automates some of this, if it's even possible...
 
Last edited:

Zionator

Senior Member
Jan 28, 2009
2,120
640
198
Birmingham
www.Infowars.com
It seems that loop5 causes issues too. Try opening bootubuntu in notepad++ (windows) or any text editor (linux) and changing all the "loop5" to "loop1" then saving it and putting it on your /sdcard/ubuntu folder. Then follow the steps in the first post again.

If it goes wrong again follow the same procedure, but change to "loop5" or "loop2". I know this is a pain but it's the only way I've found to fix it.

What the problem is is that the loopback device (loop1, loop2 or loop5, whichever you use) is sometimes busy for no good reason, so you need to use another one. A potential "be all and end all" solution is to change the scripts so that that check for which loopback device is free, and use that. But as I'm no good at scripting I wouldn't know how. I'll look into doing it, but someone else may well beat me to it

What you need to remember about this is that it's a very "nerdy" thing to do, and should be approached with a 'can do' attitude. It seems that there is no one loopback device that's always free, so we need to change the scripts often to keep booting it.

Anyhoo, I'll read up on these scripts, and see if I can work out a simple "if ... then ... else" procedure that automates some of this, if it's even possible...

Thanks for the help.
I have done it from loop1 to loop 7 and they r all busy so i just wanna know how many loops dos this phone have and how do i free them up to use for ubuntu if max amuont of loops r busy :confused:
 

TheGrammarFreak

Senior Member
Jul 29, 2010
2,820
678
0
twitter.com
Thanks for the help.
I have done it from loop1 to loop 7 and they r all busy so i just wanna know how many loops dos this phone have and how do i free them up to use for ubuntu if max amuont of loops r busy :confused:
If I knew how to free 'em up our problem would be solved. Lol. Rebooting might help, but otherwise I'm all outta ideas.

Sent from my Legend using XDA App
 

Zionator

Senior Member
Jan 28, 2009
2,120
640
198
Birmingham
www.Infowars.com
OH boy!!!

If I knew how to free 'em up our problem would be solved. Lol. Rebooting might help, but otherwise I'm all outta ideas.

Sent from my Legend using XDA App

Hmmm after to many tries with out luck i did a wipe and reinstalled azure and before applying the app pack with market in it i gave ubuntu a shot and bang it was running.
After applying the app pack market just starts auto downloading tonz of apps and reinstalling them so now i am back at pointblank :eek: all loops r busy :confused:.

i think this ubuntu is a nice idea but sadly only a few will be able to try it unless someone then finds out a way to reserve a loop or 2 for ubuntu :eek:
 

snakehult

Senior Member
Jun 8, 2010
369
60
0
Hmmm after to many tries with out luck i did a wipe and reinstalled azure and before applying the app pack with market in it i gave ubuntu a shot and bang it was running.
After applying the app pack market just starts auto downloading tonz of apps and reinstalling them so now i am back at pointblank :eek: all loops r busy :confused:.

i think this ubuntu is a nice idea but sadly only a few will be able to try it unless someone then finds out a way to reserve a loop or 2 for ubuntu :eek:
I will try to make new script.

meanwhile try
losetup -f

for show first free loop (X)

mod bootubuntu with:

sed 's/loop5/loopX/' bootubuntu

boot to recovery and rerun sh ./ubuntu.sh for update bootubuntu in /system/bin
 
Last edited:

Zionator

Senior Member
Jan 28, 2009
2,120
640
198
Birmingham
www.Infowars.com
I will try to make new script.

meanwhile try
losetup -f

for show first free loop (X)

mod bootubuntu with:

sed 's/loop5/loopX/' bootubuntu

boot to recovery and rerun sh ./ubuntu.sh for update bootubuntu in /system/bin
ok thanks very much for the reply i'll try it now :D

Edit :

This is how my bootubuntu looks like now and i am abit confused as to what line i have to change?

mount -o remount,rw -t yaffs2 /dev/block/mtdblock2 /system ;
export kit=/sdcard/ubuntu
export bin=/system/bin
if [ ! -d /data/local/ubuntu ]
then
mkdir /data/local/ubuntu ;
fi
export mnt=/data/local/ubuntu
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
mknod /dev/loop5 b 7 0 ;
losetup /dev/block/loop5 /sdcard/ubuntu/ubuntu.img ;
mount -t ext2 /dev/block/loop5 /data/local/ubuntu ;
mount -t devpts devpts $mnt/dev/pts ;
mount -t proc proc $mnt/proc ;
mount -t sysfs sysfs $mnt/sys ;
sysctl -w net.ipv4.ip_forward=1 ;
echo "Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4"
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "Setting localhost on /etc/hosts "
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "Brought to you by NexusOneHacks.net and the open source community! "
echo " "
echo " "
echo " "
echo "Modified by Snakehult "
echo "ver 0.1"
echo " "
chroot $mnt /bin/bash
#After exit command is executed clear it all up
echo " "
echo "Shutting down Ubuntu"
umount $mnt/dev/pts ;
umount $mnt/proc ;
umount $mnt/sys ;
umount $mnt ;
losetup -d /dev/loop5 ;



pew i have now reach 33 and still busy loops o_O i give up for now till more help comes :)
 
Last edited:

snakehult

Senior Member
Jun 8, 2010
369
60
0
ok thanks very much for the reply i'll try it now :D

Edit :

This is how my bootubuntu looks like now and i am abit confused as to what line i have to change?



pew i have now reach 33 and still busy loops o_O i give up for now till more help comes :)
Do As I told yo and run command in prev post. And sed will change file for you.
 

Zionator

Senior Member
Jan 28, 2009
2,120
640
198
Birmingham
www.Infowars.com
Lovin this porting :D

What dos this mean?
BogoMIPS : 479.72

And i saw in another forum that desire i think was running ether ubuntu or dedian with gui and just wanted to know if it is possible for legend or is the hardware to low for that?

And i got it working with losetup -f thanks i just didnt understand if i should put losetup in the script or as a command but figured it out :D

Edit :

When trying to install anything it tells me >
The following packages will be REMOVED:
libbeagle1{u} python-dev{u} python-nautilus{u} python2.6-dev{u}

What do i do to install apps are the above safe to remove or not?
I would realy like nano or something similar to be installed since gedit is installed but useless since no gui.
I am sure if the python is removed it will mess up ubuntu on the phone and dont realy need nautilus since there is no gui or am i totaly wrong?

Is there a command for a list of all the installed apps on ubuntu that would be useble in terminal mode?
 
Last edited:

BlaY0

Retired Recognized Developer
Sep 15, 2007
1,553
566
0
Medvode
What dos this mean?
BogoMIPS : 479.72
It means your gizmo runs at 480 MHz (not directly but indirectly).

When trying to install anything it tells me >
The following packages will be REMOVED:
libbeagle1{u} python-dev{u} python-nautilus{u} python2.6-dev{u}
If you don't have GUI, then it is safe because removal of all these packages won't impact the system. Check that you are using the right apt sources.

I am sure if the python is removed it will mess up ubuntu on the phone and dont realy need nautilus since there is no gui or am i totaly wrong?
Where does it say it will remove python??? Just development part of python, which you won't need if you don't compile natively stuff with python support.

Is there a command for a list of all the installed apps on ubuntu that would be useble in terminal mode?
Try aptitude. Install it if it is not installed yet but I doubt that.
 
Last edited:

jinxul

Senior Member
Sep 5, 2010
99
115
0
Tehran
c:\sdk\tools\adb shell
# cd /sdcard/ubuntu
cd /sdcard/ubuntu
# sh ./ubuntu.sh
sh ./ubuntu.sh
mount: mounting /dev/block/mtdblock3 on /system failed: device or resource busy
modprobe: module 'ext2' not found
←[H←[Jmkdir failed for /data/local/mnt, file exists
←[H←[Jrm: can't remove ' /system/bin/fsrw' : No such file or directory
rm : can't remove ' /system/bin/bootubuntu' : No such file or directory
rm : can't remove ' /system/bin/unionfs' : No such file or directory
rm : can't remove ' /system/bin/mountonly' : No such file or directory
cp : can't remove ' /system/bin/fsrw' : Out of memory
cp : can't remove ' /system/bin/bootubuntu' : Out of memory
cp : can't remove ' /system/bin/uniofs' : Out of memory
cp : can't remove ' /system/bin/mountonly' : Out of memory
chmod: su: No such file or directory
←[H←[J
ubuntu chroot bootloader v0.11
this process does NOT damage Android OS!
Original Installer By Charan Singh
Modified For Ubuntu Chroot by Max lee at NexusOneHacks.net
Modified by Snakehult
to enter the debian linux consol just type 'bootubuntu'
#sh ./bootubuntu
sh ./bootubuntu


--------------------------------------------------
then my phone Reboot but i cant run ubuntu with terminal !
what i have to do ?
 

snakehult

Senior Member
Jun 8, 2010
369
60
0
c:\sdk\tools\adb shell
# cd /sdcard/ubuntu
cd /sdcard/ubuntu
# sh ./ubuntu.sh
sh ./ubuntu.sh
mount: mounting /dev/block/mtdblock3 on /system failed: device or resource busy



--------------------------------------------------
then my phone Reboot but i cant run ubuntu with terminal !
what i have to do ?
You are not in recoverymode when running adb shell ?