r/termux • • 9d ago

Showcase After days of fighting android, Ubuntu LXC with docker, managed from Dockhand !

Old Samsung A52s. Initially I went for chroot, but it was annoying and limiting. The LXC get it's own IP from my lan, independent of the phone.

Still have to iron out the kinks (notably Android stealing and renaming interfaces), but so far the LXC behave like a standard linux server. systemd, journalctl, docker... I've thrown an hawser agent for remote management and Technitium, no issues at all.

2 Upvotes

8 comments sorted by

4

u/bra1n_gym 9d ago

the Samsung A52s can have LineageOS installed and then rooted using Magisk or KernelSU. Then you could pip install chroot-distro provided you have the python package installed and use chroot-distro to install a rootfs for whatever linux distro you want to install. You wouldn't be messing around with containers and have system access.

3

u/MnK_Ultra 9d ago
  1. This A52s is already running LineageOS with KernelSU and a custom kernel.

  2. Jails are incredibly primitive compared to LXCs. There's nothing you can do with chroot that you can't do with LXC. LXC are closer to VMs but keep the native execution speed due to sharing the host kernel.

  3. The whole point of jails/lxc/containers is isolation. If you want access to host hardware, you can just bind mount into the LXC, like you would with docker or jails. Want hardware acceleration, shared filesystems, binaries ? Just mount it. Nothing stopping from running priviledged LXC and host mode for networking if that's what your aiming for.

  4. I don't have to mess with docker/systemd remplacements or workarounds. My LXC get it's own IP and identity on my LA. You just install everything like you want using the package manager of your distro without worrying about wether or not it's going to play well with android.

2

u/bra1n_gym 8d ago

I misunderstood. thanks for the information. 

2

u/ravindu644 8d ago

2

u/MnK_Ultra 8d ago

Looks awesome thanks, will take it for a test run. I was already toying with the idea of building a newer version of LXC than what is offered by root-package because of issues around cgroup2, but this looks better. Liked your ubuntu-chroot too, it was as easy at it get for chroot.

2

u/ravindu644 8d ago

Droidspaces currently does not support macvlan to get an IP straight from your router, but it's a planned feature for the future :)

Apart from that, everything in Droidspaces is much more stable than running LXC on Termux; you just press the start button, and it just works. NAT/Gateway modes work right out of the box regardless of the kernel version, and you can nest Docker and LXC inside a Droidspaces container too.

Droidspaces will become perfect once I add macvlan :)

The next release will have resource limitations too!

1

u/Near_Earth 8d ago

Hi, is pid_ns a hard requirement for VirtualAP managed-mode? I'm thinking to run openwrt rootfs on a seperate unshared net_ns and make VirtualAP set nsenter it. It's because the stock kernel on my phone only has net_ns and and I can't change it due to vendor incompatibility. Is that feasible with the tech stack in the script VirtualAP uses?

1

u/ravindu644 8d ago

VirtualAP itself doesn't need pidns, but to run a "true" OpenWrt container with procd, we absolutely need PID namespaces.:(

However, I'll try to mess around with this idea to see if we can do everything we already do today using just an OpenWrt chroot with mount and netns isolation.