[Emulation] Linux/Ubuntu for android (compatible with cm7/miui)

Search This thread

AnonymeLex

Senior Member
Sep 21, 2010
146
22
Hello,

I am going to prensent you today how to install ubuntu on your android device. Some of you propably already tried ,and had problems

making it work (or not). I modified the tutorial to make it easier, and corrected things. I also modified some paths in the scripts so that it can work with

cm7, if you are not a cm7 user you can download the other scripts too.


I based myself on this tutorial:

http://androlinux.com/android-ubuntu-development/how-to-install-ubuntu-on-android/


So let's start ! :D


First, download the following cm7-ubuntu.rar file (decompress and copy over the whole ubuntu directory to the exeternal SD card of your Android smartphone/tablet:

Download cm7-ubuntu.rar:

http://www.fileserve.com/file/KQWsbRG


If you are a miui user, download cm7-ubuntu.rar, and replace the scripts by these:

http://www.fileserve.com/file/Tu8WZP5

If you are a not a cm7 neither a miui user, download cm7-ubuntu.rar, and replace the scripts by these:

http://www.fileserve.com/file/tuVMB9h



1) Make sure your phone is rooted and that busybox installed (if you are on cm7 all is ok).

2) Download Terminal Emulator on the market. Open it and type “su” to enter super user mode, then type “cd /emmc” or "cd /sdcard/external_sd" if your are a miui user or "cd /sdcard" if you are not on cm7, and “cd ubuntu” to enter the ubuntu directory in your SD card of your Android device.

3) Next, type “sh ubuntu.sh” to run the script which will basically get your Ubuntu image ready to run on your Android smartphone/tablet.



If you get error messages, don’t worry and keep going.

4) Type “bootubuntu” to enter Ubuntu. (Next time you enter Ubuntu, you just need to type “bootubuntu” from your /emmc/ubuntu directory, no need to run ubuntu.sh again.



If you got “root@localhost” at this point, congratulations! This means your Android OS comes with loop device support and Ubuntu is now running “chrooted” on top of your Android OS!!! :p

However, if there is an error like : "losetup: /dev/block/loop2: No such file or directory", this propably means that app2sd is conflicting with your sdcard, so to solve that

move all your applications on your internal sdcard and try again. If this doesn't solve your problem, that means that your kernel doesn't support loop

devices in most of the case, try flashing other kernels.

If after that you still have problems post, and I will try to reply when I have time :)


5) How to Install Programs on your Ubuntu!

Once you’ve got Ubuntu running on your Android device, it’s time to install some Ubuntu packages(or programs).

Type “apt-get update” to update, this is the first thing you will need to do before installing any new programs.



6) How to Install OpenSSH-server on your Android Ubuntu!

Type “apt-get install openssh-server” to install OpenSSH-server. What is OpenSSH-server? If you want to connect to your Android Ubuntu via an IP address (and SSH into it), you will want to do this.



7) How to Install TightVNCServer on your Android Ubuntu!

If you want to access the GUI of your Android Ubuntu, you can install TightVNCServer, which allows you to access the Android Ubuntu via Android VNC app on your Android smartphone/tablet or even access it remotely from your desktop computer.

Type “apt-get install tightvncserver” to install.




8) How to Install LXDE!(optional)

Next, we will install LXDE (Lightweight X11 Desktop Environment). Although we can use Ubuntu’s default GNOME (and trust me I love that), LXDE takes up less memory so our GUI access will be faster.

If you like GNOME, you can skip this step though.

Type “apt-get install lxde”


How to setup xstartup file so that when TightVNCServer is started, the LXDE runs instead of GNOME:

Type:

export USER = root
vncserver

(here he will ask you for a password for vnc, then if you want a view-only password, this mean you connect to vnc and you cannot interact with ubuntu, say n if you don't want and y if you want)

cat > /root/.vnc/xstartup
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
icewm &
lxsession

Then press Volume-down&D togethe.



9) How fix language and start vnc at each boot:

Type:

touch /root/.bashrc
cat > /root/.bashrc
export LANG=en_US.UTF-8
export USER=root
rm /tmp/.X1-lock
rm /tmp/.X11-unix/X1
vncserver -geometry 1024x800 <== Here, you can change the resolution settings 1024×800 to the resolution of your liking. (Do not write that !)


Then again press Volume-down&D together.
 
Last edited:

AnonymeLex

Senior Member
Sep 21, 2010
146
22
10) Now we are going to reboot ubuntu to apply changes:

Reboot your phone, open Terminal Emulator again and type:

su
bootubuntu


Now your TightVNCServer is ready to accept any incoming connections from your phone or computer. Just point to the correct IP address and use port number 5901 to connect.

On your Android smartphone, just download the free app “Android-VNC-Viewer” and set the IP address to “127.0.0.1″ , port number 5901 and insert the password you set before in password.


Then enjoy ! :cool:

SHUT DOWN UBUNTU: Sorry you have to reboot the phone, if you try to boot other ubuntu your phone will start to lag




Extra:

If you want more space to install programs & stuff, you can extend your user space without loosing your data.

Requirements:

Linux (you can make a live CD) or just an environment like cygwin for windows

Procedure:

1. UnZip Android or your present ubuntu.img file to your Home Folder. Or a folder of your liking (or even on your memory card!), just remember to cd before you do the following:


2. Open Terminal and Copy&Paste (Ctrl+C, Ctrl+Shift+V) this:
Code:
dd if=/dev/zero bs=1M count=XXX >> ubuntu.img

where XXX is the amount, in MB, by which data.img should be increased by.

My filesize started out as 256MB and I wanted a total of 512MB. That would mean I needed a extra 256MB, so I executed this:
Code:
dd if=/dev/zero bs=1M count=256 >> ubuntu.img


3. Run a file system check and file system resizer
Code:
e2fsck -f ubuntu.img
resize2fs ubuntu.img
e2fsck -f ubuntu.img

if prompted, press "y" for "yes"


4. Copy all of the Android files onto your SD card, put it into your phone...

Source: http://xdaforums.com/showthread.php?t=737826


Sorry for my bad english :rolleyes:

If you liked this thread, don't forget there is a Thanks button ! :D
 
Last edited:

Alberto96

Recognized Developer
Feb 24, 2010
8,280
17,327
27
Modugno (BA)
Samsung Galaxy S4
LeEco Le 2
I have a problem with miui chamaleon rc2 . after i type bootubuntu i cant get root@localhost . im thinking that talonmtd dont support loopdevice but i have tried also with plapytus with no luck . you know i kernel with loop support for my rom ?
thanks
 
  • Like
Reactions: caccadassa

AnonymeLex

Senior Member
Sep 21, 2010
146
22
Do you have adb ?
MIU is based on cm7, you should have loop support...
do you have the error losetup : /dev/block/loop2: No such file or directory ?
 
Last edited:
  • Like
Reactions: 4wd vege

Alberto96

Recognized Developer
Feb 24, 2010
8,280
17,327
27
Modugno (BA)
Samsung Galaxy S4
LeEco Le 2
im restarting device and i will copy all the commands . one moment

edit : i get this :

