[DEV] Chroot Ubuntu

Search This thread

commandersafi

Senior Member
Mar 10, 2011
106
405
So just typing exit on terminal will shut down the Ubuntu VM? I did that and when I came back to my Pocket Cloud connection it was still running.

I haven't been able to play with it much because of the "d" being mapped, but I've been able to browse around my MS workgroup at home and use the basic tools included without a problem.

What interests me the MOST is to have a working version of Open Office! :)

I haven't used the method in this thread to install the chroot ubuntu but to restart ubuntu go to your android terminal emulator and type the command 'ubuntu stop' and it will restart the tab.
 

nttdemented

Senior Member
Sep 20, 2008
162
17
I haven't used the method in this thread to install the chroot ubuntu but to restart ubuntu go to your android terminal emulator and type the command 'ubuntu stop' and it will restart the tab.

Tried that under the android terminal with su rights already elevated and after entering

# su
# ubuntu stop

I get
ubuntu: permission denied

So it seems that the command ubuntu is registered and expecting arguments but it is not allowing me to run the stop command.

The only way I've found to shut down the VM is by rebooting Honeycomb itself. I already figured out how to manage tightvncserver and how to close down open session etc. Just can't actually reboot or shutdown the VM itself or I'm not understanding something.
 

nttdemented

Senior Member
Sep 20, 2008
162
17
I installed from http://androidadvocate.com/?p=339 and now i cant get what Jhinta posted

i keep getting this

I get that to if I exit out of the root shell back to the android shell and use sh ubuntu to come back to the ubuntu root shell.

Played around with it attached to the dock now that I finally got the 'd' shortcut to stick after rebooting the entire tablet.

Still cant get to shutdown or restart the ubuntu vm and require a cold reboot to shut down.
 

commandersafi

Senior Member
Mar 10, 2011
106
405
I get that to if I exit out of the root shell back to the android shell and use sh ubuntu to come back to the ubuntu root shell.

Played around with it attached to the dock now that I finally got the 'd' shortcut to stick after rebooting the entire tablet.

Still cant get to shutdown or restart the ubuntu vm and require a cold reboot to shut down.

Once again this isn't the exact file I used (used the one that first came out in the xoom forum), but in the one I had there was no way of stopping/rebooting Ubuntu alone. Running the 'ubuntu stop ' command I mentioned actually does just reboot the transformer. I guess I should have mentioned before that you need to restart the tab in any way instead of telling the command that would do it.
 

poltak11

Senior Member
Feb 11, 2011
78
25
Melbourne
To the people wanting to know how to shutdown the VNC server without rebooting honeycomb, here's how I do it:
Go back into the terminal emulator (that is still chrooted into Ubuntu).
Type the following code:
Code:
vncserver -kill :1
Now, the number "1" in that line corresponds to the what the running VNC server is numbered... (I can't think of a better way to explain this) for instance, if you have 3 instances of VNC server running, they might be numbered 1, 2, 3.

So by default when you type in:
Code:
vncserver -geometry 1280x750
to actually start the VNC server, it should make this instance of VNC server number 1.

So under the condition that you are running only one VNC server out of your chrooted Ubuntu (don't really know why you'd want more than one in these circumstances...), just type in the first command I showed you up there.

And yeah, that should kill the server and it won't be running in the background anymore.


If nothing I wrote up there made any sense: (my head's not screwed on atm)
Try the first command... if it doesn't work, substitute 2 in the place of the 1 there. If that doesn't work, you probably already shutdown your VNC server with some magic, such as shutting down the terminal emulator, so yeah, don't worry (unless, of course, you can still connect...).

Hope this helped :)
 
Last edited:

poltak11

Senior Member
Feb 11, 2011
78
25
Melbourne
ok this is a long shot here, but while using chroot, can i mount external devices like external wifi or usb storage?

By default, if you plug in an external/usb peripheral it doesn't automatically mount itself within chrooted Ubuntu (but of course get's mounted in Android). This is because you're working within a virtual filesystem, that's kinda separate to the Android filesystem, or some other such nonsense.

