The Problem

Running a full Linux desktop or a Home Assistant hub directly on an Android phone normally requires rooting, custom ROMs, or complex manual package builds. Users who want a quick, non‑root solution for development, media consumption, or smart‑home control lack a reproducible, script‑driven workflow that works within Termux.

What This Does

The repository supplies two self‑contained Bash installers:

termux-linux-setup.sh – provisions a selectable Xfce/LXQt/MATE/KDE desktop, optional Wine, and GPU‑accelerated graphics via Mesa/Zink. setup-homeassistant.sh – installs the Home Assistant Core Python environment and its dependencies to turn the device into a smart‑home hub.

Both scripts assume a fresh Termux installation (see README.md) and create helper scripts (start-linux.sh, stop-linux.sh) in the user's home directory to launch or shut down the X11 session. The examples/helloserver.py demonstrates a minimal Python HTTP server that can run under the Home Assistant setup, showing that the Python environment is functional after the install.

How To Use It

Setup

Install Termux from F‑Droid and Termux‑X11 APK. Open Termux, keep it alive and upgrade the base packages:

termux-wake-lock pkg upgrade -y Pull the desired installer (desktop or Home Assistant) and make it executable:

curl -O https://raw.githubusercontent.com/mayukh4/linux-android/main/termux-linux-setup.sh chmod +x termux-linux-setup.sh # or curl -O https://raw.githubusercontent.com/mayukh4/linux-android/main/setup-homeassistant.sh chmod +x setup-homeassistant.sh

Configuration

No external configuration files are required. The scripts interactively ask for:

Desktop environment choice (XFCE4, LXQt, MATE, KDE). Whether to install Wine.

All selections are stored in ~/termux-setup.log for troubleshooting.

Running

Desktop

bash termux-linux-setup.sh # installs the desktop stack bash ~/start-linux.sh # launches X11 session open the Termux‑X11 app to view the desktop bash ~/stop-linux.sh # stops the session

Home Assistant

bash setup-homeassistant.sh # installs HA Core and Python deps python3 -m venv havenv # (script creates a venv internally) source havenv/bin/activate hass # starts Home Assistant

The examples/helloserver.py can be run with python helloserver.py to verify the Python runtime.

Real‑World Use

A field technician can repurpose an old Android phone as a portable Home Assistant edge node:

after initial install cd ~/havenv source bin/activate hass --config /data/homeassistant

The device then discovers and controls Zigbee/Z‑Wave peripherals on‑site, while the same phone can be switched to a lightweight XFCE desktop for on‑the‑fly log inspection via SSH.

Code Health & Issues

SeverityIssueLocation
MediumNo automated tests; code paths (e.g., error handling for apt failures) are unverified.Entire repo
MediumAbsence of CI/CD configuration; no gate to catch regressions.Repo root
MediumNo LICENSE file; downstream users lack clear reuse rights.Repo root
Low.DS_Store file present – leftover macOS metadata, harmless but noisy.Repo root
LowScripts rely on interactive prompts; non‑interactive automation requires manual modification.termux-linux-setup.sh, setup-homeassistant.sh
LowNo explicit version pinning for packages; future pkg updates could break the install.Inside both setup scripts

No obvious security secrets are committed, and the scripts use Termux’s package manager (pkg) which respects the device’s sandbox.

The Bottom Line

The repo delivers a practical, zero‑root method to run a full Linux desktop or Home Assistant on an Android phone using Termux. It is well‑documented for manual execution but lacks tests, CI, and a license, which limits confidence for production or commercial reuse. Suitable for hobbyists, developers, or small‑scale deployments where rapid setup outweighs formal SDLC requirements.