20 comments

[ 3.4 ms ] story [ 32.4 ms ] thread
very cool. termux has to be peak for unbridled nerddom, the new linux terminal in android 16 is really a pale shadow of it. you don't get access to anything non-virtual, not even the gpu (atleast, i couldn't get it to work.)

theres so much cool hardware on modern smartphones, with quite solid drivers by virtue of the (relatively stringent) android quality requirements, and its all locked away. video encoders, decoders, 3d accelerators, etc, but none of it is really accessible in a power-user kind of way.

some more thoughts...

the android development kit really is very heavy. compared to `gcc -o main main.cpp && ./main`, it is several orders of magnitude away.

the jetpack stuff and whatnot - the big android app shops probably do actually appreciate that stuff. but i wish the dev env 'scaled to zero' as they say, but in the sense of cognitive overload.

could it be time to move away from java, and shift towards everything being a native binary? we have the tools now to make it secure, and its not like phones get faster 'for free' anymore. it would also vastly simplify the developer experience.

> the android development kit really is very heavy. compared to `gcc -o main main.cpp && ./main`, it is several orders of magnitude away.

> the jetpack stuff and whatnot - the big android app shops probably do actually appreciate that stuff. but i wish the dev env 'scaled to zero' as they say, but in the sense of cognitive overload.

I tried to build a small binary that listens for events and launches/wakes an app to do some automation. But apparently there's no way to send Intents or Broadcasts from native code? So I need to boot a JVM in the binary if I want it to communicate with anything else on the system!

Of course, you can always communicate via stdio, but that's useless because everything in Android speaks Intents/Broadcasts. Native code can also do raw Binder calls, but nothing on the system speaks raw Binder.

You don't have to use Android. I've been using various GNU/Linux phones for the last 17 years, so being able to do `gcc -o main main.cpp && ./main` on a phone is just natural to me. Back in 2008, as a teenager, I could choose to spent my first earned money to get me either one of the first GNU/Linux phones on the market or the first Android phone, and I feel that as the time goes it only validates my decision.
It is possible to write native code for Android using Native Development Kit. Typical NDK use would be to develop a library that is then called into by java code. But one can make whole app with it, 100% java-free:

https://github.com/cnlohr/rawdrawandroid

(comment deleted)
"could it be time to move away from java, and shift towards everything being a native binary?"

they literally do just that for fuchsia, but idk if google can pull this off tbh the tech DEBT is huge and massive undertaking that even google can be nervous

I mean this is their own fault too tbh, imagine windows that try to release every new release every year and try hard to add feature on top of that and it break down all API underneath

that's what happen to android and ios is

Note also you can use webrepl, which exposes MicroPython's REPL as a web page. It's not a real replacement for termux, but it is still quite useful- I often deploy ESP32s running Micropython around my workspace but they aren't connected to any serial terminal.
(comment deleted)
If I telnet into an ESP32 via Termux, it doesn’t recognize \n. I haven’t found a solution yet. It works fine with other Linux consoles.

    void handleTelnet() {
      ...
      if (telnetClient && telnetClient.connected() && telnetClient.available()) {
        String cmd = telnetClient.readStringUntil('\n'); cmd.trim();
        if (cmd == "status") {
        ...
EDIT: Thanks @yjftsjthsd-h and @detaro for your suggestions! I tried Telnet via tmux - it worked. Then I tried telnet directly, and it suddenly worked too. Turns out Arduino’s Telnet implementation is single-user only, and my dev machine’s reconnect loop kept the connection open; the working login just fooled me.
I'm trying to repurpose my Pixel 6a that I no longer use, as a Home Assistant Core main driver. I was hoping the author will talk a little bit about that.

I still haven't had the luck to have a fully working Home Assistant running inside (rooted) Termux.

Anyone succeeded to start `hass` and have it running without throwing errors?

If you like this stuff, I highly recommend you look at Samsung Galaxy phones. They come with DeX, which is a linux DE that you can use with a dock.
I've been playing with Termux, both on Chromebook (Eve), and my Samsung Galaxy S22 - pretty cool, though hit some issue with recent `bazel` - as newer versions try to access a `/dev` endpoint that's not available.

Quick fix, was to add `~/.bazelrc` this:

    common --experimental_collect_system_network_usage=false
and then it works! Though sometimes I need to first `termux-chroot` and then it it handles cases, where some tooling expects `/usr/bin` and not `/mnt/data/com.termux/files/usr/bin`

On measurements it's a bit 2x, 3x slower than Crostini (Termina) on Chromebook, but being available (so far) on all my Android devices is just awesome!

And there exist X11 too!

I wish there would be backdoor for F-Droid in the future, though maybe not as it seems :(

Cool article. Did anyone else check their screens for damage while reading?
You could as well use any old Raspberry as go-between. If you use USB-tethering, the Raspberry will appear locally around 192.168.43.XX and you can termux-ssh into it and use mpremote therefrom.
Using Termux to program an ESP32 directly from an Android phone is a brilliant hack for anyone who wants a truly portable development setup.
Very useful! Would be incredible to get something similar on iOS.
It's quite unfortunate Apple doesn't expose CDC-ACM to iOS devices.
"Running PlatformIO: the xtensa-esp32-elf-g++ binary would not execute, as it is compiled for another architecture"

PlatformIO is providing C binaries that have dependencies.

Please PlatformIO ship your binaries statically so that we can run them everywhere.

I had the same problem on Alpine.

I heard something that Termux has a lot of Chinese influence, anybody aware of this? I love Termux but that kinda added a bad taste. But I don't have anything to back it up but quotes from trusted people
Termux' package manager wrapper pkg can randomly select Chinese mirrors, but you can remove them from the selection list.