Chroot: Arch & Fedora
Relevant source files
The following files were used as context for generating this wiki page:
The Chroot implementation for Arch Linux and Fedora within the Termux-Desktops project provides a high-performance Linux environment on Android devices by utilizing a Unix chroot jail. Unlike Proot-Distro, which operates in user-space, the Chroot method requires root access to change the apparent root directory for processes, resulting in "Good" performance comparable to native execution. Sources: README.md:92-130, README_old.md:374-388
This module allows users to run full desktop environments, specifically XFCE4, with hardware acceleration and audio support through PulseAudio and Termux:X11. It bridges the gap between the Android kernel and standard Linux distributions by mounting essential system directories (/dev, /proc, /sys) and configuring Android-specific group IDs (AIDs) to manage networking and graphics permissions. Sources: Documentation/chroot/arch_chroot.md:103-125, Documentation/chroot/fedora_chroot.md:104-126
Environment Architecture and Requirements
The Chroot environment relies on a rooted Android device and specific system utilities to function correctly. The architecture involves mounting the Android /data partition with execution privileges and binding kernel interfaces into the chroot directory.
Core Prerequisites
- Root Access: Mandatory for using the
chrootcommand and mounting filesystems. Sources: README.md:126 - BusyBox: Must be flashed via Magisk to provide standard Linux applets (mount, chroot). Sources: Documentation/chroot/arch_chroot.md:34-36
- Termux Packages: Required tools include
tsu(root wrapper),pulseaudio, andtermux-x11-nightly. Sources: Documentation/chroot/arch_chroot.md:42-48, Documentation/chroot/fedora_chroot.md:34-36
Filesystem Layout and Mounting
Both Arch and Fedora environments utilize a similar mounting logic to expose Android hardware and system state to the Linux distribution.
The diagram shows the sequence of mounting operations required before the busybox chroot command isolates the process into the new root filesystem. Sources: Documentation/chroot/arch_chroot.md:103-125, Documentation/chroot/fedora_chroot.md:104-126
Implementation Details: Arch Linux
Setting up Arch Linux involves downloading the Arch Linux ARM rootfs and initializing the Pacman keyring.
Configuration Steps
- RootFS Acquisition: The latest
ArchLinuxARM-aarch64tarball is extracted with--numeric-ownerto preserve permissions. Sources: Documentation/chroot/arch_chroot.md:65-71 - Network Fixes: Manual creation of
etc/resolv.conf(using Google DNS 8.8.8.8) andetc/hostsis required for internet connectivity. Sources: Documentation/chroot/arch_chroot.md:82-100 - Pacman Initialization: The GnuPG directory must be cleared and keys populated before system updates. Sources: Documentation/chroot/arch_chroot.md:144-149
| File Path | Purpose |
|---|---|
/etc/pacman.conf | Must comment CheckSpace to allow package installation in chroot. |
/etc/locale.gen | Used to uncomment en_US.UTF-8 for localization. |
/etc/sudoers | Used to grant the droidmaster user administrative rights. |
Sources: Documentation/chroot/arch_chroot.md:139-141, Documentation/chroot/arch_chroot.md:175-181, Documentation/chroot/arch_chroot.md:195-200
Implementation Details: Fedora
Fedora setup utilizes the Fedora Cloud docker-brew images and the dnf package manager.
System Customization
Fedora requires specific group management to bypass Android's permission restrictions on networking and graphics. Sources: Documentation/chroot/fedora_chroot.md:135-140
| Group Name | GID | Description |
|---|---|---|
aid_inet | 3003 | Allows internet access. |
aid_net_raw | 3004 | Allows raw network socket access. |
aid_graphics | 1003 | Allows access to graphics hardware. |
Sources: Documentation/chroot/fedora_chroot.md:136-138
Package Management
Fedora utilizes dnf group install to efficiently install the XFCE desktop and admin tools. A critical fix involves removing localsearch, which is known to generate excessive logs and fail within chroot environments. Sources: Documentation/chroot/fedora_chroot.md:144-148, Documentation/chroot/fedora_chroot.md:179-183
Desktop Environment Integration
Both distributions launch the XFCE4 desktop by passing a command string to su within the chroot. This command exports the DISPLAY and PULSE_SERVER variables to ensure GUI and Audio data are routed to the Termux apps.
The sequence diagram illustrates how environmental variables bridge the isolated Chroot environment back to the Termux host services. Sources: Documentation/chroot/arch_chroot.md:214-219, Documentation/chroot/fedora_chroot.md:191-196
Security and Cleanup Warning
Using Chroot environments carries a significant risk. If the chroot directory is deleted (e.g., rm -rf) while filesystems are still mounted, the command may propagate to the host Android system, leading to data loss or device instability requiring a force reboot. Users MUST close Termux completely from the background before attempting to delete chroot folders. Sources: Documentation/chroot/arch_chroot.md:5-7, Documentation/chroot/fedora_chroot.md:5-7
Summary
The Arch and Fedora Chroot implementations offer a robust, high-performance Linux experience on Android. By bypassing user-space emulation and interacting directly with kernel-bound interfaces, these environments support complex tasks like running XFCE4 with full audio and hardware acceleration. The setup involves careful manual mounting, Android-specific group configuration, and the use of Termux:X11 as the display server.