Many smartphone users don't even think about the fact that the device in their pocket runs an operating system that has been powering servers, supercomputers and desktops around the world for decades. Android and Linux are not just similar names, they are real technical connections rooted in the very foundations of the code. When you turn on your gadget, the first one to launch is Linux Kernel, which takes control of the hardware.

However, despite the common genetic origin, the average user will not see the usual desktop GNOME or KDE, and also will not be able to simply install apps from repositories Debian or Arch. This is because Google has created a unique add-on that fundamentally changes the way you interact with the kernel. Understanding this difference is critical for those who want to understand custom firmware or simply gain a deeper understanding of the mobile ecosystem. root access, custom firmware or simply to better understand the structure of the mobile ecosystem.

In this article we will analyze the anatomy of this connection, explain why Android is not considered a Linux distribution in the classical sense, and see how exactly the modified kernel allows run applications on millions of different hardware configurations. You'll find out what's hidden under the hood of your mobile operating system.

Linux Kernel: The Foundation of a Mobile Operating System

The foundation of every Android device is Linux Kernel. This is not just inspiration or a marketing ploy, but real, working code that manages memory, processes, device drivers and the network stack. Google takes the official version of the kernel, makes the necessary changes to it and adapts it to the specific requirements of mobile processors and peripherals. It is this layer that abstracts the software from specific hardware.

The key difference is the active use of energy saving mechanisms, which were not so critical for server versions of Linux at the time of the creation of Android. Google engineers have implemented special wakelock drivers that allow the system to aggressively put components into sleep mode when the screen is off and there are no active tasks. Without these modifications autonomy modern smartphones would be significantly lower.

โš ๏ธ Attention: Kernel modifications implemented by chipset manufacturers (Qualcomm, MediaTek, Samsung) often lead to delays in the release of security updates. Manufacturers must re-adapt their drivers to new versions of the Linux kernel, which takes months.

In addition, the kernel is responsible for low-level security. It uses standard Linux mechanisms for separating access rights, which prevents one application from gaining complete control over the system without the user's knowledge. SELinux (Security-Enhanced Linux) operates in forced access control mode, limiting the capabilities of even system processes.

๐Ÿ’ก

If you are planning to flash a device, always check which Kernel version the firmware is intended for. A mismatch between the kernel and bootloader versions can lead to a โ€œbrickโ€ of the device.

Architectural differences: Why this is not ordinary Linux

Despite the common kernel, the upper levels of the system are radically different from classic distributions. In standard Linux, applications are usually written in C/C++ and directly use system libraries glibc. In the Android world, developers use Java or Kotlin, and applications run inside a virtual machine. This creates an additional layer of abstraction that isolates the application code from direct contact with the kernel.

Instead of the standard display server X11 or Waylandthat are used in desktop Linux, Android uses its own graphics engine SurfaceFlinger. It is optimized to work with touch screens, multi-touch and constant change of image orientation. This makes the system more responsive on the touch interface, but makes it impossible to run regular Linux applications with a graphical interface without special emulators.

  • ๐Ÿ“ฑ Libraries: Instead of the standard GNU set, it uses its own libc implementation called Bionic, which is lighter and adapted for mobile processors.
  • ๐Ÿ› ๏ธ Toolkit: Set console utilities have been replaced by Toolbox or Toybox โ€”stripped-down versions of standard Linux utilities (ls, cp, mv) that take up minimal space.
  • ๐Ÿ“ฆ Package manager: There is no single package management center (like apt or yum). Applications are installed individually via APK files.

This separation allows Google to control the ecosystem and provide a single runtime environment for applications regardless of device manufacturer. However, this also creates a barrier for enthusiasts accustomed to the freedom of classic Linux. You can't just take and run a script written for Ubuntu without first preparing the environment.

๐Ÿ“Š What is more important to you in a mobile OS?
Freedom of customization (as in Linux)
Stability and security
Compatibility with all applications
Interface design

Runtime and ART virtual machine

One of the most important components separating Android from โ€œrealโ€ Linux is the runtime. A virtual machine was used for a long time, but in modern versions it was replaced by Android Runtime. Applications are compiled into bytecode that is understandable only to that environment. This means that even if you get root access, you are still inside the ART sandbox, and not in the full root shell of classic Linux. Dalvik, but in modern versions it was replaced ART (Android Runtime). Applications are compiled into bytecode that is understandable only to that environment. This means that even if you gain root access, you are still inside the ART sandbox, and not in the full root shell of classic Linux.

The process of launching an application seems more complicated than in desktop OSes. When you click on the icon, the system starts the process Zygote. This is a special daemon that loads core classes and libraries into memory and then spawns new processes for each application. This scheme allows you to save RAM, since the base libraries can be common to all running apps.

adb shell ps -A | grep zygote

Running this command via USB debugging will show you the processes responsible for launching applications. In classic Linux there is no equivalent to Zygote, since there each app loads its libraries independently. In Android, the priority is startup speed and resource efficiency on devices with limited RAM.

โš ๏ธ Attention: Forcibly stopping system processes associated with ART or Zygote via ADB or a rooted terminal will result in an instant reboot of the device (bootloop). The system will not be able to restart the interface without these components.

HAL: Bridge between hardware and software

