+3 votes
92 views
in Linux by (242k points)
reopened
Use Linux on your smartphone - that's how it works

1 Answer

+4 votes
by (1.6m points)
 
Best answer

Overview of the possibilities
Linux as the operating system
Linux as an app
Linux as a remote desktop
Alternatively: Linux tools

There are many ways to use Linux on your smartphone. We'll introduce them and show you how to do it..

image image

Linux can be used in different ways on the smartphone - even if it is not entirely trivial. In the following, we will show you the options and how to use Linux on your smartphone.

Overview of the possibilities

Smartphones are basically pretty powerful little computers. And Android is basically nothing more than a (very special) Linux distribution. What could be more obvious than using a normal Linux distribution on the smartphone? Unfortunately, it's not that simple.

There are alternative operating systems for smartphones, Linux can run as an app or as a remote desktop and, alternatively, you can just use Linux tools on the command line. Everything has its advantages and disadvantages.

Linux as the operating system

The desire for a "real" Linux smartphone is not that easy to satisfy. Probably the most promising system may be Ubuntu Touch , which actually completely replaces Android. The installation is very simple using a guided installation wizard, but the problem appears on the "Devices" page : The compatible devices are listed here. And these are currently: OnePlus One, Fairphone 2, Nexus 4/5, two Meizu and three bq devices; In addition, the Moto G from 2014 is listed as a "Community Device".

The situation is similar with other approaches; at best, real Linux smartphones are only available for individual (rare) devices. This also applies to the Librem 5, which can only be pre-ordered..

Linux as an app

Linux can also run as an app directly under Android - and the best thing: without root! We want to show you two options: Debian noroot and the combination of GNURoot Debian and XServer XSDL . The first app provides the actual Linux system and the second ensures that its desktop environment lands on the display. In the meantime, GNURoot Debian has been discontinued. The successor UserLAnd is in no way inferior to the application and is referred to as a replacement for the app.

image
Debian noroot runs with just a few clicks - but not really smoothly.

The variant with the Debian noroot app is trivial to set up: Install the app, wait a few minutes and a typical Linux desktop will pop up. Unfortunately, a lot of things don't work here, at least on some devices. In addition, the tool is extremely slow , at least here on an Honor 6X . Basically it is only good for taking a quick look at a Linux system.

The second variant is much more reliable and faster, but has to be set up a little more complex. First, install the two apps from Google Play. Then start XServer XSDL . The app initially only shows a blue screen with commands to be entered in the other app. Switch

to UserLAnd . Here you already have the running Debian, but still without any graphical user interface. First, update the system with the following commands:

apt-get update
apt-get upgrade

image
Unfortunately, a little preparatory work in the GNURoot Debian terminal has to be done.

Then install the desktop environment LXDE , the " audio output " (pulseaudio) and the graphic package manager Synaptic , in order to be able to

install

software later without the terminal: apt-get install lxde pulseaudio synaptic Last but not least, you have to tell UserLAnd , where graphics and audio output should end up , which works with the " export " command . Enter the IP of the smartphone as the address , in the example "192.168.178.89". You can read them out via your router, via many network apps or directly in GNURoot Debian using the command " ip a ". In the somewhat confusing output you will find the IP under the" default "section.

Export DISPLAY = 192.168.178.89: 0
export PULSE_SERVER = tcp: 192.168.178.89: 4712

Now you can finally switch to XServer XSDL - where you can find an LXDE- desktop . should expect a tip for both variants: If you send the smartphone display Chromecast on a monitor and then connect to the smartphone even mouse / keyboard via a USB OTG adapter, you basically have a complete desktop computer - even if not the fastest..

image
In this variant, the desktop actually runs very smoothly, even on non-high-end smartphones.

Linux as a remote desktop

If it is only a matter of being able to use Linux on the go, for example, there is of course always the remote desktop variant : Linux runs on the NAS at home, for example, and you simply have the desktop transferred purely graphically . This is sometimes quite jerky and nothing for everyday use, but at least you can also do computationally intensive tasks this way, after all, the smartphone only has to display the image, not run a second operating system. In the home network, the setup is very quick: a VNC server must run on the Linux and a VNC viewer on the smartphone .

On Linux, for example, you can use the x11vnc server via " apt-get install x11vnc " Install and then start with" x11vnc ". The VNC Viewer is ideal for Android : Simply install , create a new connection, enter the IP address of the Linux computer and the desktop will land on the smartphone. But be careful: That is a secure connection - x11vnc it points after starting out as well as the viewer logs in this regard hints. hedging with password supplies x11vnc with the message. In a network in which other users are also located, you should only use this variant if you can trust all participants. Or you acquire in-depth knowledge of network security.

It gets complicated when this Linux-under-Android variant is to work via the Internet: You would have to set up dynamic DNS so that your home network is always accessible from outside . In short, this is a service that enables an address such as "meinrechner.dynmischer-dns-dienstleistungen.de" to always point to the current IP of your router. This IP changes, depending on the DSL provider, sometimes more often, sometimes less often - but it is not fixed. But dynamic DNS is another topic of its own.

image
A remote desktop - but you can also work with it.

Alternatively: Linux tools

If all of this is too much effort for you and you actually only need a Linux terminal every now and then, you can of course also do this without a complete Linux distribution. A wonderful tool that should not be missing on any Android smartphone is the free Termux app . Termux is a terminal emulator that brings a whole range of typical Linux tools with it. Basically, you can work in the same way as in front of your home computer. A very trivial example: The "htop" command can be used to call up a graphically prepared task manager that provides fairly precise information on how the system resources are being used.

You can also script and automate to your heart's content in the terminal. And then it is worthwhile to install the Termux extensions, especially Termux: API . The API function gives Termux access to hardware features, such as vibration, camera or GPS data. And so, for example, scripts could be created that evaluate the GPS data and let the device vibrate when a certain point is reached.


...