Running Linux apps on Android without rooting your phone

Sound, OpenGL, and Cameras

The UserLAnd project has a good tutorial on how to use the Android sound system [5]. You'll need to route the sound output via TCP to another Android process. First you have to install the Android Termux app. Add the first two lines from Listing 5 to ~/.bashrc. Then, in UserLAnd, install the pulseaudio package and add the last line from Listing 5 to .bashrc.

Listing 5

Additions to .bashrc

pulseaudio --start --exit-idle-time=-1
pacmd load-module module-native-protocol -tcpauth-ip-acl=127.0.0.1 auth-anonymous=1
export PULSE_SERVER="127.0.0.1"

Now the VLC player can also output sound – and many nice games will work too (see the box entitled "Games"). However, some games only display an error message because I have not yet been able to install OpenGL. I also couldn't get the Linux system to access the smartphone's cameras.

Games

I could only check a few of the large number of games available in Ubuntu. Some refuse to launch completely unless you set up sound output or OpenGL first. However, some games do run and are easy to install, including Pingus, Maelstrom, and Gnome Sudoku, as well as XBoard with the chess engines Crafty and Fruit (Figure 3).

Figure 3: Crafty and Fruit are strong chess engines, playing against each other here on XBoard.

Performance

Once you get Linux up and running on your Android phone, the next question might be, does it provide the performance you'll need to make it a viable option? You can test the performance with exactly the same benchmarks you would use on a real PC to compare the results directly. Sysbench requires small adjustments (see Listing 6).

Listing 6

Benchmarking with Adjustments

$ sudo apt-get install sysbench hardinfo
$ cd /usr/lib/aarch64-linux-gnu
$ sudo mv libc.so libc_script.so
$ sudo ln -s /lib/aarch64-linux-gnu/libc.so.6 libc.so
$ sysbench --threads=8 cpu run
$ sysbench --threads=8 memory run
$ sysbench --threads=1 --file-test-mode=seqwr fileio run
$ sysbench --threads=1 --file-test-mode=seqrd fileio prepare
[... Reboot required ...]
$ sysbench --threads=1 --file-test-mode=seqrd fileio run

The Hardinfo GUI tool depends on the VNC viewer. RealVNC is clearly the winner with 1,449 points compared with bVNC which only scores 930 points. Before running the seqrd fileio run test, you need to restart the Linux system to avoid unrealistic results due to caching. The Phoronix test suite [6] (Listing 7) also provides interesting results. I would also have liked to run the 3D graphics tests like unigine-heaven from this suite, but they are only available in binary format for x86_64 machines.

Listing 7

Phoronix Test Suite

$ sudo apt-get install unzip gdebi-core
$ gdebi Downloads/phoronix-test-suite_10.0.1_all.deb
$ phoronix-test-suite run sunflow

The surprise: An average family computer clearly outclasses a smartphone, but cannot totally outrun it. The 3D graphics performance is probably the only real drawback (Figure 4).

Figure 4: Smartphones can keep up with PCs for some tasks. The performance is sufficient for general office work, web browsing, and certain games that aren't too demanding.

Alternative Browsers

During the tests, Firefox did not run at times, for example, due to problems with fonts. You can install a different browser if you are having trouble with Firefox [7]. Not all of browsers are available for the ARM architecture, but Chromium and Epiphany work. For a successful start, you have to add the option --no-sandbox.

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

  • Android in a Box

    Need Android apps in a separate window on the Linux desktop? Anbox is the answer. Unlike common Android emulators, the software relies on LXC containers and kernel namespaces. We tested the pre-alpha version.

  • New Android Security

    Google says the upcoming Android L release will be far more secure than its predecessors.

  • Firefox OS vs. Android

    Firefox OS has come out of nowhere to challenge Android and iOS in the mobile operating system market. We'll show you what is different about Firefox OS and compare a recent Firefox OS phone with a comparable Android device.

  • Linux Android Backup

    Linux Android Backup offers an open source solution to backing up the most important content from your Android devices in just a few steps.

  • Android 2.0 and SDK

    Google has brought its Linux-based operating system for mobile devices to version 2.0, with corresponding developer tools on hand.

comments powered by Disqus