Can Linux apps run on Android?

Linux is a powerful operating system that offers many benefits. One of the more popular ones is its ability to run on multiple devices, including Android.

For some reason, if you want to run a Linux app on your android device. 

But I don’t know the process of how to get this job right since there is no straightforward process. Without technical skills, it’s going to take a whole load of effort and time.

There are many ways to run Linux apps on your android device. 

The first possible and easiest way is by using the Terminal Emulator app which can be downloaded for free in Google Play Store. 

You may also use this emulator if you plan to install Ubuntu OS on your android device (which is also possible).

Let’s first know what’s wrong with installing Linux apps on android?

Generally speaking, you can say there is less possibility of running Linux apps on your android device with period knowledge of android OS and Linux OS. 

Apps for Android generally run inside a Java-like virtual machine sandbox, so they need to be written in Java or another language that compiles to bytecode that uses the Android API.

However, the fact is we all know, in the technical world everything is possible. And that possibility depends on the level of skill a person has, and how much effort he is going to put into that plus time.

By means that, if you can write some codes or are ready to sacrifice your android warranty by rooting it. 

Then the possibility of running a Linux program becomes close to true.

Anyways, if you’re thinking about something like you just tap and the Linux program gets ready to be used on your android 10 or 11. 

Then, sorry to say, I don’t think this is ever going to happen.

Even the fact that android OS and any apps of just about every Linux distro, be it Debian, Linux mint, ubuntu, both are running on the Kernel Linux. 

However, this is not enough for android to house Linux apps. 

Because the android works like a virtual machine, more like a java based virtual machine, and only supports packages which that the emulator can house. 

Anything beyond that is not going to work unless the person makes changes to their android packages. 

This will lead to changing the android system by writing some code as android is an open-source program you can get the code online. 

Possible ways to run Linux apps on Android.

I did some research on this topic to find out more and more ways to run Linux apps on an android device. 

This question seemed interesting to me, just because of that, I read people’s opinions on multiple forums. Included StackOverflow.

So here are all the possible ways to run Linux apps on an android device. 

Method #1 Using GNURoot 

Since android is based on the Linux kernel, chrooted Linux distributions can be installed alongside Android. This basically requires a rooted device. However, you can bypass root using any fake root app just to achieve the outcome.

To do this, the easiest way is to use the Debian non-root app) even with a GUI (with an android X-server app or via VNC). 

Anyways, installing a Linux distro is easier on rooted devices, so you will be an advantage if you are able to root your device.

stackoverflow run Linux app rooting

Here’s the original author of this method: https://stackoverflow.com/a/26346375

Even so, it’s powerful enough to install Linux applications like LibreOffice, Gimp, and Samba on your Android.

You can learn more about GNURoot and XSDL from here.

  • GNURoot (An app): This application allows you to install and run GNU/Linux distributions alongside Android applications.
  • XSDL (an app) enables you to stream applications from your Linux PC to your Android smartphone or tablet (installing Linux requires an additional app which is the GNURoot).

There is also an application called Debian No root, which integrates the former two applications into one virtual machine. You may want to install that app as well. Debian no root. 

With this method, you will have to deal with some downsides. Such that, An android port’s SDL library and surfaceFlinder will get a frame over when you install XSDL and DNR server. Which acts as a restriction for many basic functions such as sound issues, the hardware-accelerated, and OpenGL graphics would not be functioning any longer. 

The second issue is that direct hardware access is incompatible with DNR Virtual Machines since it requires root privileges. Therefore, you are unable to burn DVDs, print via USB cables, etc., even if the author promises to implement a workaround in the future. 

#2 Method- for experts

The second method to run Linux functions/servers on an android device is as follows. Kindly mind that this is a bit difficult and only viable for giving an android OS some Linux functionalities.

This method is suggested by a guy on StackOverflow. You can directly read this in his own wordings from here.

  • First, you will require an ARM cross compiler that can be downloaded from here.
  • Compile a few command-line programs using the Android NDK. You can use Java/c++ to make some changes, what changes? I leave this up to you.

 I haven’t used either solution with C++. So far I have compiled a few simple things with them. 

According to my understanding, the NDK is not a full-featured C++ compiler since some C++ code is not compiled by it.

Which Linux OS can run Android apps?

However, the virtual machine does run on top of the underlying Linux OS, and there are ways to call native code. See https://developer.android.com/tools/sdk/ndk/index.html

So, while it is technically possible to run native Linux programs, as there is a Linux kernel running beneath everything, most users would not be able to install such applications or use them. (If you have root access or are building your own firmware, then you can do whatever you want.)

My favorite method: to run Linux apps on android. The beginner-friendly.

This method is going to be using a virtual environment to run some Linux apps. The advantage of this method is, it’s easier. As well the downside with this method is that it’s not capable of running a Linux Apache server. 

I think we can neglect the downside since our aim is to run Linux apps only which is something this method gets the job done right.

First of all, you will have to install BusyBox. It’s an android app available on the google play store.

In case you don’t know, the busybox app provides many Unix-specific tools, much like GNU Core Utilities, which is larger and more capable. 

A small executable, BusyBox runs under the Linux kernel, making it perfect for embedded devices. It has been self-dubbed “The Swiss Army Knife of Embedded Linux”.

Follow the steps below:

Step 1. Download and install BusyBox from the Play Store (root is required). 

Stepping this method without root access, you will need to follow the steps in this video that instruct you to push the busybox binary to /data/ and then use adb set permissions.

Step 2. To enhance your environment further, install BostBrew Basil from the Play store.

The BastBrew Basil bootloader uses Dpkg and Apt instead of Opkg to manage its packages. BostBrew excels in installing various Linux packages.

Step 3. Use APT Package Manager to install Linux apps

You can install apps with an apt package manager by doing the following:

su
bostbrew
apt-get install gcc g++

This will install gcc, g++ compilers. In addition to the ARM version, you can specify any other package name.

Step 4. Compiling C, C++ source code on Android

Compile any source file using g++ and run it:

g++ ./sourceCode.cpp
./a.out

That’s all there is to it. Congratulations on successfully compiling and running your own C code.

Scroll to Top