Skip to content

Conversation

@IntinteDAO
Copy link
Contributor

This script was rewritten from run-docker.sh using Gemini 2.5 Pro

This script uses udocker instead of docker. In my opinion, Termux should promote udocker over docker, as udocker does not require root access (it's rootless) or custom kernel modules. The only thing missing is an image for Docker ARM64 (so your phone emulates x86). So every smartphone user can potentially build a Termux application in an isolated environment.

I have tested the script in various ways and it seems to work correctly.

@robertkirkman
Copy link
Member

I find this fun and interesting, so I have tested this script on my computer to some degree,

I have noticed that, while it does work for simple, normal packages, there do seem to be some packages that it isn't quite able to build yet, but which the normal docker has no problem building.

warning: `yazi-cli` (bin "ya") generated 2 warnings (2 duplicates)
warning: `yazi-fm` (bin "yazi") generated 2 warnings
    Finished `release` profile [optimized] target(s) in 2m 14s
Generating icons:proot warning: ptrace option PTRACE_O_TRACESECCOMP not supported yet

real	6m20.943s
user	14m51.081s
sys	4m47.683s
tacokoneko@CORSAIR ~/code/termux/termux-packages $ ls output/
apt_3.1.5_aarch64.deb              glibc-repo_1.1_all.deb              sequoia-sq_1.3.1_aarch64.deb
apt-ftparchive_3.1.5_aarch64.deb   grep_3.12-2_aarch64.deb             sequoia-sqv_1.3.0_aarch64.deb
apt-transport-tor_3.1.5_all.deb    libapt-pkg-perl_0.1.42_aarch64.deb  synaptic_0.91.7-1_aarch64.deb
dpkg_1.22.21_aarch64.deb           libwebp_1.6.0-1_aarch64.deb         tur-repo_1.0.2_all.deb
dpkg-perl_1.22.21_all.deb          lux-cli_0.17.0_aarch64.deb          x11-repo_8.5_all.deb
dpkg-scanpackages_1.22.21_all.deb  nala_0.16.0-1_all.deb
ghostscript_10.05.1-1_aarch64.deb  root-repo_2.5_all.deb
tacokoneko@CORSAIR ~/code/termux/termux-packages $ 

yazi .deb file not present in the output folder ^^ after building using run-udocker.sh

That might be an interesting feature for you to try to add to this PR! (scripts/run-udocker.sh ./build-package.sh -I -f yazi)

I have also noticed that it does seem to have a bit of a performance impact that docker does not have to the same degree. I even gave udocker a big head start by allowing it to download all the dependencies first, then restarting it and its timer, and docker still finished first.

udocker (10 minutes)

termux - build of 'lux-cli' done

real	10m29.397s
user	29m10.431s
sys	8m21.099s

docker (9 minutes)

termux - build of 'lux-cli' done

real	9m0.085s
user	0m0.161s
sys	0m0.153s

@IntinteDAO
Copy link
Contributor Author

IntinteDAO commented Sep 11, 2025

yazi .deb file not present in the output folder ^^ after building using run-udocker.sh

Yep, confirmed. You can change execution engine and it works. However I need to check if other execution engines works on Termux.

udocker setup --execmode=R1 [Container ID]
scripts/run-udocker.sh ./build-package.sh -I -f yazi

@robertkirkman
Copy link
Member

robertkirkman commented Sep 12, 2025

Thanks, when I try that, at the beginning it shows "Warning: this engine only supports execution as root", but still works, and it does build yazi, but I used it on a rooted device, so that makes it sort of just the same as regular docker when packages like yazi need to build, right? (but maybe udocker even with --execmode=R1 still does not require a kernel with all this stuff enabled that real docker does)

image

Also, here is another package that it has an error with, but this one is the "big kahuna" - after seeing that it had a minor problem building yazi, pypy3 is an extreme stress test of the same type of special package as yazi, but filled with way more random, bizarre stuff that only works in real Docker.

scripts/run-udocker.sh ./build-package.sh -I -f pypy3
151.101.129.227 index.rubygems.org
104.16.1.35 registry.npmjs.org
104.16.0.35 registry.yarnpkg.com
proot error: 'apt' not found (root = /home/builder/.termux-build/pypy3/cache/host-termux-rootfs-x86_64, cwd = /home/builder/.termux-build/pypy3/tmp, $PATH=/data/data/com.termux/files/usr/bin)
fatal error: see `proot --help`.

for comparison, what happens inside real Docker:

scripts/run-docker.sh ./build-package.sh -I -f pypy3

(in real Docker, it will run the Termux bionic-libc apt package inside proot inside of Docker)

104.16.2.35 registry.yarnpkg.com
Get:1 https://packages-cf.termux.dev/apt/termux-main stable InRelease [14.0 kB]
Get:2 https://packages-cf.termux.dev/apt/termux-main stable/main x86_64 Packages [539 kB]
Fetched 553 kB in 2s (301 kB/s)  
Reading package lists... Done
Building dependency tree... Done
5 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be upgraded:
  command-not-found curl libcurl libtirpc lsof
5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 1619 kB of archives.
After this operation, 61.4 kB of additional disk space will be used.
Get:1 https://packages-cf.termux.dev/apt/termux-main stable/main x86_64 libcurl x86_64 8.16.0 [1020 kB]
Get:2 https://packages-cf.termux.dev/apt/termux-main stable/main x86_64 curl x86_64 8.16.0 [238 kB]
Get:3 https://packages-cf.termux.dev/apt/termux-main stable/main x86_64 command-not-found x86_64 3.1-11 [105 kB]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants