Open psyke83 opened 2 months ago
When launched via quadlet or compose with the default pasta driver [...] Pasta process will show:
/usr/bin/pasta --config-net --pid /run/user/1000/containers/networks/rootless-netns/rootless-netns-conn.pid --dns-forward 169.254.0.1 -t none -u none -T none -U none --no-map-gw --quiet --netns /run/user/1000/containers/networks/rootless-netns/rootless-netns
For some reason, ports are not forwarded at all (you get -t 6881-6881:6881-6881 -t 8080-8080:8080-8080 -u 6881-6881:6881-6881 -T none -U none
when started by command line).
When launched via quadlet or compose with the default pasta driver [...] Pasta process will show:
/usr/bin/pasta --config-net --pid /run/user/1000/containers/networks/rootless-netns/rootless-netns-conn.pid --dns-forward 169.254.0.1 -t none -u none -T none -U none --no-map-gw --quiet --netns /run/user/1000/containers/networks/rootless-netns/rootless-netns
For some reason, ports are not forwarded at all (you get
-t 6881-6881:6881-6881 -t 8080-8080:8080-8080 -u 6881-6881:6881-6881 -T none -U none
when started by command line).
Yes, I noticed this discrepancy, but I'm not certain how pasta is supposed to operate in bridged mode (which seems to be the main networking difference between quadlet/compose vs command line invocation).
I tested the following:
pasta_options = ["-t", "6881-6881:6881-6881", "-t", "8080-8080:8080-8080", "-u", "6881-6881:6881-6881"]
This results in the following error:
Error: rootlessport listen tcp 0.0.0.0:6881: bind: address already in use
Error: unable to start container "a1dcbf164f52ced90452666254b5d00005ce238e940fc1d228acf5b04034910d": rootlessport listen tcp 0.0.0.0:6881: bind: address already in use
pasta_options = ["-t", "auto", "-u", "auto"]
Process spawns with the following arguments, but unfortunately does not improve the issue:
conn 4716 0.2 0.2 71932 15508 ? Ss 15:24 0:00 /usr/bin/pasta --config-net -t auto -u auto --pid /run/user/1000/containers/networks/rootless-netns/rootless-netns-conn.pid --dns-forward 169.254.0.1 -T none -U none --no-map-gw --quiet --netns /run/user/1000/containers/networks/rootless-netns/rootless-netns
The bridge mode is special and never uses pasta for port forwarding, i.e. see https://github.com/containers/podman/discussions/22943#discussioncomment-9795883. But slirp4netns works in the same way so I do not see how this would cause any of this, i.e. port forwarding source ip is wrong (https://github.com/containers/podman/issues/8193).
How does qbittorrent actually try to figure out its external ip address?
I'm not well-versed on qBittorrent development, but my hunch is that it retrieves the ip address through libtorrent. So it would likely be this function which calls external_address() in libtorrent.
Although my test case doesn't apply (as I didn't set up an IPv6-enabled nework in the compose definition), after further testing I can see that rootless bridge mode has an issue resolving my IPv6 address even with slirp4netns
.
In summary:
network_mode
is set to pasta
or slirp4netns
in the compose/quadlet definition, the external IPv4 and IPv6 addresses are retrieved correctly.A friendly reminder that this issue had no activity for 30 days.
I have the same issue but for user created networks only. The default podman network works as expected. From what I can see pasta doesn't get the correct portmappings.
# default podman network
ps aux |grep -i pasta
user 3410 0.0 0.2 71940 12668 ? Ss 10:18 0:00 /usr/bin/pasta --config-net -u 51413-51413:51413-51413 -t 9091-9091:9091-9091 -t 51413-51413:51413-51413 --dns-forward 169.254.0.1 -T none -U none --no-map-gw --quiet --netns /run/user/1000/netns/netns-1217136f-ebce-13d5-bb4c-ff59950580bd
# user created network
ps aux |grep -i pasta
user 4108 0.5 0.2 71936 12648 ? Ss 10:43 0:00 /usr/bin/pasta --config-net --pid /run/user/1000/containers/networks/rootless-netns/rootless-netns-conn.pid --dns-forward 169.254.0.1 -t none -u none -T none -U none --no-map-gw --quiet --netns /run/user/1000/containers/networks/rootless-netns/rootless-netns
When i switch to slirp4netns it works like a charm.
user defined networks do not use pasta or slirp4netns for port forwarding, they use rootlessport: https://github.com/containers/podman/discussions/22943#discussioncomment-9795883
Thank you for the feedback. It is odd to me that changing to slirp4netns would make a difference if it's bypassed?
It is odd to me that changing to slirp4netns would make a difference if it's bypassed?
It's probably due to a difference in the address that's reported to qbittorrent, see https://github.com/containers/podman/issues/23739#issuecomment-2310186061. I'm not sure how that affects things, more investigation is definitely needed.
To clarify I use another bittorrent client called transmission. I don't know if it uses the same libraries or not. Anyway I would be really happy if this issue could get resolved and I will gladly help out if you need more information.
To clarify I use another bittorrent client called transmission. I don't know if it uses the same libraries or not. Anyway I would be really happy if this issue could get resolved and I will gladly help out if you need more information.
What would help here is some slightly deeper analysis of the issue (there's a start of it in https://github.com/containers/podman/issues/23739#issuecomment-2310186061): what do qbittorrent and Transmission expect to find as container address? How does the fact that slirp4netns does NAT, and the fact that pasta (by default) doesn't affect this? What happens if you specify options for pasta so that it behaves roughly like slirp4netns (look for pasta
in man podman-run
)? Which ones are actually needed?
Issue Description
It seems that qbittorrent running rootless via the default pasta driver (specifically if launched via podman compose or a quadlet) has trouble acquiring an external IP, which breaks DHT connectivity. Reverting to the
slirp4netns
driver fixes the issue for compose/quadlet invocations, and running qbittorrent via command-line using otherwise identical arguments also seems to work OK.Steps to reproduce the issue
Steps to reproduce the issue
After starting the qbittorrent container, navigate to web UI, then enable Logs in View menu. Click on Logs tab and check output for any line(s) matching
Detected external IP: xxx.xxx.xxx.xxx
. Additionally, watch the DHT node count at bottom of the web UI.For testing the command-line invocation:
Compose definition (same effect if converted to a quadlet):
Describe the results you received
When launched via command-line, external IP is resolved and DHT count will increase as normal. The pasta process will show these arguments:
When launched via quadlet or compose with the default pasta driver, the external IP is not resolved in 95% of cases, and DHT count remains at 0. In some rare cases, the external IP is resolved after an extended delay, but the DHT count does not increase at the expected rate. Pasta process will show:
When launched via quadlet/compose and
default_rootless_network_cmd
is set toslirp4netns
, external IP resolution and DHT works correctly at all times.Describe the results you expected
External IP and DHT connectivity should be working in all configurations.
podman info output