Table of Contents

Gentoo released a new aarch64 stage3 tarball for Android last month. However, according to the official wiki, a rooted device is needed for the installation.

For those non-rooted devices, one solution is to use PRoot to simulate a rooted environment.


If you haven’t installed PRoot:

pkg install proot

Take a look at the documentation:

man proot


Prepare the environment

Since we don’t have root, we need to pick a prefix:

export GENTOO=/data/data/com.termux/gentoo
mkdir -p $GENTOO/data

Download and extract files

Download the latest tarball:

curl -LO

Termux doesn’t support hard links due to SELinux restrictions. To resolve this issue, use the PRoot extension link2symlink, which converts hard links to soft links.

proot --link2symlink tar -C $GENTOO/data -xf prefix-stage3-arm64-20200704.tar.xz

Start Gentoo

It’s easier with a script:


export GENTOO=/data/data/com.termux/gentoo
export EPREFIX=/data/gentoo64

proot --link2symlink -r $GENTOO -0 -w / \
    -b /dev -b /proc -b /sys \
    $EPREFIX/bin/sh -c \
    "HOME=$EPREFIX/root $EPREFIX/startprefix"

Configure Portage

Please refer to the official instructions.

Quick start:

export EPREFIX=/data/gentoo64
mkdir $EPREFIX/etc/portage/repos.conf
cat $EPREFIX/usr/share/portage/config/repos.conf > $EPREFIX/etc/portage/repos.conf/gentoo.conf
emerge --ask --verbose --update --deep --newuse @world

Known issues (and possible workarounds)

  • Incomplete running environment (but at least native)
  • Gentoo complains that /proc is not mounted. Commands like ps and top refuse to run.
    • Workaround: Create a new Termux session and run the commands from there. It should also display running processes for Gentoo.
  • rc-status reports Gentoo SSH daemon stuck in starting state even with correct configs (port number, public key, etc). And if exit from Gentoo now, Termux hangs with no response to ctrl-c or ctrl-d.
    • Workaround: Just tap “Kill process” in the contextual menu, but don’t remove Termux from background apps. The SSH daemon will continue running in the background.
  • to be explored…