Run Linux on Android – part 1

Want an ultra-portable version of Linux? Put it on your phone

Run Linux on Android

Run Linux on Android

If you can’t wait for the launch of the official Ubuntu smartphones (the first models are supposedly due later this year), don’t want to shell out for a new phone anyhow, or would prefer to use a different version of Linux on a portable device, there is an alternative. It’s possible to run a variety of popular Linux distros on a standard Android smartphone or tablet – everything from a simple BusyBox toolset right up to a full distribution with a desktop environment. You don’t even need to root your phone for some of the methods that we explore in this feature.

The advantages of running Linux on an Android device are manifold. As well as being able to SSH into other computers, you’ll have access to all your favourite Linux tools and you can also run a desktop GUI with most methods. The possibilities are endless. You could potentially even turn your Android device into a LAMP server to run web apps! So, if you’ve got an ageing Android phone or tablet kicking around, why not give it a try?

No rooting required

As mentioned, some solutions for running Linux on an Android phone don’t even require you to root the device to circumvent Android’s security features and gain superuser privileges – although we’ll take a look at that process later. The first and simplest of these is Kevin Boone’s KBOX2 project (see the section towards the end of this post), a port of BusyBox packaged with a number of Linux utilities. As with most of the solutions we explore in this feature, it can be installed via an Android app available in the Google Play Store.

Another simple non-root solution is the Limbo PC Emulator, a port of the QEMU hypervisor. The Android app can be downloaded in APK from from the project website: Download an ISO for the desired distro and you can then run it in a virtual machine created by the app. Since the app is emulating x86 architecture on an ARM-based device, however, it’s a bit on the slow side.

Possibly a more useful alternative is the Debian noroot app, available from the Play Store. While the app actually provides a compatibility layer rather than a full Debian OS, it does enable you to run Debian applications on your Android device.

If you’re after a more fully-featured distro without rooting, however, the best solution currently available is the GNURoot app by Corbin Champion. Downloadable for free from the Play Store, it works on non-rooted devices by using a ptrace container implemented via the PRoot utility. No need to worry about any technical jargon, however, since the app does all the nitty-gritty for you and is very easy to use. After downloading and installing the main GNURoot app, you then need to download and install one of the ‘helper’ apps available for different ARM-based distros: (Debian) Wheezy, Fedora, Aboriginal (a lightweight BusyBox variant) and Gentoo. There’s also an x86 version of Wheezy available if you have an x86-based device. The downloaded distro can then be unpacked and launched using the simple menu system in the main GNURoot app, which does all the hard work and eventually places you in a command-line terminal emulator (see ‘Launch a distro with GNURoot’ instructions at the end of this post). You’re then all set to go and should be able to install any packages from the distro’s repo in the usual fashion, using the relevant package manager, such as apt-get or yum. You can create extra terminal windows by tapping the ‘+’ button at the top, then switch between them via the top-left drop-down menu. The top-right (three-dots) icon also brings up a menu for various settings, including font size (you might well want to increase it to see the text more easily on a small screen) and a list of special keys accessed via various volume button combinations.

Getting graphical

While useful for running various Linux tools and utilities, one obvious limitation of GNURoots’ four main distro options is that they only run via the command line. To run programs requiring windows, you’ll need a GUI. Fortunately, GNURoot does offer a way to implement one, using the helper app called ‘GNURoot Wheezy X (xterms)’, which launches a VNC server for this purpose. To see the GUI, you’ll also need to download one of the many VNC clients available in the Play Store – we used VNC Viewer.

The WheezyX distro launches in a terminal window. After updating and upgrading, as before, note the address of the VNC server at the top – it should be ‘localhost:1’ the first time. You can then open the VNC Viewer app and point it to this address, entering the password as ‘password’. A virtual desktop will then launch – note that there’s no proper desktop environment by default; just an xterm terminal window for Wheezy. By swiping around the screen, you can move the mouse pointer onto this window and tap to select it. You can use the keyboard icon in the pop-up top toolbar to start typing into the terminal, and use the handy row of special keys above the on-screen keyboard for things like Ctrl, Alt, the cursor arrows and function keys.

From this terminal window you can install and launch programs to run within windows on the desktop. Using the mouse pointer, windows can be dragged around and resized. While a bit fiddly, the system works pretty well, although you may get the odd error and applications may well be missing audio (a common problem when using VNC viewers). You can also install a desktop environment via the terminal. We managed to get Xfce working by installing it with: apt-get install xfce4. We then launched it from the VNC Viewer terminal with: startxfce4.

For some reason, the main desktop launched inside a window of its own, but could be dragged into position to fill the screen. There’s an application menu at the top for launching programs, although some items don’t work by default. So you may need to tinker around with the system to get it working better for you.

GNURoot Debian Xfce
Here’s Debian Wheezy for GNURoot running Xfce – open the image to view it at full size

 KBOX2 BusyBox

The KBOX2 project works by constructing a minimal Linux root file system within the private data area of the hosting terminal emulator app, so you’ll need to download one to use it – try Android Terminal Emulator by Jack Palevich. While you can install KBOX2 manually from that app’s command line, it’s easier to use the OneBox Package Manager app – you’ll need to buy a companion app (£2.03/$3.10). Just follow the in-app directions and it’ll run the setup script for KBOX2 within the terminal emulator. Now go to the latter and enter:


The prompt should change to /home/kbox $. You can then download the packages you need from the KBOX2 site (via the device’s web browser) and install them with:

dpkg -i /sdcard/Download/{package}.deb

Compatible packages include Perl, Dropbear (SSH support), GCC, Vim and rsync.

Launch a distro with GNURoot

  1. Search for GNURoot in the Play Store on your Android device. Install the main GNURoot app, then the helper app of whichever distro you want to run with it.
  2. Open the GNURoot app and choose the distro for the helper app you’re using from the top drop-down menu. Then tap the Create New Rootfs button to unpack it – this can take a few minutes.
  3. Once done, select that distro from the second drop-down and tick the ‘Launch as Fake Root’ box (so you can use apt-get and other root commands), then tap Launch Rootfs.
  4. It may a take a while to start the first time, resulting in a black screen before a familiar command-line terminal appears. You are now ready to use the downloaded distro.
  5. First, to ensure everything’s up to date, use the commands apt-get update and apt-get upgrade in Wheezy. If using Fedora, instead use yum update.

ARM-less devices

For this article, we’ve focused on installing Linux on ARM-based devices. However, some Android devices, such as the Samsung Galaxy Tab 3, are based on the x86 architecture. So, since nearly all Linux distros are based around x86, in theory they should easily run on these devices – whether using a live USB stick (via USB2Go) or a full install. You may need to tweak settings to get some features working, such as the virtual keyboard and screen rotation. Ubuntu and openSUSE (with its TabletPC pattern) seem to be the the best options.

Next time

That’s it for now, but check in again tomorrow and we’ll take a look at the rooted options for running Linux on Android phones and tablets.