In classic Linux, device drivers are often built directly into the kernel or loaded as kernel modules. Android uses an additional abstraction layer called HAL (Hardware Abstraction Layer). This layer provides a standard interface for the upper levels of the system (Java framework), hiding the specific implementation of drivers from specific manufacturers.

For example, when an application takes a photo, it calls the Android camera API. This request passes through the framework and ends up in the HAL. HAL already knows exactly how to communicate with a specific camera sensor on Samsung, Xiaomi or Pixel. This allows Google to update the system without rewriting the code for thousands of models of cameras, microphones and sensors.

Component Classic Linux Android
Driver management Direct kernel access Via layer HAL
Graphics server X11 / Wayland SurfaceFlinger
Sound subsystem ALSA / PulseAudio AudioFlinger
Software installation Package manager (apt, dnf) Package Manager (APK)

The presence of HAL also makes life easier for manufacturers of proprietary software. Companies like Qualcomm or Broadcom may provide binary drivers (closed source) only for the HAL layer, without opening the source code for the Linux kernel, which complies with the requirements of the GPL license for the kernel, but preserves the manufacturers' trade secrets.

Why are drivers often closed?

Chip manufacturers consider their signal processing and power management algorithms to be trade secrets. By releasing only the binary module for HAL, they protect intellectual property by formally complying with the GPL license, which requires open source code only for kernel modules, but allows user libraries to remain closed.

File system and permissions

The Android file system is based on ext4 or f2fs (Flash-Friendly File System), which is a standard for Linux. However, the folder structure and access rights are organized differently. Unlike desktop Linux, where the user often has broad rights in his home directory, in Android each application runs in its own isolated sandbox.

Each installed application is assigned a unique one UID (User ID) Linux. From the kernel's point of view, each application is a separate user of the system. This means that the Messenger app technically doesn't have permission to read Gallery app files unless you explicitly give it permission. This is an implementation of the principle of least privilege at the Linux kernel level.

  • ๐Ÿ“‚ /data: Application data and user information are stored here. Access to this partition without root access is prohibited.
  • ๐Ÿ“ฑ /system: An analogue of the /usr or /bin partition in Linux. Contains the operating system, is write-protected in normal mode.
  • ๐Ÿ’พ /sdcard: Emulation of external memory, accessible to the user. In reality, it may be on the internal drive.

Getting root access essentially gives you access to the Linux superuser (UID 0). After this, Android begins to behave more like a regular distribution: you can change files in /system, remove pre-installed software and modify the kernel. However, modern security methods, such as Verified Bootactively resist such changes.

๐Ÿ’ก

root access in Android are not just โ€œadministrationโ€, it is gaining full control over the Linux kernel on which the system is built, with all the attendant risks of violating security integrity.

Is it possible to run real Linux on Android?

The question โ€œhow is Android related to Linuxโ€ often leads enthusiasts to want to run a full-fledged distribution on their phone. Answer: yes, it is possible, but with reservations. Since the kernel is already there, the main task is to run userspace. For this, there are terminal emulator applications, such as Termux, or solutions with graphics forwarding.

The most popular and safest way is to use Termux. It is a terminal emulator that provides an environment very similar to Linux. Inside it you can install packages python, git, clang and even launch light desktop environments. However, Termux does not use Android system libraries; it works in its own isolated space, which provides stability, but limits access to some hardware functions.

pkg install proot-distro

proot-distro install ubuntu

This command in Termux will allow you to install a full-fledged Ubuntu Linux inside Android. You will get a working command line and the ability to run Linux console apps. To run graphical applications you will need a VNC client or XServer. This proves that the connection between systems is so deep that one can host the other without virtualizing the entire kernel.

โš ๏ธ Warning: Running heavy distributions (for example, full-fledged Debian with GNOME) through emulators can lead to strong heating of the device and rapid battery drain, since the phone does not have active cooling, like a PC.

There are also projects for direct downloading of Linux distributions (PostmarketOS, Ubuntu Touch), which replace Android completely. In this case, the same kernel (or a similar fork) is used, but the user interface and set of apps are completely changed. This returns the device to the philosophy of free Linux, but denies access to native Android applications.

โ˜‘๏ธ Are you ready to install Linux on Android?

Completed: 0 / 4

Frequently asked questions (FAQ)

Is Android a Linux distribution like Ubuntu or Fedora?

Technically, Android uses the Linux kernel, but is not a distribution in the classical sense. It lacks the GNU standard libraries (glibc), X11/Wayland display server, and package manager. This is a separate operating system built on the Linux kernel, with its own unique architecture and execution environment.

Why can't you just run exe or deb files on Android?

Formats .exe are intended for Windows, and .deb for package managers Debian/Ubuntu, which use specific libraries and file structures. Android uses the .apk format and its own file structure. To run Linux apps, an emulation of the environment or special compilation for the ARM architecture and Android libraries (Bionic) is required.

Can a virus from Linux infect Android?

Theoretically, it is possible if the malicious code is written for the processor architecture (usually ARM) and uses Linux kernel vulnerabilities common to both systems. However, most viruses for desktop Linux will not be able to run on Android due to differences in system libraries and the lack of necessary executable files. The main threat comes from malicious APK applications.

Why does Google use Linux if they made their own system?

Linux provides a ready-made, stable, secure and free framework with excellent support for a variety of hardware (drivers). Developing your own kernel from scratch would take years and cost millions of dollars. Using Linux allowed Google to focus on creating the interface, services and ecosystem of applications.