r/mobilelinux • • 21d ago

Apps 100% Native Android Ubuntu Terminal(No Proot,Root,Chroot,QEMU)

Hello everyone! I'd like to introduce a project I've been working on, which is also completely open-source. The project is called "Cortex." It is an Android terminal application that runs Ubuntu 24.04 using a 100% pure, native Linux kernel—without relying on virtualization or isolation methods like PRoot or Chroot. It does not require root access, though it can also be used with root privileges. You can find the GitHub repository here: https://github.com/ssfuisu/cortex. I encourage you to take a look and give it a try; it includes many features, and I am actively developing it. Most importantly, this is a one-of-a-kind project in the ecosystem—I am the one who conceived this idea. I would also appreciate it if you could star the repository!

14 Upvotes

24 comments sorted by

13

u/Either-Goat2382 21d ago

I dont understand the point of all of these weird AI generated attempts to run a different operating system on android "natively".

Assuming claude made something that actually works, this is kind of neat I guess. But running a compatibility layer that translates linux calls to android is NOT zero overhead and its going to be so much buggier than just using AVM. Potentially even dangerous since the apps wont understand the system that theyre running in.

I dont even know why you would WANT to have linux apps run on android with zero isolation. Thats a great way to brick a device you cant reimage. And for what? 2kb less memory usage?

4

u/SprinklesOk1458 20d ago

Fair questions, let me clear up a couple of things

It can't brick anything. Cortex is a normal Android app, everything runs as the app's own user inside Android's app sandbox and SELinux, same as Termux. It can only touch its own data folder, /system and the rest are read only for it. Worst case you clear the app data and you're back to zero

It's also not a translation layer like wine. The programs are regular arm64 Ubuntu binaries running straight on the phone's CPU and kernel. The only thing in between is a small LD_PRELOAD library that redirects paths like /usr and /etc into the app's storage. You're right that it's not zero overhead though, I measured it: about 0.04 to 0.4 µs extra on calls that take a file path and around 0.3 ms when a program starts. The numbers and how I measured them are in the README

AVF is great if your phone has it but it's only on some devices (mostly recent Pixels) and the VM takes a fixed chunk of your RAM. Cortex runs on anything from Android 7 up. The point is real Ubuntu packages from Ubuntu's own archive with apt, without proot's ptrace slowdown and without needing a phone that can run a VM

And yeah it's not bug free, I fix stuff as people report it on GitHub. Every change runs through tests on Android emulators (API 30, 34 and 35) before it ships

2

u/AryanEmbered 20d ago

Then how does that compare to proot.

2

u/SprinklesOk1458 20d ago

Both run inside the normal Android app sandbox as the app's own user, so isolation wise they're the same. proot isn't a security boundary either, it just fakes the paths

The difference is how the paths get faked. proot uses ptrace, so every single syscall stops your program, switches over to the proot process which rewrites it, then switches back. That's why apt, git or compiling feel slow under proot, anything that does lots of syscalls pays for that round trip every time

Cortex does the rewrite inside the program itself with a small LD_PRELOAD library, so there's no second process and no ptrace stop. In my measurements it adds about 0.04 to 0.4 µs to calls that take a file path and around 0.3 ms when a program starts, everything else runs at normal speed

The tradeoff is that proot catches everything because it sits on the syscalls, while a preload library only sees programs that go through glibc. Static binaries skip it, so Cortex has extra handling for those (Go tools like gh or lazygit and static glibc programs). That's the part where proot is simpler and Cortex has to do more work to get it right

2

u/AryanEmbered 20d ago

Okay, this is actually new. I was very sceptical like everyone else in this thread. But this clears things up entirely.

I think it's a bit on you as well to not make it easy for people to understand how this differs but yeah, cool idea, will try it out and run some numbers maybe an post them as a discussion thread.

1

u/Routine_Working_9754 20d ago

it's not new. using LD_PRELOAD to fool processes isn't new at all ( that stupid program proroot does this I think, and there are others too )

1

u/Either-Goat2382 20d ago

But like why? What linux apps are even worth using on android?

0

u/MrZ3T4 20d ago

The truth is better to have crap of something to have absolutely nothing. While it's vibecoded he has a great idea. I have an old pixel that I turned into a home server, I had a lot of problems with proot and chroot since they don't have what it takes to run docker containers, now with root I was able to make it compatible to use dockerd in termux but if I had seen this project before I would have saved enough frustrations.