# sh ubuntu.sh
sh ubuntu.sh
modprobe: chdir(/lib/modules): No such file or directory
←[H←[Jmkdir: can't create directory '/data/local/mnt': File exists
←[H←[Jcd: can't cd to /emmc/ubuntu
chmod: bootubuntu: Operation not permitted
chmod: fsrw: Operation not permitted
chmod: mountonly: Operation not permitted
chmod: ubuntu.img: Operation not permitted
chmod: ubuntu.sh: Operation not permitted
chmod: unionfs: Operation not permitted
←[H←[J
Ubuntu Chroot Bootloader v0.1
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 AndroLinux.com ,G2Hacks.com and Ne
eHacks.net

To enter the Ubuntu Linux console just type 'bootubuntu'
# bootubuntu
bootubuntu
mknod: /dev/loop2: File exists
losetup: /dev/block/loop2: No such file or directory
mount: mounting /dev/block/loop2 on /data/local/ubuntu failed: Invalid argu
mount: mounting devpts on /data/local/ubuntu/dev/pts failed: No such file o
ectory
mount: mounting proc on /data/local/ubuntu/proc failed: No such file or dir
y
mount: mounting sysfs on /data/local/ubuntu/sys failed: No such file or dir
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 non
ent
bootubuntu: cannot create /data/local/ubuntu/etc/resolv.conf: directory non
ent
Setting localhost on /etc/hosts
bootubuntu: cannot create /data/local/ubuntu/etc/hosts: directory nonexiste
READY TO ROCK AND ROLL BABY!
Brought to you by NexusOneHacks.net and the open source community!

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/loop2: No such device or address
 
Last edited:

AnonymeLex

Senior Member
Sep 21, 2010
146
22
No, verify you don't have applications on your external sd card, if there is, transfer them to the internal sd card

EDIT: Yes, verify you don't have applications on your sd card
 
Last edited:

AnonymeLex

Senior Member
Sep 21, 2010
146
22
Okay this is wierd !

2 possibilities :

1. busybox is not installed
2. Your phone do not support loop devices

Can you send me a file in your /proc/ directory named config.gz ? (sorry it is a pain in the ass...)

Oh sorry I forgot how is named your external sdcard ? emmc or sdcard ?
 
Last edited:

Alberto96

Recognized Developer
Feb 24, 2010
8,280
17,327
27
Modugno (BA)
Samsung Galaxy S4
LeEco Le 2

Alberto96

Recognized Developer
Feb 24, 2010
8,280
17,327
27
Modugno (BA)
Samsung Galaxy S4
LeEco Le 2
i maked an error .
after this cat > /root/.bashrc i typed :
export LANG=en_US.UTF-8
export USER=root
rm /tmp/.X1-lock
rm /tmp/.X11-unix/X1
vncserver -geometry 800x480
exit

so every time i run bootubuntu this shut down . XD what i have to do to fix that ?

Edit : im recopying all including new script and i will not do same error
 
Last edited:

thunderteaser

Senior Member
Jul 22, 2010
830
296
I'm using Ubuntu since 2006, it's really nice to see that the interest in Linux is growing so fast! :)
 

Alberto96

Recognized Developer
Feb 24, 2010
8,280
17,327
27
Modugno (BA)
Samsung Galaxy S4
LeEco Le 2
I'm using Ubuntu since 2006, it's really nice to see that the interest in Linux is growing so fast! :)

im using ubuntu since the first version of android XD . im using it in dual boot . but i have changed 5 pc since 2005 for too use . is in use 24h/7d also with overclock :eek: . super pc !!! super android !!
 

AnonymeLex

Senior Member
Sep 21, 2010
146
22
(
i maked an error .
after this cat > /root/.bashrc i typed :
export LANG=en_US.UTF-8
export USER=root
rm /tmp/.X1-lock
rm /tmp/.X11-unix/X1
vncserver -geometry 800x480
exit

so every time i run bootubuntu this shut down . XD what i have to do to fix that ?

Edit : im recopying all including new script and i will not do same error

Oh never thinked we could be in such a situation :D
The .bashrc is inside ubuntu.img, I don't really see a solution appart redownloading...

Sorry :(

Wait, exit don't really close ubuntu I think, it juste close terminal you should still able to connect via vnc and modify .bashrc ! To shut it down do Ctrl+D
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 9
    10) Now we are going to reboot ubuntu to apply changes:

    Reboot your phone, open Terminal Emulator again and type:

    su
    bootubuntu


    Now your TightVNCServer is ready to accept any incoming connections from your phone or computer. Just point to the correct IP address and use port number 5901 to connect.

    On your Android smartphone, just download the free app “Android-VNC-Viewer” and set the IP address to “127.0.0.1″ , port number 5901 and insert the password you set before in password.


    Then enjoy ! :cool:

    SHUT DOWN UBUNTU: Sorry you have to reboot the phone, if you try to boot other ubuntu your phone will start to lag




    Extra:

    If you want more space to install programs & stuff, you can extend your user space without loosing your data.

    Requirements:

    Linux (you can make a live CD) or just an environment like cygwin for windows

    Procedure:

    1. UnZip Android or your present ubuntu.img file to your Home Folder. Or a folder of your liking (or even on your memory card!), just remember to cd before you do the following:


    2. Open Terminal and Copy&Paste (Ctrl+C, Ctrl+Shift+V) this:
    Code:
    dd if=/dev/zero bs=1M count=XXX >> ubuntu.img

    where XXX is the amount, in MB, by which data.img should be increased by.

    My filesize started out as 256MB and I wanted a total of 512MB. That would mean I needed a extra 256MB, so I executed this:
    Code:
    dd if=/dev/zero bs=1M count=256 >> ubuntu.img


    3. Run a file system check and file system resizer
    Code:
    e2fsck -f ubuntu.img
    resize2fs ubuntu.img
    e2fsck -f ubuntu.img

    if prompted, press "y" for "yes"


    4. Copy all of the Android files onto your SD card, put it into your phone...

    Source: http://xdaforums.com/showthread.php?t=737826


    Sorry for my bad english :rolleyes:

    If you liked this thread, don't forget there is a Thanks button ! :D
    8
    Hello,

    I am going to prensent you today how to install ubuntu on your android device. Some of you propably already tried ,and had problems

    making it work (or not). I modified the tutorial to make it easier, and corrected things. I also modified some paths in the scripts so that it can work with

    cm7, if you are not a cm7 user you can download the other scripts too.


    I based myself on this tutorial:

    http://androlinux.com/android-ubuntu-development/how-to-install-ubuntu-on-android/


    So let's start ! :D


    First, download the following cm7-ubuntu.rar file (decompress and copy over the whole ubuntu directory to the exeternal SD card of your Android smartphone/tablet:

    Download cm7-ubuntu.rar:

    http://www.fileserve.com/file/KQWsbRG


    If you are a miui user, download cm7-ubuntu.rar, and replace the scripts by these:

    http://www.fileserve.com/file/Tu8WZP5

    If you are a not a cm7 neither a miui user, download cm7-ubuntu.rar, and replace the scripts by these:

    http://www.fileserve.com/file/tuVMB9h



    1) Make sure your phone is rooted and that busybox installed (if you are on cm7 all is ok).

    2) Download Terminal Emulator on the market. Open it and type “su” to enter super user mode, then type “cd /emmc” or "cd /sdcard/external_sd" if your are a miui user or "cd /sdcard" if you are not on cm7, and “cd ubuntu” to enter the ubuntu directory in your SD card of your Android device.

    3) Next, type “sh ubuntu.sh” to run the script which will basically get your Ubuntu image ready to run on your Android smartphone/tablet.



    If you get error messages, don’t worry and keep going.

    4) Type “bootubuntu” to enter Ubuntu. (Next time you enter Ubuntu, you just need to type “bootubuntu” from your /emmc/ubuntu directory, no need to run ubuntu.sh again.



    If you got “root@localhost” at this point, congratulations! This means your Android OS comes with loop device support and Ubuntu is now running “chrooted” on top of your Android OS!!! :p

    However, if there is an error like : "losetup: /dev/block/loop2: No such file or directory", this propably means that app2sd is conflicting with your sdcard, so to solve that

    move all your applications on your internal sdcard and try again. If this doesn't solve your problem, that means that your kernel doesn't support loop

    devices in most of the case, try flashing other kernels.

    If after that you still have problems post, and I will try to reply when I have time :)


    5) How to Install Programs on your Ubuntu!

    Once you’ve got Ubuntu running on your Android device, it’s time to install some Ubuntu packages(or programs).

    Type “apt-get update” to update, this is the first thing you will need to do before installing any new programs.



    6) How to Install OpenSSH-server on your Android Ubuntu!

    Type “apt-get install openssh-server” to install OpenSSH-server. What is OpenSSH-server? If you want to connect to your Android Ubuntu via an IP address (and SSH into it), you will want to do this.



    7) How to Install TightVNCServer on your Android Ubuntu!

    If you want to access the GUI of your Android Ubuntu, you can install TightVNCServer, which allows you to access the Android Ubuntu via Android VNC app on your Android smartphone/tablet or even access it remotely from your desktop computer.

    Type “apt-get install tightvncserver” to install.




    8) How to Install LXDE!(optional)

    Next, we will install LXDE (Lightweight X11 Desktop Environment). Although we can use Ubuntu’s default GNOME (and trust me I love that), LXDE takes up less memory so our GUI access will be faster.

    If you like GNOME, you can skip this step though.

    Type “apt-get install lxde”


    How to setup xstartup file so that when TightVNCServer is started, the LXDE runs instead of GNOME:

    Type:

    export USER = root
    vncserver

    (here he will ask you for a password for vnc, then if you want a view-only password, this mean you connect to vnc and you cannot interact with ubuntu, say n if you don't want and y if you want)

    cat > /root/.vnc/xstartup
    #!/bin/sh
    xrdb $HOME/.Xresources
    xsetroot -solid grey
    icewm &
    lxsession

    Then press Volume-down&D togethe.



    9) How fix language and start vnc at each boot:

    Type:

    touch /root/.bashrc
    cat > /root/.bashrc
    export LANG=en_US.UTF-8
    export USER=root
    rm /tmp/.X1-lock
    rm /tmp/.X11-unix/X1
    vncserver -geometry 1024x800 <== Here, you can change the resolution settings 1024×800 to the resolution of your liking. (Do not write that !)


    Then again press Volume-down&D together.
    4
    my external card is named /sdcard/external_sd and is a 16 gb class 2 so is a bit slower
    4
    Okay I think if found, I going to post new scripts for you quickly, I just verify that you have loop support

    EDIT: Yes you have loop support, it is scripts

    Replace these scripts : http://www.fileserve.com/file/Tu8WZP5

    Dont worry , but please upload this to xda because i hate fileserve and i have to wait 1200 seconds to download another file . Thanks :)
    4
    i dont have application on sd card