But yeah, you could probably easily do it by adding an extra mount command to the startup ubuntu script that we've got. But this would mean you must have the device mounted under Android before starting the chroot.
If you mount it after starting the chroot, you could probably just do the same mount command in Ubuntu while it's running and it would work alright.

The mount command would like something like following:
Code:
mount [B]/android/mount/point/[/B] /mnt/
But of course, I don't know how to access the Android filesystem from within Ubuntu chroot. It's probably really simple, but I'm too much of a dumbass.

Someone correct me if I'm wrong. Just in my head, in theory it works.
 

nicandris

Inactive Recognized Developer
Jan 5, 2009
1,141
215
Amsterdam
plus.google.com
By default, if you plug in an external/usb peripheral it doesn't automatically mount itself within chrooted Ubuntu (but of course get's mounted in Android). This is because you're working within a virtual filesystem, that's kinda separate to the Android filesystem, or some other such nonsense.

But yeah, you could probably easily do it by adding an extra mount command to the startup ubuntu script that we've got. But this would mean you must have the device mounted under Android before starting the chroot.
If you mount it after starting the chroot, you could probably just do the same mount command in Ubuntu while it's running and it would work alright.

The mount command would like something like following:
Code:
mount [B]/android/mount/point/[/B] /mnt/
But of course, I don't know how to access the Android filesystem from within Ubuntu chroot. It's probably really simple, but I'm too much of a dumbass.

Someone correct me if I'm wrong. Just in my head, in theory it works.

lol i googled about "mount external usb chrootr" and it actually displayed your answer haha

i guess the proper way is to mount it in the startup script. will play a bit with that as soon as my tablet arrives. now the main question is, can i connect an external wifi antenna
 

daniel9522

Senior Member
Dec 6, 2010
196
12
Toronto
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!



unable to install i keep getting this (in the picture)


i install this I installed from http://androidadvocate.com/?p=339 and it works great, but running ubuntu native would be much, much better.


need help please
 

david279

Senior Member
Sep 4, 2007
5,680
1,888
New Orleans
unable to install i keep getting this (in the picture)


i install this I installed from http://androidadvocate.com/?p=339 and it works great, but running ubuntu native would be much, much better.


need help please

I bet you have the Ubuntu folder on your external sdcard. Thats whats causing the error. You could edit the Ubuntu script to point to /Removable/MicroSD/ubuntu/ or just move the files over to the internal sdcard(/mnt/sdcard/).
 

Jhinta

Senior Member
Dec 20, 2010
704
276
Tried that under the android terminal with su rights already elevated and after entering

# su
# ubuntu stop

I get
ubuntu: permission denied

So it seems that the command ubuntu is registered and expecting arguments but it is not allowing me to run the stop command.

The only way I've found to shut down the VM is by rebooting Honeycomb itself. I already figured out how to manage tightvncserver and how to close down open session etc. Just can't actually reboot or shutdown the VM itself or I'm not understanding something.


sorry forgot the umount scripts , i will add them tonight , you have to umount the chroot thats it .
 

poltak11

Senior Member
Feb 11, 2011
78
25
Melbourne
unable to install i keep getting this (in the picture)


i install this I installed from http://androidadvocate.com/?p=339 and it works great, but running ubuntu native would be much, much better.


need help please

First off, I highly recommend you get the one from the HD2 forum (I linked it in on of my earlier posts) as it's a far more recent version of Ubuntu and comes with some nicer things (plus it's easier to get set up).

Anyway, if you want to try with this one, the problem here is that you are trying to get it working using Jhinta's scripts that aren't compatible with this. So you must use the scripts that came with the download on http://androidadvocate.com/?p=339. I think those ones are called bootubuntu and ubuntu.sh.

