Ubuntu on Android !!!!

How to Install Ubuntu on Android!

For those of you who want to install Ubuntu on your Android smartphone or tablet device, here’s our universal guide on how to do it. (This guide is based off original guide at NexusOneHacks.net)
*Note – This guide should work on most “rooted” Android smartphones/tablets with no further modification.
We will be running Ubuntu “chrooted” under Android OS, which just means that we will be running a “virtual” Ubuntu OS that runs on top of the Android OS.  Your Android OS will work fully (e.g. your phone will keep working normally) while the Ubuntu runs on top of it.
First of all, you should have your Android device “rooted” because you need root access to run Ubuntu off your Android.
Second, your Android OS must support loop devices.  Most newer Android smartphones/tablets come with this support so we can mount our Ubuntu image as a loop device.  If not, you will either have to build your own kernel with support for loop devices or you can try an aftermarket ROM for your phone as most aftermarket ROMs come with support for it.
For example, G2 Phone and Nexus One both come with loop device support so there’s no need for us to compile a new kernel for it but for others, you may have to.
How do you know this?  Just try installing Ubuntu and if it doesn’t boot, your Android device needs a kernel with loop device support.  Otherwise you are fine.

How to Install Ubuntu on Android! (Windows)

First, download the following Ubuntu.zip file (from a preferred mirror), unzip and copy over the whole ubuntu directory to the SD card of your Android smartphone/tablet device:
Download ubuntu.zip

(Turn USB storage ON then copy over the Ubuntu folder to the root directory of your SD card.)

(What it looks like after copied over to the SD Card)
1) Again, make sure you have your Android smartphone/tablet “rooted”!
2) You must have Android SDK installed or have access to adb.exe.
3) Make sure your Android phone/tablet is in debugging mode.   Go to Settings->Applications->Development and make sure USB Debugging is checked ON.

4) Connect your Android device to your computer via USB cable and set the USB mode to “Just Charge”.
5) Your Android device should be recognized as “ADB Device” under Device Manager.  If not, install appropriate drivers.
For all HTC Android smartphones/tablets (such as G2 Phone, Nexus One), you can download Windows drivers here:
HTC Windows 64-bit driver download – Click Here to Download Driver
HTC Windows 32-bit driver download – Click Here to Download Driver
6) Open up a command prompt by typing “cmd” under Start->Search programs and files.
7) Browse to your SDK directory where you installed the Android SDK:

8) Then go into platform-tools directory:

9) Type “adb devices” to double-check your Android device is recognized.

In this example, I used an HTC G2 Phone, which shows up at “HT09SR204261″.  This is fine.  However, if you get an empty device, that means you didn’t install the drivers for your phone/tablet correctly. (Go back to #5)
10) Type “adb shell” to enter the Android shell.

Then type “su” to enter super user mode, then type “cd /sdcard” and “cd ubuntu” to enter the ubuntu directory in your SD card of your Android device.
11) 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.
12) Type “bootubuntu” to enter Ubuntu.  (Next time you enter Ubuntu, you just need to type “bootubuntu” from your /sdcard/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!!!
However, if you failed at this point, your Android OS probably doesn’t support loop devices, try installing another ROM or compiling your own kernel with loop device support.

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.

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.

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.

How to Fix Language Issues

Above is after I connected to my Android Ubuntu via SSH2.  Well, for some reason my default language switched to German.  To fix that, just type “export LANG=en_US.UTF-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”

Next, let’s setup xstartup file so that when TightVNCServer is started, the LXDE runs instead of GNOME:
Type “cat > /root/.vnc/xstartup”
Then type:
cat > /root/.vnc/xstartup
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
icewm &
lxsession

Then hit Ctrl+D twice and enter to save the file.

How to Start TightVNCServer!

Next, let’s start the TightVNCServer and connect to it from our Android phone and my Windows 7 desktop:
Type “export USER=root” and “vncserver -geometry 1024×800″.
Here, you can change the resolution settings 1024×800 to the resolution of your liking.

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″ and port number 5901 to connect.

And you should be able to get into your Ubuntu like this:

You can also use desktop software like TightVNC Viewer and connect to your phone.
Do “ifconfig” to find out what your IP address is in your Android Ubuntu.
In this example, mine was connected to “192.168.1.131″.
Then connect to “192.168.1.131:5901″ on your TightVNC Viewer:

Here’s LXDE running on my desktop off my G2 Phone’s Ubuntu:

Troubleshooting

Ubuntu not running?
Try typing “cp” under Android shell and if you get an error message, it means you need to install Busybox. Install Busybox and try again.

Final Thoughts

As said in the video, there will be a lot of improvements in the speed of Android devices in the near future.  This year, there will be a slew of dual-core 1Ghz processor-equipped Android devices being introduced.  Which just means our Android Ubuntu will run faster and faster.



ENJOY UBUNTU