English | 中文
Run a Linux rootfs on a rooted Android device with the host kernel. It uses a private mount namespace, pivot_root, fresh /proc /sys /dev, and optional bind-mounted device nodes while sharing the host network namespace.
- Provides a real Linux root filesystem instead of a
prootillusion, so mount-aware tools such asdfsee the container root correctly. - Runs normal distro tools and services such as SSH, Tailscale, Samba, or Python while keeping Android and the kernel unchanged.
- Patches Alpine/Debian guests with the Android group IDs needed for Android paranoid networking.
- Avoids model-specific hardware dependencies by binding only generic nodes such as
tunandfuse.
- Rooted Android with Magisk and a writable directory chosen by the user (for example under
/data); the scripts deriveCTDIRfrom their own path. - Kernel with mount and UTS namespaces,
TMPFS;TUN/FUSEare optional. - SELinux policy that allows the root shell to
unshare, bind-mount, andpivot_root. - A rootfs matching the phone architecture with
/bin/shand basic tools (mount,umount,mknod,ln). Alpine and Debian are handled bylib/guest-init-*.
./init.sh
./start.sh
./enter.sh
./stop.shROOTFS_URL=... ./init.sh downloads and extracts a rootfs archive when rootfs/bin/sh is missing. start.sh can be run from any current directory; CTDIR is derived from the script path. DNS is synced at start; while running, rerun scripts/dns-sync.sh after network changes.
- Android paranoid networking needs Android group IDs in the guest. The guest init scripts create
aid_inet=3003,aid_net_raw=3004, andaid_readproc=3009, then addrootto them. - Only generic device nodes are bound by default:
/dev/tun,/dev/net/tunwhen present, and/dev/fuse. GPU/camera/audio nodes are intentionally not included. scripts/start-fore.shis guarded byCT_FORE=1; running it directly can break the current mount namespace.