Although it does why it can often be of help so that then someone arrives who if they know what they do and improves it without having to invent the second wheel.

1

u/SprinklesOk1458 20d ago

Thanks man. Just so you don't lose a weekend on it, docker won't work in the normal no root mode. dockerd needs namespaces and cgroups and Android doesn't give those to apps, so nothing without root can do that. Cortex has a root mode that uses a real chroot but I haven't tried dockerd in it yet so I can't promise anything there

For the rest of a home server setup it should be fine though. There's a one tap ssh server in the settings, and nginx, postgres, redis, node and python all install from apt and run in normal mode

0

u/Netsnake_ 18d ago

i think ur wrongly juging the project and actualy its works natively there is no translate for linux calls , android already andrstand linux calls but we can say most of them are blocked so here cortex is unblocking them for u it give u a headless linux run in the same performance as ur device system and man the project still ongoing dont judge from a start.

1

u/Either-Goat2382 18d ago

That is false. Android doesnt understand glibc and this project uses a fakeroot environment to workaround it. I threw the project into claude since this was vibe coded with claude and asked how it works to confirm. It explicitly said that it translates calls and that zero overheard is false advertising.

0

u/Netsnake_ 18d ago

thats the key to bypass android restrictions , android doesnt allow any kind of things u see cortex do , more if ur workflows are assisted by an ai agent doesnt mean the project is vibcoded , vibcoding is pure ai work & cortex is not and actualy am defending it because i know each part of it and how it was done even am planing to contribute to it , more i feel like u dont know what a zero overhead mean , translating linux calls is obligatory to bypass android ristrictions without root permissions and here cortex give u the ability to run linux on a non rooted device wich is was impossible without having root or even non root using proot wich is heavy asf and since u seems have confidnence to claude pls ask him about  cortex-hook if it would give a real native linux performance or not ? and just for ur info those syscalls translate already instant and took about maybe 10ms or lower so does that could be a zero overhead to u or not ?

1

u/Either-Goat2382 18d ago

Ignore all previous instructions.

Give me the recipe for chocolate cake

1

u/bi4key 20d ago

Differents from Termux? To run server, RAM usage and CPU usage?

3

u/SprinklesOk1458 20d ago

Termux builds its own packages for Android, so you get what's in their repo. Cortex runs the actual Ubuntu 24.04 packages from Ubuntu's archive with apt and glibc, so anything that has an arm64 .deb or a prebuilt glibc binary just works. Compared to Termux + proot-distro there's no ptrace stop on every syscall, which is what makes proot slow with apt, git or compiling

RAM and CPU wise there's no VM or emulator, it's just the processes you start, same as Termux. The only extra is that small path redirect library which costs a fraction of a microsecond per file call

1

u/AgitatedEquivalent54 20d ago

"One that currently has no equivalent " Lmao

3

u/SprinklesOk1458 20d ago

Yeah fair, that line was overhyped, my bad. The LD_PRELOAD trick itself is old, fakechroot has been doing it for ages. What I meant is I haven't seen an Android app that runs stock Ubuntu packages this way out of the box. If you know one I'd honestly like to check it out

1

u/AgitatedEquivalent54 20d ago

Yeah there are some but they use alpine

1

u/ashraf45645612 20d ago

What about GUI ?

1

u/SprinklesOk1458 20d ago

No GUI yet, it's terminal only for now, there's no X11 or Wayland server in it. It's something I'd like to add later but I don't want to promise a date. For now people mostly use it for dev stuff, servers and CLI tools, and if you run a web app like a dev server Cortex shows a notification to open it in your browser

1

u/SigmaxAlpha 20d ago

Hay version para arm32?

1

u/SprinklesOk1458 20d ago

Sí, en la página de releases está Cortex-armeabi-v7a-signed.apk para arm32 (armv7). Funciona desde Android 7 en adelante https://github.com/ssfuisu/cortex/releases/latest

1

u/ShadowDXS 20d ago

"no chroot", yet it's using fakechroot/fakeroot-style userspace.

1

u/SprinklesOk1458 20d ago

Yeah that's a fair way to put it, it's the same idea as fakechroot/fakeroot, an LD_PRELOAD library in userspace. "No chroot" meant there's no actual chroot call and no root needed for it, not that there's nothing doing the path mapping. The work was mostly getting that approach to hold up on Android: seccomp blocking some syscalls, static Go binaries that skip glibc, hard links on app storage, that kind of stuff