If you are a dedicated gadget geek and were looking to do something awe-inspiring with your Nexus One, then now you have the opportunity to port Ubuntu on your Nexus One. Yes, you are reading it right! developers are NexusOneHacks.net have successfully ported Ubuntu on Nexus One and have also released the detailed procedure of the port.
Here is the complete step by step guide on how to install Ubuntu on your Nexus One according to Nexus One Hacks.
You will need to have a rooted Nexus One in order to embark on this porting procedure. Please do not attempt this procedure if you do not have extensive rooting and hacking experience on Android devices.
Before anything, download ubuntu.zip and unzip it:
ubuntu.zip on Megaupload
or ubuntu.zip on FileFactory
(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, try this guide here 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.
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.
(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“.
(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.
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 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:
to update your Ubuntu packages then:
apt-get install tightvncserver
to install the TightVNCServer and:
apt-get install lxde
to install the LXDE.
13. Next type:
vncserver -geometry 1024×800
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
xsetroot -solid grey
Then hit Ctrl+D twice and Enter key.
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 > front
rm -r -f tmp
vncserver -geometry 1024×800
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 > temp
Then 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.)
To check that it’s working you can exit out of Ubuntu back into Android shell:
then boot Ubuntu back up:
Now 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:
so 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.
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 then:
Go run the ubuntu.sh by doing on ADB shell:
Disclaimer: Please attempt this method at your own risk. AddictiveTips won’t be responsible in case your brick your device following this procedure.