Featured

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 my 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.

Getting Following errors?
Err http://ports.ubuntu.com karmic/main Packages
404 Not Found
Err http://ports.ubuntu.com karmic/universe Packages
404 Not Found
W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/karmic/main/binary
-armel/Packages.gz 404 Not Found

W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/karmic/universe/bi
nary-armel/Packages.gz 404 Not Found

E: Some index files failed to download, they have been ignored, or old ones used
instead.

Try:
cat > /etc/apt/sources.list
deb http://old-releases.ubuntu.com/ubuntu/ karmic main universe

Then hit Ctrl+D twice and Enter.

This will update the Ubuntu sources.

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.

Ubuntu “Officially” Coming to Android!

Here’s some great news for the Android/Ubuntu community, Ubuntu (the company itself) is working around the clock to bring you more “seamless” integration between Ubuntu and Android. I know my initial goal was to do this myself but over the months, I simply don’t have the time to develop HDMI drivers for different phones nor am I that expert at Linux.

So what?

Since Ubuntu is really working hard to bring us seamless integration of Ubuntu and Android, we will eventually be able to get Ubuntu easily on our Android smartphones without doing any kind of “hacks”.

The best part?

We can expect to make full use of Ubuntu without the VNC bottleneck and use HDMI output natively (on all phones with HDMI output support), meaning we will get a full Ubuntu experience without lag soon. Besides personal uses, this means we can literally turn every “old” Android smartphone into a Ubuntu Linux computer, which has a million uses including re-using them as school computers for toddlers and elementary schoolers. The ideas are endless and it’s a good thing Ubuntu has finally seen that “vision”.

Anyways, I can’t wait for this to be available! Yippee!

And no, you can’t do this on iOS, sorry Apple fans. Android runs Linux kernels natively, meaning porting Ubuntu or any other Linux distro was “just a matter of time”.

How to Install Ubuntu on Rooted Transformer Prime!

Want to run Ubuntu Linux on your rooted Transformer Prime?

Well, I just had to since the Transformer Prime comes with world’s first quad-core processor and indeed, it’s running fine on my new tablet.

The results?

It does run much faster in shell (than Galaxy Tab 10.1) but running Gnome via VNC has its limits, quad-core doesn’t seem to help at all for that.  But people who just want Ubuntu running alongside Android (without breaking it) and run Ubuntu apps in the background such as an Nginx web server and whatnot, this could be a great way.

Again, shell seems to run faster than ever (quad-core does help here)  so the next step would be trying to run Linux applications such as a web server, use it as a spare Linux box to compile your Android kernels, and whatnot.  This is actually good news though, Ubuntu does run faster, just VNC is slow.

For those of you who need such features, I do recommend installing Ubuntu.  For others who want to use Ubuntu as a web browsing device, I’d say just stick with your Android browser/OS.

Here’s how to install Ubuntu on rooted Transformer Prime:

Before we begin, make sure you’ve rooted your Transformer Prime and installed Busybox.  If you used our rooting method on TransformerPrimeRoot.com, you should be ready to rock.

Step 1. Download ubuntu.zip and unzip to a folder called ubuntu.  Copy that whole folder to the root directory of your Transformer Prime’s internal storage.

Download ubuntu.zip

Step 2. Download Terminal Emulator off the Market (it’s free) and open.

Step 3. Type each of the following lines and hit Enter.

su

cd /sdcard/ubuntu

You only have to enter the following line the first time you run ubuntu. (skip otherwise)

sh ubuntu.sh

Step 4. Next type:

bootubuntu

to enter Ubuntu shell.

Step 5. Type the following to run a custom script that will start the SSH server (so you can SSH to it) and XTightVNC (so you can VNC to it):

cd

sh run.sh

Step 6. Install AndroidVNC App from the Market (free app) and set the Nickname (to anything you want), Password to “123123”, Address to “127.0.0.1”, and Port to “5901”.

Step 7. You should be connected to the Ubuntu running on your Transformer Prime.

Final Thoughts

VNC makes the GUI on Ubuntu much slower than it should.  And even if we ran Ubuntu natively, it would lag a bit unless we had full driver support from Ubuntu.

BUT, Ubuntu runs pretty darn fast in shell.  And for most people who are trying to use Ubuntu for something other than everyday web browsing, it will run fairly fast.

Next, I will try to do some tests like run some web servers or maybe even compile some Android kernels on it.   Maybe you can figure out some cool hacks to do on Ubuntu, have fun!

 

Native Ubuntu on EeePad Transformer!

My original goal was to put Ubuntu running “chrooted” on top of Android OS so you can still use your Android as a phone while running Ubuntu. Well, that was before the days of Android tablets.

Now that I’ve got hands on an EeePad Transformer with a keyboard dock, it makes more sense to just straight run a native Ubuntu on it.

It runs much faster than chrooted although there’s still some bugs and kinks to work out such as speakers not working, flash not working, and whatnot but it’s very usable.

