Page 1 of 2
Connection refused to SOCKS5 proxy
Posted: Tue May 30, 2023 7:40 am
by nicoco
Hi all,
I'm using deluge 2.0.3 on debian bullseye (libtorrent 1.2.9.0) and fail to set up a SOCKS5 proxy. It used to work in the past for me, but I'm failing to set it back up. Deluge won't start downloading anything and I have "Error: Connection refused" in the tracker status line of the torrent status tab. Disabling the proxy makes download resume, so it's definitely something wrong with the proxy.
The proxy seems to work, I also use it for proxying web requests to some websites, also:
Code: Select all
deluge@tour-nicoco-infernale:~$ curl --socks5 localhost:6667 example.com
<!doctype html>
<html>
[...]
This is what my conf looks like:
Code: Select all
deluge@tour-nicoco-infernale:~$ grep proxy -A 3 ~/.config/deluge/core.conf
"proxy": {
"anonymous_mode": true,
"force_proxy": true,
"hostname": "localhost",
"password": "",
"port": 6667,
"proxy_hostnames": false,
"proxy_peer_connections": true,
"proxy_tracker_connections": true,
"type": 2,
"username": ""
},
I don't think it's relevant at this point but here's how I launch the proxy:
Code: Select all
ssh -D 0.0.0.0:6667 <the-IP-of-a-VPS-I-rent> -N
Any clue as to what is going on?
Re: Connection refused to SOCKS5 proxy
Posted: Tue May 30, 2023 8:39 am
by mhertz
If the tracker failing is UDP based then will fail as ssh's socks5 implementation doesn't support UDP, atleast not a decade ago or so, when I last looked/played into it.
Also, earlier deluge's didn't have a force_proxy option(can't remember name in GUI), which before would have then ran anyway unproxied(actually in newer libtorrent that option is deprecated if remember right and so it's functionality always enabled regardless).
Last, deluge 2.0.3 will often show error in tracker tab erroneously, because semantics no reason go into here, but if download starts only unproxied, then probably not related to this.
Re: Connection refused to SOCKS5 proxy
Posted: Wed May 31, 2023 3:53 pm
by nicoco
Thanks for the reply!
> If the tracker failing is UDP
Maybe? Are all trackers this way? Because I have about 30 torrents from ~10 different trackers so it is a bit weird.
> earlier deluge's didn't have a force_proxy
So it should work as it did before without this option? But my "real" IP could be exposed by doing so, couldn't it?
Re: Connection refused to SOCKS5 proxy
Posted: Wed May 31, 2023 4:47 pm
by mhertz
nicoco wrote: ↑Wed May 31, 2023 3:53 pm
Thanks for the reply!
Welcome!
> If the tracker failing is UDP
Maybe? Are all trackers this way? Because I have about 30 torrents from ~10 different trackers so it is a bit weird.
No, but it's pretty normal though today I believe, that and https trackers - you can see what the tracker starts with i.e. udp://xxxxx, but doesn't show in the tracker tab though, I believe.
> earlier deluge's didn't have a force_proxy
So it should work as it did before without this option? But my "real" IP could be exposed by doing so, couldn't it?
I just meant that today, because you use a new libtorrent, then that force_proxy option is redundant, as always adhered too in backend, I believe at least, but tick it regardless, as you do, can never hurt atleast. Yes, if I remember wrong here, and you untick it, then indeed would be insecure, so yes tick it to be safe. Just explaining for info and not a solution.
Deluge works different at 2.0.4 and up, regarding how reports failing trackers. Some of these fails are not issues, but just because libtorrent supports multi-homing, nothing you need to worry about, but to be sure that it's not an important issue, then if wanted can replace the deluge 2.0.3 torrentmanager.py file of deluge 2.0.3, with this one here, which I just patched with DjLegolas old nice PR fixing this issue, and gotten merged for deluge 2.0.4. I though would recommend that you update to newer deluge instead, just in general, but up to you, and just attaching this patched file in case wanted it. On my install it's in /usr/lib/python3.11/site-packages/deluge/core/torrentmanager.py, but not using your distro, so little different i'm sure. Backup old file if doing it.
torrentmanager.py
Anyway, i'm guessing it's either a deluge 2.0.3 issue, being not important, or that it's an UDP tracker failing, because you use SSH socks5, which you cannot do anything about, except use other than UDP trackers sadly. Granted as you say it works again when disabling proxy, then the latter sounds more likely.
Re: Connection refused to SOCKS5 proxy
Posted: Wed May 31, 2023 7:46 pm
by nicoco
Oh OK.
Well next debian stable is due next month, so I'll just watch what I already have downloaded in the meantime. Less TV shows and more movies sounds good, for a change.

Re: Connection refused to SOCKS5 proxy
Posted: Wed May 31, 2023 8:50 pm
by ambipro
nicoco wrote: ↑Wed May 31, 2023 7:46 pm
Oh OK.
Well next debian stable is due next month, so I'll just watch what I already have downloaded in the meantime. Less TV shows and more movies sounds good, for a change. ;-)
If using Debian's repositories, they are out of date regarding deluge package, and you could check out the download section of this site for information on using the official deluge repository to update to the latest, just thought it would be worth mentioning.
Re: Connection refused to SOCKS5 proxy
Posted: Sat Jun 03, 2023 11:34 am
by nicoco
Thanks for the suggestion which I will need, since deluge seems to be stuck at 2.0.3 even for the next debian (bookworm). The download section points to debian official packages so they won't help much. Looks like I'm going to go the container route then.
Re: Connection refused to SOCKS5 proxy
Posted: Sat Jun 03, 2023 12:12 pm
by ambipro
Re: Connection refused to SOCKS5 proxy
Posted: Sat Jun 03, 2023 6:28 pm
by mhertz
@nicoco,
You can google how use ambipro's helpfull advice for debian e.g. "using PPA's on debain". Also, pypa is a choise usually(platform/python-version dependant), also maintained by Cas, with 'sudo pip3 install -U deluge'. Can also get libtorrent easy from there with same command(replace 'deluge' with 'libtorrent' there), co-maintained by libtorrent contributor and lead dev. Can skip sudo for user installs if wanted. 'sudo apt install python3-pip' if need be firstly.
Re: Connection refused to SOCKS5 proxy
Posted: Mon Jun 05, 2023 9:05 am
by nicoco
Thanks for the suggestions! I confess I am a bit reluctant to incorporate PPAs, meant for ubuntu, in fear that it might break some stuff. pip with sudo is usually a bad idea but I guess I could give `pipx` a try. Anyway, I rented a seedbox for a month, so I'll give this a new try in a few weeks. Maybe the libtorrent update in debian bullseye will be enough.
FWIW, I tried the flatpak latest version and it worked with my socks5 just fine, so it really looks like it's a bug in deluge 2.0.3 or libtorrent whatever-version-debian-bullseye-provides.