ishmaelchibvuri.files.wordpress.com  · web viewthis ubuntu install will not affect your existing...

18
How to Install Ubuntu on Your Android Device (World’s first installation of Ubuntu on an Android smartphone! WHOOHOO!) This guide is for those of you who want to install Ubuntu as a sub-system under your Nexus One or any other rooted Android smartphone, I’ve tried to make it easy as possible for everyone. To be on the practical side, I think it’s ideal to run Ubuntu along with your Nexus One/Android phone as I will be showing you here.

Upload: ngotuong

Post on 22-Nov-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ishmaelchibvuri.files.wordpress.com  · Web viewThis Ubuntu install will not affect your existing Android system, the Ubuntu terminal will run in the background while the Ubuntu

How to Install Ubuntu on Your Android Device

(World’s first installation of Ubuntu on an Android smartphone! WHOOHOO!)

This guide is for those of you who want to install Ubuntu as a sub-system under your Nexus One or any other rooted Android smartphone, I’ve tried to make it easy as possible for everyone.

To be on the practical side, I think it’s ideal to run Ubuntu along with your Nexus One/Android phone as I will be showing you here.

Page 2: ishmaelchibvuri.files.wordpress.com  · Web viewThis Ubuntu install will not affect your existing Android system, the Ubuntu terminal will run in the background while the Ubuntu

This Ubuntu install will not affect your existing Android system, the Ubuntu terminal will run in the background while the Ubuntu X11 graphical user interface will run as an app under Android VNC app.

Why are you installing Ubuntu on your Nexus One/Android phone?

Being able to have Ubuntu on your Nexus One/Android phone means that you can run native Ubuntu/linux applications off your phone!

I also see many uses in college engineering classes when they are studying Ubuntu/linux.  Instead of heading to the lab or having dual-boot on their computer, students will be able to use their Nexus One/Android phone as a test device.

Even for web designers, their Android phone can become a portable test web server to test out their new designs.

The list will go on and there’s absolutely no reason why we shouldn’t run Ubuntu or other linux systems on Android phones.

Lastly, for open-source people like me, free code is priceless, it’s going to be what’s driving the world in the next 10-20 years, if it ain’t already.

I don’t want to bore you with my philosophy so let me show you step-by-step how to install Ubuntu on your Nexus One.

Page 3: ishmaelchibvuri.files.wordpress.com  · Web viewThis Ubuntu install will not affect your existing Android system, the Ubuntu terminal will run in the background while the Ubuntu

How to Install Ubuntu on your Nexus One/Android Phone!

Before anything, download ubuntu.zip and unzip it:

