Skip to content

🧪 Headless Lab

Turn an old, rooted Android phone into a real headless server.

A toolkit of safe, reversible tools (Termux + Magisk) to keep old Android phones running as 24/7 SSH servers — less RAM wasted on UI, swap/ZRAM under control, battery monitored, and the ghost touch of a cracked screen disabled.

Start with installation See the tools Read the security model


Why it exists

That old phone sitting in a drawer — broken screen or just too old — still has a CPU, 2 GB of RAM, Wi-Fi and its own battery (a free UPS). Headless Lab was born to keep a Galaxy A03 Core alive as a 24/7 SSH server.

Everything is written with three rules:

  1. show before touching — every plan is displayed and confirmed before applying;
  2. always provide a way back — automatic backups and native rollback;
  3. never break the boot — boot hooks exit 0 and have a kill switch.

The 7 tools

Command What it does Root
appctl TUI to disable/enable apps, apply profiles, back up and repair SystemUI, launcher, keyboard yes
createswap ZRAM + swapfile manager with status panel, dry-run, rollback and safe boot hook yes
battery Battery monitor with bar, temperature, health, cycles, signed current and live mode yes*
touch-ctl Reversibly disable/enable the touchscreen (great for ghost touch) yes
screen-state Reports whether the screen is on (via exit code, for automation) yes
screen-toggle Turn the screen on/off/toggle, reading state first yes
user-list UID → packages → processes → RAM map yes

* battery shows what it can without root and fills in the rest with root.

Quick start

# requirements: rooted Android (Magisk), Termux, Python 3.9+
pkg update && pkg install -y git python
pip install rich || pip install --break-system-packages rich

git clone https://github.com/C4-Labs/headless-lab.git ~/headless-lab
cd ~/headless-lab && ./install.sh

# quick smoke test
appctl --help
createswap --status
battery

For details see Installation. For cron + --json recipes see Automation.

Security principles

  • Nothing is uninstalled: appctl uses pm disable-user / pm enable — always reversible.
  • Plan before action: appctl shows a table and asks for confirmation; createswap has --dry-run.
  • No secrets in code: no tool reads, writes or sends passwords, tokens, IMEI, serial, MAC or IP.
  • Boot protected: nothing is installed to the boot unless you explicitly ask (--install-boot).

Read the Security page for the full rationale.

Warning

You need root. Touching system apps, memory, boot and input devices can make the device unstable or bootloop. Everything is done at your own risk. Make backups and always test with --dry-run / -n first.