Saturday, September 15, 2012

[How to] Install Linux on Android?

As both the Linux and Android OS are open sourced, developers have enjoyed success in porting Linux on to Android and vice versa. Lots of efforts are still going on in this space. Canonical has been busy working on Ubuntu on Android which enables Android devices to run Ubuntu. “Linux on Android” is another awesome project which helps you to install and run a wide range of Linux distros on your Android device. An Android app has been released as part of this project which will guide you through the installation process. I tried it out myself on my Galaxy S2 and the process was very straight forward. Using this app, you will be able to install any distro as this just ‘chroot’ into the Linux image. This technique will run a virtual Linux on top of the Android OS without disturbing your Android OS. You could still use other apps installed on your Android device. We could replace Android with Linux completely but then you wouldn’t be able to use your Android phone as a phone anymore.

Pre-requisites:

  • Android 2.1 or higher. You need to have at least 3.5 GB of free space on your SD card. You can run Linux from internal SD cards as well.
  • Root access. You must have an Android device with Root access.
  • Support for Loop devices. Your Android OS must support loop devices. The stock image on Galaxy S2 didn’t have the support for loop devices. I have flashed the MIUI ROM with a kernel which supports loop devices. 

Steps to install Linux on Android

  • Download and install “Complete Linux Installer” app from Play store. Also, install VNC Viewer and Terminal App from Play store.
  • Launch the application “Complete Linux Installer”. This will guide you through the download links for different Linux distros.
  • Download the image and place it on your sdcard. By default, the launcher looks for the image directly on the sdcard (for ex: /sdcard/ubuntu). This can be configured from the launch menu. You can create a new launch configuration by specifying the image location and a name to it.
  • Select the configuration which you want to launch. This will open up the Terminal app with the chosen Linux image (say Ubuntu) mounted. If everything goes well, you should see this message “root@localhost:/#” on the terminal. This terminal will act like a Ubuntu command line. You can connect to the GUI from any of your favorite VNC viewer app (either on the same device or other devices).
    • You will be prompted for the root password, screen size and other options while mounting the Linux image.
    • If your kernel doesn’t support loop devices, you will get appropriate messages in this phase.
    • If you don’t have sdcard on your device, you might get some mount errors. You can ignore the errors (close the terminal) and re-connect to the mounted device again.
  • You are done. I have tried both LXDE and Unity desktops on S2 and both worked reasonably well.

Terminal Emulator with Ubuntu mounted

VNC Viewer app running on Galaxy S2 connected to Ubuntu running on the same device - LXDE desktop

VNC Viewer app running on Galaxy S2 connected to Ubuntu running on the same device - LXDE desktop

VNC Viewer app running on Galaxy S2 connected to Ubuntu running on the same device - Unity

VNC Viewer app running on Galaxy S2 connected to Ubuntu running on the same device

VNC Viewer running on Mac connected to Ubuntu on Android

VNC Viewer running on Mac connected to Ubuntu on Android

More information about “Linux on Android” can be found here.

-- Varun

1 comment:

  1. Thank you for giving me tips for android on Linux.actually i also trying on that but I cant it.

    ReplyDelete