Debian 8 on the Nexus 5

Pocket Linux

© Lead Image © watchara rojjanasain, 123RF.com

© Lead Image © watchara rojjanasain, 123RF.com

Article from Issue 189/2016
Author(s):

Maru OS provides a desktop Debian on a smartphone.

Today's Android devices have plenty of RAM and viable processors: How great would it be to present the software directly on smartphones on an actual Debian system? Maru OS [1] makes this a possibility.

The system created by American developer Preetam D'Souza combines two operating systems in one firmware. Its custom ROM (v0.2.3 at press) for the Nexus 5 (it only works on this device so far) is available for download under a free license, providing both Android 5.1 in the Android Open Source Project version and Debian 8 "jessie." The Debian system only comes into play if the user connects the Nexus 5 to an HDMI-capable monitor via an adapter.

This solution immediately offers several advantages over the classic Android system: It is much easier to use Debian on a larger monitor than Android, which is particularly optimized for small displays and touchscreens. Additionally, basically all applications provided in the Debian project for the ARM platform start on the Debian system. Along with LibreOffice (v4.3), this also includes tools such as Gimp or the popular Apache web server. Even some rather exotic programs like Blender and LaTeX run on the Android smartphone.

Not surprising, however, is that the focus is more on the use of lightweight applications. The Nexus 5 might have plenty of memory with 2GB of RAM, but the built-in Snapdragon 800 CPU proves a bit weak when it comes to processor-intensive tasks.

For comparison, an Intel i5-5200U processor takes about 1.2 seconds to convert a 60-second WAV file (16-bit, 44.1kHz) into Ogg Vorbis format with the encoder call oggenc -q 10. The Snapdragon 800, on the other hand, needs more than six seconds to work on this task (Figure 1).

Figure 1: The encoder oggenc converts a 60-second WAV file on Nexus 5 in Debian in 6.4 seconds.

Download and Installation

Maru was still in a (closed) beta phase, when tested for this article, but it was already easy to use the system on the Nexus 5. Anyone wanting to use Maru on a daily basis still has a few hurdles to overcome. For example, the Android part of Maru OS (Figure 2) can currently only be updated by reinstalling the system. The developer cannot provide Android's usual over-the-air updates. Users need to be flexible because the system is evolving rapidly.

Figure 2: Maru's Android desktop. The Debian system starts automatically when connected to a monitor.

Another drawback is that Maru uses Android 5.1, but Android 6 "Marshmallow" has been available for the Nexus 5 since October 2015. Additionally, the audio routing doesn't seem to work on the Debian system. When tested, the Nexus 5 didn't provide an audio signal via the HDMI output. The audio output works as usual on Android.

The source code was only available for beta testing when this article went to press, but you can now get a ZIP archive of around 700MB on the website's Downloads page [1]. This includes all the necessary system images and the tools required for the installation such as the Android Debug Bridge (adb) and fastboot.

The best approach for users is to activate the developer options on the Nexus 5, unzip the ZIP file in a folder, and access the install.sh script. If necessary, this will unlock the smartphone's bootloader. Caution: This will delete all the data on the Nexus 5.

The ZIP package contains the installer and an uninstall.sh script that, on request, re-equips the Nexus 5 with the original firmware from Google [2]. An unzipped version of the original firmware needs to exist on the computer for this to work. The script still expects the absolute path to the Nexus 5 firmware to then start the installation there. Running the uninstall.sh script will erase all data on the smartphone.

How Does It Work?

Although previous attempts by Motorola, Ubuntu, and other manufacturers used virtualization or emulation and failed because of too little RAM in most cases [3], Maru uses the LXC lean container system from Linuxcontainers.org [4]. The Debian system thus directly accesses Android's kernel v3.4, rather than jessie's standard kernel (3.16). This kernel is then solely responsible for the complete virtualization. It acts toward the Debian system as if it is a PC based on the ARM architecture.

Separation from the Android system takes place through special kernel control groups (cgroups) that hierarchically assign all LXC container processors to a Linux process. Put more simply: LXC is a cross between a simple chroot and a complete virtualization such as Xen or KVM. It uses fewer resources but can't, for example, simulate any other operating system, because it is still just a Linux kernel.

Practicality

Initially, the Android system is just pure Android (Figure 3). Anyone who also needs typical Google apps, such as the Play Store or Google Maps, should also download and load onto the Nexus 5 one of the images for the ARM platform and Android 5.1 from Open GApps [5]. The images provided there differ from many Google Apps. F-Droid [6], a free app store for Android apps, is an alternative software source. You can, at the very least, install a useful email client and a handful of practical tools.

Figure 3: You can shut down Debian via a separate menu item on the Android system.

The Debian system is pure Debian with Xfce as a desktop. Unlike a desktop installation, many tools are missing – although users skilled in using Debian can retrofit them using apt-get. The lean system has proven to be advantageous. The only restrictions occur when no Debian package is available for ARMv7. Because Nexus 5's Snapdragon 800 isn't an ordinary x86 or x86_64 processor, it doesn't accept any i386 or x64 command sets.

When tested, no significant problems occurred when using LibreOffice, Gimp, ImageMagick, or several other tools. It was also possible to use Blender, as mentioned in the introduction (Figure 4); however, a powerful PC should probably be used for rendering.

Figure 4: Even resource-intensive applications such as Blender run on the Nexus 5, although much more slowly.

Maru is only suitable on the go when used together with selected accessories. Users need a Bluetooth keyboard or a Bluetooth mouse, or both, and a special adapter for converting the Nexus 5's micro-USB port into an HDMI port. Carrying these devices around all the time would be almost as annoying – or even more annoying – than taking a small netbook. However, Maru is a very useful tool for anyone who has a Bluetooth keyboard with an integrated touchpad and the SlimPort adapter.

The question of how to use the application still remains. Monitors with HDMI input abound – almost every modern hotel room has one. Meeting rooms also often have a projector with HDMI input. Therefore, you could, for example, start a presentation created in LibreOffice natively (provided no sound is needed). Another scenario involves various work in the shell or programming. Whether you use Emacs or Vim, it is easier to work in Debian using a keyboard than on the Android system (Figure 5).

Figure 5: Many other tools are available for Linux-savvy programmers besides Emacs.

However, Maru users shouldn't simply trust their system with sensitive data, because there are no safeguards to protect the Debian container against unauthorized access. If the Nexus 5 is connected to an HDMI-capable monitor, the Linux system starts without asking for a password. However, you could create a TrueCrypt container in Debian or send encrypted mail using Mutt and GnuPG.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News