So yeah, get them and the root filesystem (called something.img) and put them all in the /sdcard/ubuntu/ directory. Then go to that directory, su, then type:
Code:
sh ubuntu.sh
then
Code:
bootubuntu
after this you should be in a chrooted fully working Ubuntu (although it will just be a command line, which you might not want). The details to get the gui up and running are detailed in that link you posted, along with everything I've said here (in more detail).

But yeah, play around with that and get it working if you want. But I advise you to download the version on the HD2 forums for a more up-to-date and easier to install version.

Tell me if you need anymore help :)
 
  • Like
Reactions: daniel9522

EpiphanyMachine

Senior Member
Dec 1, 2008
78
33
San Francisco, CA
Can anyone confirm if either firefox or chrome (chromium) work on this build?

I have the version from the xoom forum (Ubuntu 11.04) installed but firefox crashes on startup and chromium displays a blank white screen even though it connects and downloads the data. I can click on a link blindly (the whole screen is white) if I know where it is, but cannot see anything.

Thanks for the help :)
 

daniel9522

Senior Member
Dec 6, 2010
196
12
Toronto
First off, I highly recommend you get the one from the HD2 forum (I linked it in on of my earlier posts) as it's a far more recent version of Ubuntu and comes with some nicer things (plus it's easier to get set up).

Anyway, if you want to try with this one, the problem here is that you are trying to get it working using Jhinta's scripts that aren't compatible with this. So you must use the scripts that came with the download on http://androidadvocate.com/?p=339. I think those ones are called bootubuntu and ubuntu.sh.

So yeah, get them and the root filesystem (called something.img) and put them all in the /sdcard/ubuntu/ directory. Then go to that directory, su, then type:
Code:
sh ubuntu.sh
then
Code:
bootubuntu
after this you should be in a chrooted fully working Ubuntu (although it will just be a command line, which you might not want). The details to get the gui up and running are detailed in that link you posted, along with everything I've said here (in more detail).

But yeah, play around with that and get it working if you want. But I advise you to download the version on the HD2 forums for a more up-to-date and easier to install version.

Tell me if you need anymore help :)
the one from http://androidadvocate.com/?p=339 works perfectly fine but it seems pretty old

But I advise you to download the version on the HD2 forums for a more up-to-date and easier to install version.

but how ?
do i have to get rid of the one i installed or something
cause when ever i try the one from HD2 forum
i keep getting
chroot: cant execute '/bin/bash': no such file or directory
 

Jhinta

Senior Member
Dec 20, 2010
704
276
the one from http://androidadvocate.com/?p=339 works perfectly fine but it seems pretty old

But I advise you to download the version on the HD2 forums for a more up-to-date and easier to install version.

but how ?
do i have to get rid of the one i installed or something
cause when ever i try the one from HD2 forum
i keep getting
chroot: cant execute '/bin/bash': no such file or directory


you only need the rootfs of the hd2 and not the script that come with it, as its not build for tf101 (mount point div.) its simple, just ad the rootfs.ext2 to tf101 on /sdcard/ubuntu/rootfs.ext2 + when running th scripts mak sure your root. if you not ruuning my scripts you just need to edit the scripts so that mount points and dir. are correct. you can run them 1 by 1 to see whats failing.
 

daniel9522

Senior Member
Dec 6, 2010
196
12
Toronto
you only need the rootfs of the hd2 and not the script that come with it, as its not build for tf101 (mount point div.) its simple, just ad the rootfs.ext2 to tf101 on /sdcard/ubuntu/rootfs.ext2 + when running th scripts mak sure your root. if you not ruuning my scripts you just need to edit the scripts so that mount points and dir. are correct. you can run them 1 by 1 to see whats failing.



when running th scripts mak sure your root.
how to run your scripts
 

Jhinta

Senior Member
Dec 20, 2010
704
276
Put them in the same dir as rootfs install a terminal emulator then run su and then cd /sdcard/ubuntu and then sh install.sh then sh ubuntu


Sent from my Transformer TF101 using Tapatalk
 
  • Like
Reactions: daniel9522

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.