[DEV] Chroot Ubuntu

Search This thread

Jhinta

Senior Member
Dec 20, 2010
704
276
here you go chroot ubuntu

So you have a working rootfile system like hd2
put the root file system on sdcard location /sdcard/ubuntu
place the two files in /sdcard/ubuntu
(run as root ) just install with -> sh install.sh And READ

installing vnc

in ubuntu linux terminal ->

export USER=root
vncserver -geometry 1024×750
nano /root/.bashrc

Add this to the beginning
###########################
export USER=root
cd /
rm -r -f tmp
mkdir tmp
cd /
vncserver -geometry 1280×750
########################### ctrl+x to save

Thanks to,
aligatro2010 4 resolution
poltak11 4 helping you guyś with some more info

now connect with your own password and port 5900 or 5901 ad localhost with VNC Android !!

Just download the rootfs from the HD2 form

Ubuntu Chrootenv. <- new
 
Last edited:

Jhinta

Senior Member
Dec 20, 2010
704
276

dm-1113093026193.png


So how does this works -->

# DONT TOUCH FIRST LINE !!!!
mount -o remount,rw -t ext4 /dev/block/mmcblk0p1 /system ## lets mount the nand RW so that we can make folders
echo "SETTING VARIABLES"
export bin=/system/bin ## divine where bin is
export mnt=/data/local/ubuntu ## divine where mnt is
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH ## set path so that we can run things anywhere
export TERM=linux ## divine term
export HOME=/root ## divine home
if [ ! -d /data/local/ubuntu ] ## if there go else create data/local/ubuntu
then
mkdir /data/local/ubuntu
fi

echo "MOUNTING"
mount -t ext2 -o loop /sdcard/ubuntu/rootfs.ext2 /data/local/ubuntu ## mount a ext2 loop file from dir to dir
mount -t devpts devpts $mnt/dev/pts ### mount android devpts in root (mnt/dev/pts)
mount -t proc proc $mnt/proc ## same as above
mount -t sysfs sysfs $mnt/sys ### same as above

echo "SETTING UP NETWORK"
sysctl -w net.ipv4.ip_forward=1 ## ip forward so that we have internet from android
echo "nameserver 208.67.222.222" > $mnt/etc/resolv.conf ### as is
echo "nameserver 208.67.220.220" >> $mnt/etc/resolv.conf ### as is
echo "127.0.0.1 localhost" > $mnt/etc/hosts ## as is
echo "All credits to original creator !!!!!!!"


chroot $mnt /bin/bash #### finally lets chroot the dir and init /bin/bash meaning lets start a vm on that dir


and thats all to chrooting
 
Last edited:

corwinmortac

Senior Member
Nov 13, 2006
154
23
Dallas
ok this is pure awesome but...it would mean running 2 OS's just like the old day of running multiple os types off my old winmo phone...right?
 

LucJoe

Senior Member
Nov 12, 2008
211
26
Wow, great work! Wish the xda app had a thanks button :)

Sent from my SPH-D700 using XDA App
 

salamandar

Senior Member
Feb 18, 2009
298
19
"So you have a working rootfile system like hd2
put the root file system on sdcard location /sdcard/ubuntu"

Would anyone mind explaining that beginning part? Seems like I have the folder on my SD card and the 2 files but I am missing the "working rootfile system like hd2". Does this mean i need to make an image of an already running root file system.

My apologies in advance if I am asking a noob question.
 

salamandar

Senior Member
Feb 18, 2009
298
19
I suspect they are refering to the ubuntu.img available in the HD2 Ubuntu Dev forum, im downloading now to test, i'll post my results.
 

lithiasalesjs

Senior Member
# ls
install.sh ubuntu
# sh install.sh
Type 'sh ubuntu' to boot Ubuntu
# sh ubuntu
SETTING VARIABLES
MOUNTING
ioctl LOOP_SET_FD failed: Bad file number
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
SETTING UP NETWORK
net.ipv4.ip_forward = 1
ubuntu: line 22: can't create /data/local/ubuntu/etc/resolv.conf: nonexistent directory
ubuntu: line 23: can't create /data/local/ubuntu/etc/resolv.conf: nonexistent directory
ubuntu: line 24: can't create /data/local/ubuntu/etc/hosts: nonexistent directory
All credits to original creator !!!!!!!
chroot: can't execute '/bin/bash': No such file or directory
#
 

Jhinta

Senior Member
Dec 20, 2010
704
276
# ls
install.sh ubuntu
# sh install.sh
Type 'sh ubuntu' to boot Ubuntu
# sh ubuntu
SETTING VARIABLES
MOUNTING
ioctl LOOP_SET_FD failed: Bad file number
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
SETTING UP NETWORK
net.ipv4.ip_forward = 1
ubuntu: line 22: can't create /data/local/ubuntu/etc/resolv.conf: nonexistent directory
ubuntu: line 23: can't create /data/local/ubuntu/etc/resolv.conf: nonexistent directory
ubuntu: line 24: can't create /data/local/ubuntu/etc/hosts: nonexistent directory
All credits to original creator !!!!!!!
chroot: can't execute '/bin/bash': No such file or directory
#

OMG , you only have two files !!! please read OP
 
Last edited:
  • Like
Reactions: LucJoe

poltak11

Senior Member
Feb 11, 2011
78
25
Melbourne
Alright, to you guys who don't understand (and I agree, the first post was a bit hard to understand), you need a few components first:
OP's uploaded zip containing 2 files (scripts that kinda do all the hard stuff for you):
- ubuntu
- install.sh
and
a root filesystem

The root filesystem is kinda like an image of Ubuntu and the kernel that had been ported to ARM by wizards, or something like that (correct me if I'm wrong please).

I'm pretty sure OP wants us to use an Ubuntu root filesystem for the HTC HD2, found here:
http://xdaforums.com/showthread.php?t=889433
(the torrent was fairly speedy)

Anyway, I just got this working with aligatro2010's link which takes us to a guide for getting this chrooting business happening on a Nexus One. But don't panic! The guide works for our Transformer too. So yeah, follow this if you want to get it up and running this way.
But at the line that tells you to type:
vncserver -geometry 1024×800
Change the resolution to 1280x750. Thanks to aligatro2010 for correcting my resolution. :D

Anyway, I'm going to try and get this working with the HD2 root filesystem as OP said, and will report back my success in a while.

(Seriously the coolest thing I've found yet with my TF... I never thought you could do this... thanks OP!!!)
 
Last edited:

aligatro2010

Senior Member
May 30, 2010
361
73
Alright, to you guys who don't understand (and I agree, the first post was a bit hard to understand), you need a few components first:
OP's uploaded zip containing 2 files (scripts that kinda do all the hard stuff for you):
- ubuntu
- install.sh
and
a root filesystem

The root filesystem is kinda like an image of Ubuntu and the kernel that had been ported to ARM buy wizards, or something like that (correct me if I'm wrong please).

I'm pretty sure OP wants us to use an Ubuntu root filesystem for the HTC HD2, found here:
http://xdaforums.com/showthread.php?t=889433
(the torrent was fairly speedy)

Anyway, I just got this working with aligatro2010's link which takes us to a guide for getting this chrooting business happening on a Nexus One. But don't panic! The guide works for our Transformer too. So yeah, follow this if you want to get it up and running this way.
But at the line that tells you to type:
vncserver -geometry 1024×800
Change the resolution to 1280x800. BUT WAIT! I did this and it kinda cut of the status bar at the bottom, so can someone please tell me how many pixels tall the status bar is? :D

Anyway, I'm going to try and get this working with the HD2 root filesystem as OP said, and will report back my success in a while.

(Seriously the coolest thing I've found yet with my TF... I never thought you could do this... thanks OP!!!)

1280x750 is the resolution I use.
 

poltak11

Senior Member
Feb 11, 2011
78
25
Melbourne
working

Alright, confirmed to have this fully working via OP's method. Details follow:

Get HD2 root filesystem:
http://xdaforums.com/showthread.php?t=889433
Download the link (torrent is fast). Extract it and find rootfs.ext2 in the linux folder. Copy that onto your TF and place it in the /sdcard/ubuntu/ directory (it's around 3GB).

Get OP's scripts:
Download from the link in the first post. Extract the zip and move the 2 files to the /sdcard/ubuntu/ directory on your TF.

Alright, now we got what we want.

Go into terminal emulator on your TF (any should hopefully work... I used BTE Pro).

Type the following:
Code:
su
Gives you root privileges... note: I'm not sure if this is needed... not too familiar with Android.
Code:
cd /sdcard/ubuntu/
sh ubuntu
You should now be "chrooted" into the Ubuntu environment. That is, you've changed the root to the Ubuntu root filesystem (don't worry if you don't understand this). It should look a bit like this:
Code:
root@localhost:/#

Now to get up the VNC server so we can view a GUI (make sure you have internet connection at this step!!! We're just going to update package list and install a very small app):
Code:
apt-get update
apt-get install tightvncserver
Now you've got your vnc app installed in Ubuntu.
Now to set it up for use:
Code:
export USER=root
vncserver -geometry 1280x750
Yep! That's all set up... but yeah, nothing's happening just yet.

If you haven't already got a VNC client installed on your TF (note Android NOT Ubuntu), go here:
http://code.google.com/p/android-vnc-viewer/downloads/list
and get the latest one and install it on your device.

Now go into the app and put a Nickname ("ubuntu" might be wise), your Password (if you made one), leave Address empty, and make Port 5901.
If you want it to look nice, change Color Format to 24-bit color (4 bpp).

Now press connect and you should be in your chrooted fully-functional Ubuntu.

Oh yeah, if you want to automate this whole process so you don't have to do it everytime you reboot your TF or whatever, follow the instructions in OP about editing /root/.bashrc file. This file basically runs everytime the root user logs in... ie. everytime you start your chrooted Ubuntu. So it will do all this automatically, everytime you start (type sh ubuntu in terminal).

Did I miss anything else?

Please note:
Jhinta is the brains behind this (and those HD2 guys who managed to port Ubuntu to ARM). If you get this working properly give some thanks to him. He's the one who wrote the scripts to do this all for you (those 2 files in the /sdcard/ubuntu/ directory). I'm just trying to make it a bit easier to understand for "non-linux nerds" and to help walk you through this. Because, really, it's pretty damn cool :p Even if you're not familiar with Linux or Ubuntu, try it out... you might just learn something!
 
Last edited:

Jhinta

Senior Member
Dec 20, 2010
704
276
Alright, confirmed to have this fully working via OP's method. Details follow:

Get HD2 root filesystem:
http://xdaforums.com/showthread.php?t=889433
Download the link (torrent is fast). Extract it and find rootfs.ext2 in the linux folder. Copy that onto your TF and place it in the /sdcard/ubuntu/ directory (it's around 3GB).

Get OP's scripts:
Download from the link in the first post. Extract the zip and move the 2 files to the /sdcard/ubuntu/ directory on your TF.

Alright, now we got what we want.

Go into terminal emulator on your TF (any should hopefully work... I used BTE Pro).

Type the following:
Code:
su
Gives you root privileges... note: I'm not sure if this is needed... not too familiar with Android.
Code:
cd /sdcard/ubuntu/
sh ubuntu
You should now be "chrooted" into the Ubuntu environment. That is, you've changed the root to the Ubuntu root filesystem (don't worry if you don't understand this). It should look a bit like this:
Code:
root@localhost:/#

Now to get up the VNC server so we can view a GUI (make sure you have internet connection at this step!!! We're just going to update package list and install a very small app):
Code:
apt-get update
apt-get install tightvncserver
Now you've got your vnc app installed in Ubuntu.
Now to set it up for use:
Code:
export USER=root
vncserver -geometry 1280x750
Yep! That's all set up... but yeah, nothing's happening just yet.

If you haven't already got a VNC client installed on your TF (note Android NOT Ubuntu), go here:
http://code.google.com/p/android-vnc-viewer/downloads/list
and get the latest one and install it on your device.

Now go into the app and put a Nickname ("ubuntu" might be wise), your Password (if you made one), leave Address empty, and make Port 5901.
If you want it to look nice, change Color Format to 24-bit color (4 bpp).

Now press connect and you should be in your chrooted fully-functional Ubuntu.

Oh yeah, if you want to automate this whole process so you don't have to do it everytime you reboot your TF or whatever, follow the instructions in OP about editing /root/.bashrc file. This file basically runs everytime the root user logs in... ie. everytime you start your chrooted Ubuntu. So it will do all this automatically, everytime you start (type sh ubuntu in terminal).

Did I miss anything else?

Please note:
Jhinta is the brains behind this (and those HD2 guys who managed to port Ubuntu to ARM). If you get this working properly give some thanks to him. He's the one who wrote the scripts to do this all for you (those 2 files in the /sdcard/ubuntu/ directory). I'm just trying to make it a bit easier to understand for "non-linux nerds" and to help walk you through this. Because, really, it's pretty damn cool :p Even if you're not familiar with Linux or Ubuntu, try it out... you might just learn something!

fist thing thnx for the addon info .

but its not a port ;) ubuntu is arm ,it was nerver ported its just a arm ubuntu build and will work on any arm cpu, chroot like this is just adapt to be able to do it .
there is realy nothing special about it , but native well , uuu in time soon i think
 
  • Like
Reactions: LucJoe

LucJoe

Senior Member
Nov 12, 2008
211
26
fist thing thnx for the addon info .

but its not a port ;) ubuntu is arm ,it was nerver ported its just a arm ubuntu build and will work on any arm cpu, chroot like this is just adapt to be able to do it .
there is realy nothing special about it , but native well , uuu in time soon i think

ohh! So in time we might see a nvflash version of Ubuntu that can completely replace Android? Maybe even a full package that can dual boot Ubuntu/Android natively?

Very exciting stuff, but I'm at the mercy of more intelligent devs around here. Good luck guys! :D
 

dude2k5

Senior Member
Jul 9, 2010
761
284
www.futurenology.com
Getting some errors


/sdcard/ubuntu # sh ubuntu
SETTING VARIABLES
MOUNTING
ioctl LOOP_SET_FD failed: Device or resource busy
mount: I/O error
mount: I/O error
mount: I/O error
SETTING UP NETWORK
net.ipv4.ip_forward = 1
ubuntu: line 22: can't create /data/local/ubuntu/etc/resolv.conf: I/O error
ubuntu: line 23: can't create /data/local/ubuntu/etc/resolv.conf: I/O error
ubuntu: line 24: can't create /data/local/ubuntu/etc/hosts: I/O error
All credits to original creator !!!!!!!
chroot: can't execute '/bin/bash': Input/output error
 

Jhinta

Senior Member
Dec 20, 2010
704
276
Getting some errors


/sdcard/ubuntu # sh ubuntu
SETTING VARIABLES
MOUNTING
ioctl LOOP_SET_FD failed: Device or resource busy
mount: I/O error
mount: I/O error
mount: I/O error
SETTING UP NETWORK
net.ipv4.ip_forward = 1
ubuntu: line 22: can't create /data/local/ubuntu/etc/resolv.conf: I/O error
ubuntu: line 23: can't create /data/local/ubuntu/etc/resolv.conf: I/O error
ubuntu: line 24: can't create /data/local/ubuntu/etc/hosts: I/O error
All credits to original creator !!!!!!!
chroot: can't execute '/bin/bash': Input/output error

means thats i cant mount the rootfs .
Device or resource busy -> the loop dev that we create i think it was /dev/block/loop2 is busy whit your device , you can edit the script and try any other loopX 123456 .
recommanded is to try to do the command 1 by one in adb shell or terminal
 

dude2k5

Senior Member
Jul 9, 2010
761
284
www.futurenology.com
means thats i cant mount the rootfs .
Device or resource busy -> the loop dev that we create i think it was /dev/block/loop2 is busy whit your device , you can edit the script and try any other loopX 123456 .
recommanded is to try to do the command 1 by one in adb shell or terminal

I opened the script and saw:
/dev/block/mmcblk0p1


Little confused..sorry

edit: wait, this?

mount -t ext2 -o loop /sdcard/ubuntu/rootfs.ext2 /data/local/ubuntu

edit2: well I tried again. When I got to
mount -t ext2 -o loop2 /sdcard/ubuntu/rootfs.ext2 /data/local/ubuntu
It worked, or didnt give me an error, but right after

mount -t devpts devpts $mnt/dev/pts

I get a mount: I/O error
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 14
    here you go chroot ubuntu

    So you have a working rootfile system like hd2
    put the root file system on sdcard location /sdcard/ubuntu
    place the two files in /sdcard/ubuntu
    (run as root ) just install with -> sh install.sh And READ

    installing vnc

    in ubuntu linux terminal ->

    export USER=root
    vncserver -geometry 1024×750
    nano /root/.bashrc

    Add this to the beginning
    ###########################
    export USER=root
    cd /
    rm -r -f tmp
    mkdir tmp
    cd /
    vncserver -geometry 1280×750
    ########################### ctrl+x to save

    Thanks to,
    aligatro2010 4 resolution
    poltak11 4 helping you guyś with some more info

    now connect with your own password and port 5900 or 5901 ad localhost with VNC Android !!

    Just download the rootfs from the HD2 form

    Ubuntu Chrootenv. <- new
    11
    working

    Alright, confirmed to have this fully working via OP's method. Details follow:

    Get HD2 root filesystem:
    http://xdaforums.com/showthread.php?t=889433
    Download the link (torrent is fast). Extract it and find rootfs.ext2 in the linux folder. Copy that onto your TF and place it in the /sdcard/ubuntu/ directory (it's around 3GB).

    Get OP's scripts:
    Download from the link in the first post. Extract the zip and move the 2 files to the /sdcard/ubuntu/ directory on your TF.

    Alright, now we got what we want.

    Go into terminal emulator on your TF (any should hopefully work... I used BTE Pro).

    Type the following:
    Code:
    su
    Gives you root privileges... note: I'm not sure if this is needed... not too familiar with Android.
    Code:
    cd /sdcard/ubuntu/
    sh ubuntu
    You should now be "chrooted" into the Ubuntu environment. That is, you've changed the root to the Ubuntu root filesystem (don't worry if you don't understand this). It should look a bit like this:
    Code:
    root@localhost:/#

    Now to get up the VNC server so we can view a GUI (make sure you have internet connection at this step!!! We're just going to update package list and install a very small app):
    Code:
    apt-get update
    apt-get install tightvncserver
    Now you've got your vnc app installed in Ubuntu.
    Now to set it up for use:
    Code:
    export USER=root
    vncserver -geometry 1280x750
    Yep! That's all set up... but yeah, nothing's happening just yet.

    If you haven't already got a VNC client installed on your TF (note Android NOT Ubuntu), go here:
    http://code.google.com/p/android-vnc-viewer/downloads/list
    and get the latest one and install it on your device.

    Now go into the app and put a Nickname ("ubuntu" might be wise), your Password (if you made one), leave Address empty, and make Port 5901.
    If you want it to look nice, change Color Format to 24-bit color (4 bpp).

    Now press connect and you should be in your chrooted fully-functional Ubuntu.

    Oh yeah, if you want to automate this whole process so you don't have to do it everytime you reboot your TF or whatever, follow the instructions in OP about editing /root/.bashrc file. This file basically runs everytime the root user logs in... ie. everytime you start your chrooted Ubuntu. So it will do all this automatically, everytime you start (type sh ubuntu in terminal).

    Did I miss anything else?

    Please note:
    Jhinta is the brains behind this (and those HD2 guys who managed to port Ubuntu to ARM). If you get this working properly give some thanks to him. He's the one who wrote the scripts to do this all for you (those 2 files in the /sdcard/ubuntu/ directory). I'm just trying to make it a bit easier to understand for "non-linux nerds" and to help walk you through this. Because, really, it's pretty damn cool :p Even if you're not familiar with Linux or Ubuntu, try it out... you might just learn something!
    8

    dm-1113093026193.png


    So how does this works -->

    # DONT TOUCH FIRST LINE !!!!
    mount -o remount,rw -t ext4 /dev/block/mmcblk0p1 /system ## lets mount the nand RW so that we can make folders
    echo "SETTING VARIABLES"
    export bin=/system/bin ## divine where bin is
    export mnt=/data/local/ubuntu ## divine where mnt is
    export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH ## set path so that we can run things anywhere
    export TERM=linux ## divine term
    export HOME=/root ## divine home
    if [ ! -d /data/local/ubuntu ] ## if there go else create data/local/ubuntu
    then
    mkdir /data/local/ubuntu
    fi

    echo "MOUNTING"
    mount -t ext2 -o loop /sdcard/ubuntu/rootfs.ext2 /data/local/ubuntu ## mount a ext2 loop file from dir to dir
    mount -t devpts devpts $mnt/dev/pts ### mount android devpts in root (mnt/dev/pts)
    mount -t proc proc $mnt/proc ## same as above
    mount -t sysfs sysfs $mnt/sys ### same as above

    echo "SETTING UP NETWORK"
    sysctl -w net.ipv4.ip_forward=1 ## ip forward so that we have internet from android
    echo "nameserver 208.67.222.222" > $mnt/etc/resolv.conf ### as is
    echo "nameserver 208.67.220.220" >> $mnt/etc/resolv.conf ### as is
    echo "127.0.0.1 localhost" > $mnt/etc/hosts ## as is
    echo "All credits to original creator !!!!!!!"


    chroot $mnt /bin/bash #### finally lets chroot the dir and init /bin/bash meaning lets start a vm on that dir


    and thats all to chrooting
    3
    Alright, to you guys who don't understand (and I agree, the first post was a bit hard to understand), you need a few components first:
    OP's uploaded zip containing 2 files (scripts that kinda do all the hard stuff for you):
    - ubuntu
    - install.sh
    and
    a root filesystem

    The root filesystem is kinda like an image of Ubuntu and the kernel that had been ported to ARM by wizards, or something like that (correct me if I'm wrong please).

    I'm pretty sure OP wants us to use an Ubuntu root filesystem for the HTC HD2, found here:
    http://xdaforums.com/showthread.php?t=889433
    (the torrent was fairly speedy)

    Anyway, I just got this working with aligatro2010's link which takes us to a guide for getting this chrooting business happening on a Nexus One. But don't panic! The guide works for our Transformer too. So yeah, follow this if you want to get it up and running this way.
    But at the line that tells you to type:
    vncserver -geometry 1024×800
    Change the resolution to 1280x750. Thanks to aligatro2010 for correcting my resolution. :D

    Anyway, I'm going to try and get this working with the HD2 root filesystem as OP said, and will report back my success in a while.

    (Seriously the coolest thing I've found yet with my TF... I never thought you could do this... thanks OP!!!)
    1
    I installed from http://androidadvocate.com/?p=339 and it works great, but running ubuntu native would be much, much better.