Chroot: Box64Droid
Relevant source files
The following files were used as context for generating this wiki page:
Box64Droid within the Termux-Desktops project is a specialized Chroot environment designed to run x86_64 Windows applications and a full Linux graphical desktop on Android devices. It leverages box64 and wine to provide compatibility for Windows software while utilizing the performance benefits of a rooted Chroot environment.
This implementation is part of a broader collection of scripts and documentation intended to launch Linux Desktops with audio support in Termux X11. Compared to Proot, the Chroot approach used by Box64Droid offers superior performance and better compatibility with Linux applications, though it requires a rooted device and specific system modifications.
Sources: README.md:54-94, Documentation/chroot/box64droid_chroot.md:1-15
Architectural Overview
The Box64Droid Chroot system operates by changing the apparent root directory for the current running process, isolating the Linux environment from the Android host. Unlike Proot-Distro, which operates in user-space, this Chroot setup interacts more directly with the system kernel, requiring root privileges and Busybox.
Key Components
| Component | Description |
|---|---|
| box64 | An emulator that allows running x86_64 Linux programs on ARM64 systems. |
| Wine | A compatibility layer capable of running Windows applications on Linux. |
| XFCE4 | The recommended lightweight Desktop Environment for graphical interaction. |
| Termux X11 | The X server used to display the graphical output on the Android device. |
| Pulseaudio | Provides audio support for the desktop environment. |
Sources: Documentation/chroot/box64droid_chroot.md:16-83, README.md:94-103
The following diagram illustrates the initialization flow for Box64Droid:
Setup and Configuration
Environment Preparation
The Chroot environment requires several low-level system permissions and group configurations to enable networking and graphical acceleration. Specifically, users must map Android-specific GIDs to Linux groups to allow the Chroot process to access the internet and hardware.
# Required group mappings for network and graphics
groupadd -g 3003 aid_inet
groupadd -g 3004 aid_net_raw
groupadd -g 1003 aid_graphics
usermod -g 3003 -G 3003,3004 -a _apt
usermod -G 3003 -a root
Sources: Documentation/chroot/box64droid_chroot.md:35-43
GUI Initialization
To launch a graphical interface (XFCE4) within the Box64Droid Chroot, a specific sequence of environment variables and daemon initializations is required. This involves setting the DISPLAY for Termux X11 and the PULSE_SERVER for audio.
Windows Application Support (Wine)
Box64Droid is uniquely positioned in the project to handle Windows programs by combining box64 with wine. Users can run Windows executables by calling box64 wine <application.exe>.
Optimization and Configuration
To improve the usability of Windows applications on high-resolution mobile screens, the project recommends adjusting the Dots Per Inch (DPI) settings within the Wine configuration.
- Command:
box64 wine winecfg - Procedure: Navigate to the "Graphics" tab and increase the DPI slider to enlarge menus and text.
Sources: Documentation/chroot/box64droid_chroot.md:73-83
Integration with Termux X11
The graphical desktop relies on a bridge between the Chroot environment and the Termux X11 application running on the Android host. This requires the host Termux to have specific packages installed, including termux-x11-nightly and tsu for root transition.
Sources: README_old.md:389-405
Critical Warnings
When using Chroot environments like Box64Droid, users must close the Termux application completely (including background processes) to exit. Improperly handling the Chroot folder (e.g., attempting rm -rf while mounts are active) can lead to system instability requiring a force reboot.
Sources: Documentation/chroot/box64droid_chroot.md:1-5
Summary
Box64Droid provides a high-performance Chroot environment within the Termux-Desktops ecosystem, specifically tailored for running x86_64 Linux and Windows software. By requiring root access and utilizing box64, it overcomes the architectural limitations of ARM64 Android devices for desktop-class application compatibility.