For those of you who want to install native Ubuntu on your EeePad Transformer, you can check out step-by-step directions over at EeePadHacks.net.

And here’s video of me install native Ubuntu on EeePad Transformer:

And files you need:

Download EeePad Transformer Ubuntu files

Ubuntu on Galaxy Tab 10.1!

Well, I just picked up a Galaxy Tab 10.1, my first 10.1-inch tablet device. I did root my Galaxy Tab 10.1 and put Ubuntu on it and what a difference it is from Ubuntu on smartphone!

It’s actually usable so long as you connect a bluetooth mouse and keyboard. Web browser on the Ubuntu Gnome is a bit laggy but I really need it for shell access so this is going to be a lot of fun.

Best of all, the Galaxy Tab 10.1 has 1280×800 resolution (better than iPad 2 btw), which makes the Ubuntu desktop look crisp and clear!

Anyways, I’ve outlined the step-by-step instructions specifically for Galaxy Tab 10.1 over at my new site GalaxyTabHacks.com.

For those of you who just picked up a Galaxy Tab 10.1, you can read up on How to Install Ubuntu on Galaxy Tab 10.1.

Steps are basically the same except for installing busybox and also I dumped LXDE for Ubuntu default Gnome, much better I think and also runs well with 1Ghz dual-core Tegra.

How to Install Busybox on your Android!

For the Ubuntu script to work, Busybox must be installed on your rooted Android device.

Most rooting process involves installing of Busybox but sometimes they don’t.

So if you get errors while trying to run Ubuntu on Android and doesn’t run, try installing Busybox on your Android:

I made a script so it’s easy to install Busybox on your Android:

1) Download Busybox.zip from one of the mirrors below and unzip:

Download busybox.zip

2) Run “adb shell” at command prompt to get into shell.

3) Type “su” to make sure you are in root mode.

4) Type “cd /sdcard” and “sh ./installbusybox.sh” to install Busybox.

How to Build CHROOT ARM Ubuntu Images for Android!

This is for those of you who want to learn how to build your own CHROOT ARM Ubuntu images for Android from scratch.

Why?  For example, perhaps you might want to include certain programs like SSH, Web server, etc…etc… so the Ubuntu image you ultimately end up using on your Android device will not have stuff you don’t want/need.

Also, this is actually a great way to learn about the whole process of running ARM Ubuntu on your Android device whether it be a smartphone or tablet.

How to Build CHROOT ARM Ubuntu images for Android

*Note – This guide will work on all ARM-architectures of Android including TI-OMAP, Samsung Hummingbird, and Qualcomm, so long as they are ARMv7 architecture. (e.g. Nexus One, HTC Evo 4G, Droid X, Droid 2,Samsung Galaxy S, etc…etc…)

1) First, you will need to a Ubuntu system 9.10 (karmic) or later, I used Ubuntu Lucid Lynx 10.4 on my Intel Core i7 desktop. *Actually running that of VirtualBox on my Windows 7 64-bit.

2) Open up a terminal on your Ubuntu system.

3) Let’s make an ARM Ubuntu image using Rootstock command:
sudo rootstock \
--fqdn ubuntu \
--login ubuntu \
--password ubuntu \
--imagesize 4G \
--seed linux-image-omap,build-essential,mysql-server,tightvncserver,lxde,mysql-server-core-5.1,mysql-server-5.1,libmysqlclient16,mysql-common,mysql-client-core-5.1

Here, you can set login/password to your liking, image size, and also different programs you want installed beforehand. You can always use apt-get to install more packages after you CHROOT.

You should end up with a file like armel-rootfs-201101311759.tgz with the datestamp of the time you ran the command.

4) Let’s make an empty image file with command, “dd”:

dd if=/dev/zero of=ubuntu.img bs=1MB count=0 seek=4096

Here, you can change the seek parameter to how big of an image file you want to make. I have it set to 4096, which is 4GB. If you want smaller or larger, change this value accordingly. E.g. 8192 for 8GB.

5) Next, we are going to format the image as ext2/ext3 filesystem so it can be compatible with our Android OS:
mke2fs -F ubuntu.img

6) Next, we will mount the empty image file to directory /mnt:
sudo mount -o loop ubuntu.img /mnt

7) Next, we will uncompress (untar) the ARM image we made earlier into the /mnt directory:
sudo tar -C /mnt -zxf armel-rootfs-200904151837.tgz

8) Once all the files are copied over, we simply unmount the image file and we are ready to rock and roll (or copy it over to your Android device)!
sudo umount /mnt

9) If you have trouble installing software using apt-get after you made this image, try installing it under CHROOT on your Ubuntu (not Android) by using QEMU user mode emulation.

References


ARM RootfsFromScratch – This is a great place to start on learning to build ARM Ubuntu images for Android.   Just make sure to use “mke2fs” instead of “mkfs.ext4” as Android currently doesn’t support ext4 file system type (as far as I know and I’ve tried).