Overview
TermuxRootMods, developed by rompelhd, addresses a persistent friction point for developers using Termux on rooted Android devices: the disconnect between Termux’s user environment and Android’s native root shell.
When typing su within Termux, Android drops the user into an unconfigured, bare-bones MirBSD Korn Shell (mksh). Essential Termux binary directories (like /data/data/com.termux/files/usr/bin) are stripped from PATH, custom aliases and functions are unavailable, and terminal characteristics (TERM) frequently revert to raw defaults, breaking terminal utilities like htop, tmux, or nano.
TermuxRootMods solves this systemlessly by patching Android’s /system/etc/mkshrc to call a dedicated C++ binary, ensuring that executing su preserves an intelligent, fully configured Linux root shell.
Prerequisites & Compatibility
- Root Framework: Magisk v20.4 or newer.
- Application: Termux (ensure you are using modern builds from F-Droid or GitHub; Google Play Store versions of Termux are deprecated).
- Supported Architectures:
arm64,armhf(32-bit ARM), andx86_64.
There are no documented module conflicts.
Technical Architecture
Under Android, interactive root shells execute /system/etc/mkshrc on startup:
- TermuxRootMods injects a systemless overlay for
/system/etc/mkshrc. - When a root shell initializes, the modified script calls a custom compiled native C++ binary bundled with the module.
- The binary inspects the calling process context, verifies whether the session originated from Termux, and injects customized environment exports, history tracking, and shell prompt decorations.
- If a custom shell (such as GNU Bash or Zsh) is configured, the binary facilitates smooth handover to that shell.
Installation & Usage
- Download the latest
TermuxRootMods-v*.zippackage from the repository releases. - Install via Magisk and reboot your device.
- Launch the Termux app.
- Type
suand press Enter. - Grant root permissions when prompted by Magisk.
- The root shell will initialize immediately with enhanced environment variables and tool paths available.
- Active module assets reside in:
/data/adb/modules/TermuxRootMods/
Troubleshooting & Verification
- Standard Shell Still Appears After
su: Verify that the module is enabled in Magisk and that the device was rebooted after installation. Check that/system/etc/mkshrcis being overlaid correctly:grep -i "TermuxRootMods" /system/etc/mkshrc - Terminal Display Artifacts: If running screen-oriented programs under root produces garbled lines, ensure your
TERMvariable is exported appropriately:export TERM=xterm-256color
