Installing Linux under PRoot
Use it on your own risk!
Preface
Technically any Linux distribution can be used: debootstrap utility to prepare a Debian rootfs for example; though I see no reason to ignore already prebuilt rootfses (see below).
Note: Yes, Termux has its own “minimal base distribution” but I see no reason to mess with it as long as linuxcontainers.org already provides us with a very good prebuilt rootfses that could be installed just by copy-paste of a short quick install snippet (see next section):
- Alpine if you need it small: ≈15MB with
openssh-client
added (as of version 3.9); - Debian or CentOS if you need it comfortable with a big software repository.
One more note: Please, don’t hesitate to open new issues (there is no template just write as you wish) if something doesn’t work as expected. Things are changing and new 3rd-party distributions could trigger some old god-forsaken bugs (mostly in PRoot).
Android 10 note
See here.
Making it quick: linuxcontainers.org to the rescue
Their images are licensed under: CC BY-NC-SA 4.0
List of the images: Page / Index file
PRoot version used: https://github.com/green-green-avk/proot
Install script source: https://github.com/green-green-avk/AnotherTerm-scripts/blob/master/install-linuxcontainers.sh
Install script usage:
sh ./install-linuxcontainers.sh [-a] [-d] [-e] [--] <distro> <release> [<target_subdir_name>]
-a -- non-interactive mode
-d -- do not use minitar and PRoot from a plugin if present
-e -- fail if no minitar or PRoot from a plugin are present
Environment variables:
REG_USER - user account name;
FAV_SHELL - preferable shell;
PROOT - proot location;
PROOT_USERLAND - proot userland flavor location;
ESSENTIALS_PKG - Application ID of a minitar and PRoot plugin to check.
Run without arguments to see defaults.
Directory tree:
$DATA_DIR
root
— auxiliary tools dirproots
- <install-dir-1>
- …
- <install-dir-n>
root
— rootfs.proot.meta
— PRoot meta data (will be refactored in future)bin
_termsh
— PRoot binding of termsh ($LIB_DIR/libtermsh.so
)termsh
— script that executes_termsh
withLD_*
variables unset- …
etc
proot
run
— run scriptrun.cfg
— run script configurationrun.rc
— executed right before PRoot to finally set its environment variables (optional)- …
- …
- …
tmp
— PRoot tmp dirrun
— symlink to the run script
$TERMSH
is set to termsh
.
If you want to access the application’s private directory (where all your PRoot rootfses with their metadata are located) from your PRooted environment, see /etc/proot/run.cfg
.
PRoot run script source: https://github.com/green-green-avk/AnotherTerm-scripts/blob/master/assets/run-tpl
Uninstall:
rm -rf "$DATA_DIR/proots/<target_subdir_name>"
Steps
- If you have Android 10 or higher, look for additional steps and explanation here.
- Create a “Local Terminal” favorite with the “Favorite management” permission enabled and run it. A terminal screen will appear.
- Select a distribution and version in the form below and copy-paste the code snippet to the termial and run.
- ???
- PROFIT
Note: Very old Androids can have an issue with downloading from GitHub by termsh.
Copy-paste snippets for download and install:
with chooser:
( S=repo-linuxcontainers.sh ; "$TERMSH" copy -f -fu "https://raw.githubusercontent.com/green-green-avk/AnotherTerm-scripts/master/$S" -tp . && chmod 755 $S && sh ./$S )
or:
[Alpine key map settings] (for its specific mapping of Shift-F*)
Other prebuilt Linux rootfses list
- PRoot list: https://proot-me.github.io/#downloads
- Alpine: https://www.alpinelinux.org/downloads/
- UserLAnd: