Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: how to use pkg #55

Closed
sigmaSd opened this issue Jul 31, 2023 · 7 comments
Closed

Question: how to use pkg #55

sigmaSd opened this issue Jul 31, 2023 · 7 comments

Comments

@sigmaSd
Copy link

sigmaSd commented Jul 31, 2023

Hello I tried docker run -it termux/termux-docker:x86_64 but I can't access the network, ping for example fails with are you root? if I start with root entry point I can ping, but I don't want to do that because I can't use pkg

Is there an obvious thing I'm missing?

@sylirre
Copy link
Member

sylirre commented Jul 31, 2023

Non-root ping requires cap_net_admin permission which is not enabled for Docker containers by default and neither set for the ping binary.

I also should note that Docker image is a lot different from Android OS. Basic utilities in /system/bin are based on Busybox: https://github.com/termux/termux-docker/tree/master/system/x86/bin. Not sure whether busybox ping works with Linux capabilities.

As adding support for non-root ping would require always running image with --cap-add=cap_net_admin, I'm not going to add that feature.

Termux Docker image is focused on Termux. It doesn't provide Android stuff. In Termux the ping is a wrapper for /system/bin/ping (part of operating system), assume the latter doesn't really exists/usable in Docker. Busybox was provided only as sufficient base for bootstrapping Termux environment and to get some of Termux scripts working properly.

@sylirre sylirre closed this as completed Jul 31, 2023
@sigmaSd
Copy link
Author

sigmaSd commented Jul 31, 2023

I just took ping as an example, want I want is to use pkg command, but currently it fails with error accessing the mirror, so I assumed it's the same issue as ping as in it can't access the network

Tldr is running stuff like pkg upgrade pkg install supported ?

@sylirre
Copy link
Member

sylirre commented Aug 1, 2023

Networking is supported ad well as pkg. Don't use root for pkg and make sure you launching the image as shown in readme.

Networking, specifically DNS resolution, relies on dnsmasq service started by image entrypoint. If it was not started, the pkg won't work.

@sigmaSd
Copy link
Author

sigmaSd commented Aug 1, 2023

I see but so far I can't still make it work, here is the steps I did

docker run -it --entrypoint /entrypoint.sh termux/termux-docker:x86_64
pkg upgrade

error

... more mirror errrors
[*] (1) https://mirror.surf/termux/termux-main/: bad
[*] (1) http://mirror.mephi.ru/termux/termux-main: bad
Error: None of the mirrors are accessible

I'm not familiar with this stuff yet, but https://github.com/termux/termux-docker/blob/master/entrypoint.sh#L11 seems like the dnsmasq is never started because of the check of id -i == 0

I also tried running /system/bin/mksh -T /dev/ptmx -c "/system/bin/dnsmasq -u root -g root --pid-file /dnsmasq.pid" >/dev/null 2>&1 manually in the container, it doesn't error, but I still get pkg errors

@sigmaSd
Copy link
Author

sigmaSd commented Aug 1, 2023

ah nvm thats not the issue, dnsmasq is running , I'm going to assume that initially the id is 0

docker run -it --entrypoint /entrypoint.sh termux/termux-docker:x86_64
/system/bin/busybox pidof dnsmasq # returns a pid 11 for example

so the issue lies somewhere else

@sigmaSd
Copy link
Author

sigmaSd commented Aug 1, 2023

I tested this on github action https://github.com/sigmaSd/t8664/actions/runs/5725674459/job/15514617432
and indeed it works
I haven no idea currently how to debug this locally

@sigmaSd
Copy link
Author

sigmaSd commented Aug 1, 2023

The only issue I noticed is that dnsmasq seems to be consuming one cpu completely, maybe its stuck
image

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

No branches or pull requests

2 participants