Running Linux apps on Android without rooting your phone

UserLAnd

The UserLAnd website offers the following description: "When UserLAnd first launches, it presents a list of common distributions and Linux applications. Clicking one of these then leads to a series of set-up prompts. Once these have been completed, UserLAnd will download and set up files required to start the task that has been selected. Based on the set-up, you will then be connected to your Linux distribution or application in a terminal or VNC viewing Android application."

UserLAnd offers a user-friendly (basic) installation of distributions such as Alpine, Arch, Debian, Kali, and Ubuntu. In addition, you can choose a desktop with LXDE or Xfce or just single applications like Firefox, LibreOffice, Octave, Gimp, and others.

The LXDE desktop environment is a good place to start, and it already comes with Firefox. If you were to install several desktop environments or a desktop and individual applications on top, UserLAnd would give each of these components its own runtime environment in its own session. This approach consumes a large amount of space, for example 850MB on the filesystem for Gimp alone. It makes more sense to opt for one desktop or one distribution and then add the applications internally, which would mean that Gimp needs only 80MB extra space.

If you decide to install a distribution and choose Ubuntu, the window manager twm first comes up with an xterm window. You can now install basic tools and the LXDE window manager (Listing 1, first two lines), which takes 20 to 40 minutes. Firefox is already included. Afterwards it makes sense to adjust the screen resolution to the monitor you are using. Edit the ~/.vncrc file with an editor like Leafpad or vi and then restart the session. It is also important to set the time zone (Listing 1, last line).

Listing 1

Basic Setup

$ sudo apt-get update
$ sudo apt-get install vim dialog tasksel lxde
$ sudo dpkg-reconfigure tzdata

Expansion

The Linux world is now accessible: lsb_release -a reports Ubuntu 18.04.5 LTS, and uname -a reveals the processor architecture – on the Snapdragon 845/855, aarch64. The first thing you might want to do is set the background image, the font size, or the theme.

On Android 10, the filesystem is not immediately accessible due to security policies. The feature is known as Scoped Storage and causes an app to only access app-specific directories. The UserLAnd project describes a way to import files into the Linux session [3]. It is also possible to bypass these security settings if you are aware of the risk.

To test access to the internal storage and the SD card(s), use the commands in Listing 2. In the storage/ directory, the SD card(s) and USB sticks should appear as directories with nine-digit numbers. emulated/0/ is usually the path to the internal storage. The DCIM directory is where the camera stores its photos and videos. You will also find other known directories, such as Android/data/.

Listing 2

Testing Storage

$ ls /host-rootfs/storage
$ ls /host-rootfs/storage/emulated/0

You could also research manufacturer-specific paths. However, on Android 10 or higher, you can't access the paths directly: Permission denied. You then either have to follow the hints in the UserLAnd tutorial [3] or look at the section in this article entitled "Building Your Own UserLAnd."

System expansion continues now with applications like an office package, C, Java, Gimp, VLC, or games (Listing 3, lines 1 to 4). OpenJDK 11 JRE is already included with LibreOffice. You can set up a variety of other programs just as easily, for example Octave, Gnuplot, or Inkscape (Figure 2).

Listing 3

System Expansion

01 $ sudo apt-get install libreoffice thunderbird
02 $ sudo apt-get install gcc g++ make
03 $ sudo apt-get install gimp vlc
04 $ sudo apt-get install xboard crafty scid fruit stockfish
05 $ sudo apt-get install cups hp-ppd hplip iputils-ping system-config-printer
Figure 2: With little effort, you can start and run many of the standard Linux applications.

First Difficulties with Eclipse and CUPS

Installing the Eclipse IDE for Java is unexpectedly difficult; sudo apt-get install eclipse does not return the desired results. On the Internet, the use of Snap is recommended, but I couldn't get Snap to work either. Fortunately, you can also download the precompiled IDE from Eclipse.org [4]. What is unpleasant is that you then have to copy it manually onto the filesystem (usually to /usr/lib/eclipse/ with a start link in /usr/bin/), and it does not add itself to the Start menu.

Printing with CUPS does not immediately work either. For a printer from HP, however, adding a few components is all it takes (Listing 3, line 5). In the test, printing failed at first. The cause of this failure was the /data/user/0/tech.ula/files/support/libcrypto.so.1.1 file. I solved the problem with the workaround shown in Listing 4. Annoyingly, Android restores the libcrypto.so.1.1 after each reboot, so the script has to run once per session. The UserLAnd project might fix this bug soon.

Listing 4

libcrypto.so Workaround

$ mv /data/user/0/tech.ula/files/support/libcrypto.so.1.1 /data/user/0/tech.ula/files/support/libcrypto.so.1.1_orig
$ cp /usr/lib/aarch64-linux-gnu/libcrypto.so.1.1 /data/user/0/tech.ula/files/support
$ sudo /etc/init.d/cups start

After you replace libcrypto.so.1.1, the final step is to configure system-config-printer. In addition, you need to install the tool again and launch it, and then you can conveniently bind (WLAN) printers. After that, the printer is available to many programs.

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.

  • 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.

  • 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.

  • 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
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News