Download ubuntu.zip (http://keetsa.com/files/ubuntu.zip)(Please feel free to mirror other places if you’d like!)

1. First, you will need a rooted Nexus One/Android phone.  If you have a Nexus One, go follow these directions and root your phone

first!UPDATE: Also, you need to install the latest Busybox

(http://downloadandroidfiles.com/files/get/oAFtqIAkOT/busybox.zip)

How to Install Busybox on your Android!

Posted on February 3, 2011 by adminFor 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:

Page 4: ishmaelchibvuri.files.wordpress.com  · Web viewThis Ubuntu install will not affect your existing Android system, the Ubuntu terminal will run in the background while the Ubuntu

Download busybox.zip(http://downloadandroidfiles.com/files/get/oAFtqIAkOT/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.

2. Once you have a “rooted” Android phone, you will be able to run Ubuntu under Chroot.

What is Chroot?I just found about this myself the other day while doing this but Chroot in layman’s terms is basically the ability to run other operating systems under your current system (in this case Android).  Chroot was initially developed to test new operating systems in a virtual environment but will work perfectly in this case for our project here as it will allow us to use Ubuntu as a “virtual” machine under Android system.  Yes, just think of it like Sun Virtualbox or VMWare for Android and other linux systems.

On one more note, you can only “chroot” another operating system made for your system’s architecture.  For example, most new Android smartphones including Nexus One, HTC Evo 4G, and Droid X all use ARM architecture CPU, meaning you can only use ARM-based linux systems/ports.

Page 5: ishmaelchibvuri.files.wordpress.com  · Web viewThis Ubuntu install will not affect your existing Android system, the Ubuntu terminal will run in the background while the Ubuntu

In this case, we are lucky because Ubuntu has an ARM-port.   It’s most likely the case that you can also “chroot” other linux devices that support ARM.  I am also working on chrooting other popular distros like Fedora, Gentoo, and more.

3. Now you understand what Chrooting is, let’s copy over the files we need for chroot.   These files include an image file of Ubuntu ARM (basically root filesystem that can be mounted onto Android phone using the command mount), setup script file (ubuntu.sh), chroot boot/launch file (bootubuntu), unionfs, fsrw, and mountonly.Copy these six files over into your SD card’s root folder under folder name “ubuntu“.  Or you can just unzip the file I provided and copy the ubuntu folder over to your SD card’s root folder.

Page 6: ishmaelchibvuri.files.wordpress.com  · Web viewThis Ubuntu install will not affect your existing Android system, the Ubuntu terminal will run in the background while the Ubuntu

(Yup, I am already working on other Linux distros!  But Ubuntu is my favorite.)

The script files were modified (by myself) from other instructions on the web on installing Debian to a G1 phones (thanks to Saurik).   Btw, Debian and Ubuntu are pretty much the same linux as Ubuntu is just an extension of Debian so you should be able to easily run Debian too using the same method, just change the file names.

4. Before we go any further, make sure to “Turn off USB storage” on your phone so we can access the SD card from ADB Shell.  Let’s also make sure your USB Debugging mode is checked under Settings->Applications->Development.  (And yes, don’t forget to connect your Nexus One/Android phone to your computer via USB!)5. I am assuming you’ve already installed the Android SDK (while you were rooting your phone) so let’s head to your Android SDK directory and load up ADB Shell.

For Windows, go to your Android SDK Tools directory such as c:\sdk\tools and type “adb shell“.

Page 7: ishmaelchibvuri.files.wordpress.com  · Web viewThis Ubuntu install will not affect your existing Android system, the Ubuntu terminal will run in the background while the Ubuntu

(FYI, cd is the command you can use to browse to your sdk\tools directory.  For Windows, do cd \sdk\tools and for Mac/Linux, do cd /sdk/tools.For linux and Mac, go to your Android SDK Tools directory such as /sdk/tools and type “./adb shell” or it can also be “sudo ./adb shell” for Ubuntu.6. Once you are in the ADB shell, you should see a “#”symbol.  Great, let’s start bootin’ Ubuntu right away.

7. Type “su” to enter superuser mode.  Btw, if you get error on this part, that means you have not rooted your phone! (or you might have to installed a rooted ROM.)8. Next, type “cd /sdcard/ubuntu“, which will take you to the directory where you’ve copied the Ubuntu files over to.9. Type “sh ./ubuntu.sh” to run the setup script.  You only have to run this once or whenever you change the script file bootubuntu.

Page 8: ishmaelchibvuri.files.wordpress.com  · Web viewThis Ubuntu install will not affect your existing Android system, the Ubuntu terminal will run in the background while the Ubuntu

10. Once that completes, type “bootubuntu” to “chroot” or boot into your new Ubuntu on your Android!

If you get the “localhost” sign, congratulations!  You’ve just installed Ubuntu on your Nexus One/Android phone!

If you didn’t get that and you got an error falling back to the ground at 200MPH back at the “#” symbol, don’t worry, I did that about a thousand times for 2 days straight, you are not alone.

Try rebooting your phone and repeat steps 5 through 10 CAREFULLY and I am sure you will get it working.  A lot of times, our eyes can lie to us while following step-by-step directions, really!Also, if you are not using a Nexus One here, you could be running into other problems as I have still not yet been able to chroot into Ubuntu on my HTC Evo 4G.

How to Get X11 GUI up and running on your Nexus One/Android Phone!

11. I actually prefer the command line over GUI because it saves so much memory and I am pretty proficient doing things in the terminal but the GUI gives you a full desktop experience over Ubuntu so first, you will need to download the latest version of Android VNC

Page 9: ishmaelchibvuri.files.wordpress.com  · Web viewThis Ubuntu install will not affect your existing Android system, the Ubuntu terminal will run in the background while the Ubuntu

Viewer in form of .apk file.  After downloading it on your phone (or copy it over to your SD card after you download it on your computer), open it up and install the app.

12. You will next need to install some files via Ubuntu apt-get installer. Go back to the chrooted Ubuntu terminal and type:apt-get updateto update your Ubuntu packages then: apt-get install tightvncserver

to install the TightVNCServer and:

apt-get install lxde

Page 10: ishmaelchibvuri.files.wordpress.com  · Web viewThis Ubuntu install will not affect your existing Android system, the Ubuntu terminal will run in the background while the Ubuntu

to install the LXDE.

13. Next type:

export USER=rootvncserver -geometry 1024×800

Page 11: ishmaelchibvuri.files.wordpress.com  · Web viewThis Ubuntu install will not affect your existing Android system, the Ubuntu terminal will run in the background while the Ubuntu

Here you can set your password to VNCserver like I did as “123123123“.

*Note – You can also change 1024×800 to the exact resolution of your Android phone’s LCD resolution but I found that a bit higher resolution gives you better display, so the Nexus One has 800×480 but I set it to

1024×800 for better viewing.Next, we are going to add the following to /root/.vnc/xstartup file

using cat command:cat > /root/.vnc/xstartup

#!/bin/shxrdb $HOME/.Xresources

xsetroot -solid greyicewm &lxsession

Then hit Ctrl+D twice and Enter key.

Page 12: ishmaelchibvuri.files.wordpress.com  · Web viewThis Ubuntu install will not affect your existing Android system, the Ubuntu terminal will run in the background while the Ubuntu

14. Next open up the Android VNC app on your Nexus One/Android phone and enter the password you set earlier in step 13 and set the Port to 5901.15. Next hit connect and voila, you should get something like this, a cool GNome Ubuntu screen!!!

16. Now, let’s setup your chrooted Ubuntu so you can make the VNCserver run everytime you start the chrooted Ubuntu.

17. Next, let’s add some code to the /root/.bashrc file, which runs at every boot of your Ubuntu so the VNCServer runs automatically when you start the Ubuntu.

cat > frontexport USER=root

cd /rm -r -f tmpmkdir tmp

cd /vncserver -geometry 1024×800

Page 13: ishmaelchibvuri.files.wordpress.com  · Web viewThis Ubuntu install will not affect your existing Android system, the Ubuntu terminal will run in the background while the Ubuntu

Then hit Ctrl+D twice and Enter key.

Next, we will concatenate the file we just made front and /root/.bashrc into a new file called temp:

cat front /root/.bashrc > tempThen we will copy the new file temp over the existing /root/.bashrc.

cp temp /root/.bashrc

(I used Windows command.com terminal, which keeps echoing things twice.  It only happens on Windows because of echo!)

*Note – The reason why I used cat command to do everything here is for Windows users because the vi text editor doesn’t function correctly within Windows shell.  But you can always just use your favorite Ubuntu text editor if you are using Linux or Mac.  (Just add contents of file front into the beginning of /root/.bashrc This way, I only have to write one howto manual that works for every platform.  For Windows users, you can also install SSH (do “apt-get install openssh-server“) and use an SSH client such as PuTTy.)

Page 14: ishmaelchibvuri.files.wordpress.com  · Web viewThis Ubuntu install will not affect your existing Android system, the Ubuntu terminal will run in the background while the Ubuntu

To check that it’s working you can exit out of Ubuntu back into Android shell:

exitthen boot Ubuntu back up:

bootubuntuNow everytime you chroot/boot your Ubuntu, the VNCServer is start automatically at start-up.

You can use Terminal Emulator app (freely available on Android market) to start the Ubuntu chroot by entering:subootubuntuso you don’t need to connect  to ADB shell to launch Ubuntu, giving you the freedom to use Ubuntu along with Android whereever you go.

That’s it!

BOOTUBUNTU UPDATE FIX

UPDATE: For people having trouble getting it to work (thanks to people testing it at XDA Developers), try downloading the

new bootubuntu file here (http://www.filefactory.com/file/b51288h/n/bootubuntu.zip)

then:Go run the ubuntu.sh by doing on ADB shell:

Page 15: ishmaelchibvuri.files.wordpress.com  · Web viewThis Ubuntu install will not affect your existing Android system, the Ubuntu terminal will run in the background while the Ubuntu

sucd /sdcard/ubuntu

sh ./ubuntu.shthen

bootubuntuCredits

Thanks to Devs at XDA Developer  for the Ubuntu ARM image for HTC HD2, which I used then resized it to 2GB so I can put more

stuff on it, works fine with other Androids. Huge thanks to AndroidFanatic for showing me how to put X11 on

the screen via VNC.  I used their guide for Debian and worked perfectly with Ubuntu.

Even more thanks to Saurik (Jay Freeman)  for the Debian G1 script, which I hacked for Ubuntu on Nexus One!