Latest release on GitHub

Ubuntu on your phone. Its own packages, on the phone's own CPU.

Cortex runs Ubuntu 26.04's arm64 programs, installed with apt, as ordinary processes of an Android app. A small LD_PRELOAD library maps the paths and covers for what Android forbids. No root, no ptrace, no virtual machine.

Android 7.0+arm64 and 32-bit ARMApache 2.0No ads, no trackers
Cortex Terminal on a phone running Ubuntu LTS
~ $ neofetchUbuntu LTS, straight from Ubuntu's archive. Not rebuilt for Android.
+39ns
what the library adds to a stat(), measured on a phone
0
tracer stops: system calls go straight to the kernel
31/34
common packages that pass the nightly test
50
languages in the app

How it works

One thin library inside each program. Nothing in between.

It is the same family as fakechroot and fakeroot, written for what Android does differently. That is the honest name for it, and it is why it is fast.

  1. A function wrapper, not a trap

    libcortex-hook.so defines open, stat, execve and about 200 other libc functions. A call goes through it like through any shared library. There is no ptrace and no second process.

  2. Every program starts through Ubuntu's loader

    Android has no /lib/ld-linux-aarch64.so.1, so execve starts Ubuntu's ld.so from the app's storage, with the library preloaded.

  3. Android's limits, one by one

    The seccomp filter, hard links, System V shared memory, memfd locks, other users, ports below 1024: each has its own code in the library.

  4. Static programs are patched, not traced

    A program that makes its own system calls never passes through libc. Static C programs get their forbidden calls patched once, Go 1.19+ programs get a small piece of path-mapping code.

Cortexfakechroot + fakerootPRoot (proot-distro)Linux Terminal (VM)
TechniqueLD_PRELOAD libraryLD_PRELOAD libraryptrace tracerVirtual machine
System callsStraight to the kernelStraight to the kernelStopped by the tracer when they take a pathTo a guest kernel
Static programsPatched before their first startNot coveredCoveredCovered
Android's seccomp, hard links, SysV shmHandledNot handledPartlyNot an issue
Root neededNoNoNoNo, supported phones only

Cortex contains no fakechroot or PRoot code. Don't take the speed for granted: compare.sh runs the same tests in Cortex and in proot-distro on your phone.

Real vs emulated

What is real, and what the library pretends.

"Native" here means the binaries are Ubuntu's, they run on the phone's CPU, and the kernel executes their system calls. It does not mean Android turned into Ubuntu.

CPUPrograms run on it directly, no translationReal
KernelAndroid's Linux kernel: processes, threads, signals, pipes, sockets, mmap, futexReal
Programs and packagesThe binaries from Ubuntu's archive, installed by apt and dpkg with Ubuntu's signaturesReal
NetworkSockets and DNS, IPv4 and IPv6Real
glibcUbuntu's 2.43 build with three system call sites patched for Android's filterAdapted
Static programsPatched once in their file before their first startAdapted
Paths/ is the app's private directory, mapped in the libc callsEmulated
Root and other usersPrograms see root, and su, runuser and servers that drop privileges become that user. The kernel sees one user, the app'sEmulated
Forbidden callssetuid and the other calls Android's seccomp filter refuses are answered by a signal handlerEmulated
Hard links, SysV shmCopies with a real link count, shared memory in files of Cortex's ownEmulated

Works without root

  • apt, compilers, Python, Node.js, Go, Rust, Java
  • PostgreSQL, MariaDB, Redis, nginx, sshd
  • su, sudo, runuser and other users
  • Servers on ports below 1024, moved 8000 up (80 is 8080)
  • An X11 desktop with sound

Unsupported in Android sandbox

  • systemd as the init system
  • mount, kernel modules, containers
  • Reading the kernel's network tables (ss, netstat)
  • The GPU

Speed

The library costs nanoseconds, only where a path is involved.

Code that doesn't call the kernel runs exactly as fast as it would anywhere. Measured on one 8-core phone (Linux 4.14, one big core, median of 9 runs). Run the same on yours:

bash
$ curl -fsSL https://raw.githubusercontent.com/ssfuisu/cortex/main/tests/bench/compare.sh | bash
stat() of a file
+39 ns +3%
open + read + close
+226 ns +8%
opendir + readdir + closedir
+426 ns +7%
write, dup, getcwd
≤ +21 ns
Code without system calls
0
Starting a program (Ubuntu's ld.so alone: 491 µs)
769 µs

What you get

A real Ubuntu, and a terminal built for a phone.

Everything below is in the app today.

Ubuntu

  • apt, the real oneUbuntu's archive and signatures, the fastest mirror picked once.
  • Everything you build withbuild-essential, Python, Node.js, Go, Rust, Java, static linking.
  • Users and serverssu and runuser work, PostgreSQL runs its own cluster.
  • Backupscortex-backup saves your home and the package list.

Terminal

  • Sessions that come backTabs you can name, restored after Android ends the app.
  • Keys your wayExtra keys in ~/.cortex/keys, pinch to zoom, hardware keyboards.
  • Modern protocol supportTrue color, OSC 52 clipboard, OSC 133, bracketed paste.
  • 14 color schemesAnd CJK and emoji widths done right.

Android

  • cortex-apiNotifications, clipboard, sharing, battery, vibration, speech.
  • Your files/sdcard in the shell, your home in Android's Files app.
  • Local serversA notification opens npm run dev in the browser.
  • no-fakerootA shell as an ordinary user, for tools that refuse root.

Desktop and remote

  • X11 desktopOpenbox or XFCE and Firefox, inside the app, with sound.
  • su & sudoPasswordless sudo for cortex@localhost; tsu invokes Android phone root separately.
  • 50 languagesThe app follows your system language.
Cortex Terminal with session tabs and two rows of extra keys: ESC, TAB, CTRL, ALT and arrows
Tabs and extra keysTwo rows you can redefine
cortex-api printing the battery state as JSON, the Android clipboard and sending a notification
cortex-apiThe phone, from the shell
The drawer of Cortex Terminal with one card per session
SessionsEach in its own directory
The color scheme picker with a preview of every scheme
Color schemesFourteen, the whole app follows
An Android notification sent from the terminal with notify-send
Notificationsnotify-send and long commands

Tested every night

Common packages, installed and used on an emulator.

Each one gets a short test of what it is for: a script, a compile, a server answering. Failures are published too.

31 of 34
work in the latest run

Every result with its details

Install

Running in a few minutes.

  1. Download the APK

    Cortex-arm64-v8a-signed.apk from the latest release, or armeabi-v7a for 32-bit phones.

  2. Install and open it

    Ubuntu's base system is unpacked once. Allow storage access if you want /sdcard.

  3. Use apt

    The first install fetches the package lists itself.

first commands
$ sudo apt install build-essential git python3 nodejs
$ cd /sdcard/Download          # the phone's shared storage
$ cortex-desktop install xfce  # optional desktop
verify a download
# built by GitHub Actions from the tagged source
$ gh attestation verify Cortex-arm64-v8a-signed.apk --repo ssfuisu/cortex
$ sha256sum -c SHA256SUMS.txt --ignore-missing

Questions

Asked often, answered plainly.

Is this just PRoot or fakechroot?

Not PRoot: nothing traces the programs. Close to fakechroot: an LD_PRELOAD library maps /usr and /etc into the app's storage and emulates userspace privileges, which is fakechroot's and fakeroot's technique. Cortex doesn't contain their code. It was written for what Android adds: the seccomp filter, no hard links, no SysV shared memory, execution under targetSdk 35 SELinux policies, and static programs.

Can it break my phone?

No. Everything runs as the app's own Android user, inside the app sandbox, so it cannot touch Android, the system or other apps' private data. If you allow storage access, programs can change your files in /sdcard like a file manager could. Use tsu only when you intentionally want Android host root on a rooted device. See SECURITY.md.

How do I know the APK is the code on GitHub?

Releases are built and signed by GitHub Actions from the tagged source, and each APK has a build attestation: gh attestation verify shows the workflow and commit it came from. Checksums and the signing key are in signing/README.md.

How do sudo, su, and tsu work?

Sessions start as normal user cortex@localhost with passwordless sudo. sudo and su stay strictly inside Ubuntu; tsu (or su --android) invokes real Android host su on rooted phones without colliding with Ubuntu commands.

Can I run Docker or Podman?

No. Containers need Linux namespaces, mounts and cgroups, which Android does not give ordinary apps.

Why does Go need special code?

Go programs don't use the C library, they make their system calls themselves, so a preloaded library never sees them. Cortex adds a small piece of code to Go 1.19+ programs before their first start that does the same path mapping.

Is there a desktop or GUI?

Yes, as an add-on. The menu's Desktop button installs Openbox or XFCE, and Firefox if you want, and shows it inside the app with touch or touchpad control, a shared clipboard and sound. It is X11 drawn by the CPU, so it suits editors and browsing more than games.

Which phones are supported?

Android 7.0 and newer (targetSdk 35), with APKs for 64-bit (arm64-v8a) and 32-bit (armeabi-v7a) ARM.

Where do I report problems?

Settings › Send a bug report writes a file with the versions and logs. Attach it to a GitHub issue or send it on Telegram.

Ubuntu in your pocket.

Free and open source. Download the APK, run apt, get to work.