rTorrent is unabled to use socket file
axellebot opened this issue · 4 comments
Hey !
I'm trying to install a vpn+rtorrent+flood stack but I'm stuck with the socket file use.
Here are my main configuration files :
My compose file
version: '3.7'
networks:
web:
external: true
internal:
external: false
driver: bridge
services :
vpn:
image: bubuntux/nordvpn:latest
network_mode: bridge
container_name: nordvpnwireguard
cap_add:
- NET_ADMIN # Required
devices:
- /dev/net/tun
environment: # Review https://github.com/bubuntux/nordvpn#environment-variables
- USER=username
- "PASS=passphrase"
- CONNECT=Somewhere
- TECHNOLOGY=NordLynx
- NETWORK=192.168.1.0/24
torrent:
image: jesec/rtorrent
network_mode: service:vpn
container_name: rtorrent
user: 1001:1001
restart: unless-stopped
environment:
XDG_CONFIG_HOME: /config
volumes:
- /tmp/rtorrent/config/rtorrent.rc:/config/rtorrent/rtorrent.rc
- /tmp/rtorrent.socket:/tmp/rtorrent.socket
- /downloads:/downloads
- /downloads/torrents/watch:/watch
depends_on:
- vpn
flood:
image: jesec/flood:latest
container_name: flood
user: 1001:1001
restart: unless-stopped
command: --allowedpath /data
volumes:
- /tmp/flood/config:/config
- /downloads:/downloads
- /tmp/rtorrent.socket:/tmp/rtorrent.socket
labels:
# Traefik Config omitted
networks:
- web
- internal
depends_on:
- torrent
- vpn
My rtorrent.rc file
# /tmp/rtorrent/config/rtorrent.rc
#############################################################################
# A minimal rTorrent configuration that provides the basic features
#############################################################################
# Some default configs are commented out by #, you can override them to fit your needs
# Lines commented out by ## are merely examples (NOT default)
# It is recommended to extend upon this default config file. For example:
# override only some configs via command line: -o network.port_range.set=6881-6881
# or, on top of custom config: import = /etc/rtorrent/rtorrent.rc
# rTorrent runtime directory (cfg.basedir) [default: "$HOME/.local/share/rtorrent"]
method.insert = cfg.basedir, private|const|string, (cat,(fs.homedir),"/.local/share/rtorrent/")
# Default download directory (cfg.download) [default: "$(cfg.basedir)/download"]
method.insert = cfg.download, private|const|string, (cat,"/downloads/")
# Log directory (cfg.logs) [default: "$(cfg.basedir)/log"]
method.insert = cfg.logs, private|const|string, (cat,(cfg.basedir),"log/")
method.insert = cfg.logfile, private|const|string, (cat,(cfg.logs),"rtorrent-",(system.time),".log")
# Torrent session directory (cfg.session) [default: "$(cfg.basedir)/.session"]
method.insert = cfg.session, private|const|string, (cat,(cfg.basedir),".session/")
# Watch (drop to add) directories (cfg.watch) [default: "$(cfg.basedir)/watch"]
method.insert = cfg.watch, private|const|string, (cat,"/watch/")
# Create directories
fs.mkdir.recursive = (cat,(cfg.basedir))
fs.mkdir = (cat,(cfg.download))
fs.mkdir = (cat,(cfg.logs))
fs.mkdir = (cat,(cfg.session))
fs.mkdir = (cat,(cfg.watch))
fs.mkdir = (cat,(cfg.watch),"/load")
fs.mkdir = (cat,(cfg.watch),"/start")
# Drop to "$(cfg.watch)/load" to add torrent
schedule2 = watch_load, 11, 10, ((load.verbose, (cat, (cfg.watch), "load/*.torrent")))
# Drop to "$(cfg.watch)/start" to add torrent and start downloading
schedule2 = watch_start, 10, 10, ((load.start_verbose, (cat, (cfg.watch), "start/*.torrent")))
# Listening port for incoming peer traffic
#network.port_range.set = 6881-6999
network.port_range.set = 6881-6881
#network.port_random.set = yes
# Distributed Hash Table and Peer EXchange
# Enable tracker-less torrents but vulnerable to passive sniffing
# DHT and PEX are always disabled for private torrents
#dht.mode.set = auto
#dht.port.set = 6881
#protocol.pex.set = yes
# DHT nodes for bootstrapping
dht.add_bootstrap = dht.transmissionbt.com:6881
dht.add_bootstrap = dht.libtorrent.org:25401
# UDP tracker support
#trackers.use_udp.set = yes
# Peer settings
throttle.max_uploads.set = 100
throttle.max_uploads.global.set = 250
throttle.min_peers.normal.set = 20
throttle.max_peers.normal.set = 60
throttle.min_peers.seed.set = 30
throttle.max_peers.seed.set = 80
trackers.numwant.set = 80
#protocol.encryption.set = allow_incoming,try_outgoing,enable_retry
# Limits for file handle resources, this is optimized for
# an `ulimit` of 1024 (a common default). You MUST leave
# a ceiling of handles reserved for rTorrent's internal needs!
network.max_open_files.set = 600
network.max_open_sockets.set = 300
# Memory resource usage (increase if you have a large number of items loaded,
# and/or the available resources to spend)
pieces.memory.max.set = 1800M
#network.xmlrpc.size_limit.set = 16M
# Basic operational settings
session.path.set = (cat, (cfg.session))
directory.default.set = (cat, (cfg.download))
log.execute = (cat, (cfg.logs), "execute.log")
##log.xmlrpc = (cat, (cfg.logs), "xmlrpc.log")
# Other operational settings
encoding.add = utf8
system.umask.set = 0027
system.cwd.set = (directory.default)
#schedule2 = low_diskspace, 5, 60, ((close_low_diskspace, 500M))
#pieces.hash.on_completion.set = no
##view.sort_current = seeding, greater=d.ratio=
##keys.layout.set = qwerty
# HTTP and SSL
network.http.max_open.set = 50
network.http.dns_cache_timeout.set = 25
# Path to the CA bundle. By default, rTorrent tries to detect from:
# $RTORRENT_CA_BUNDLE (highest priority)
# $CURL_CA_BUNDLE
# $SSL_CERT_FILE
# /etc/ssl/certs/ca-certificates.crt
# /etc/pki/tls/certs/ca-bundle.crt
# /usr/share/ssl/certs/ca-bundle.crt
# /usr/local/share/certs/ca-root-nss.crt
# /etc/ssl/cert.pem (lowest priority)
##network.http.cacert.set = /etc/ssl/certs/ca-certificates.crt
# Path to the certificate directory to verify the peer. The certificates
# must be in PEM format, and the directory must have been processed using
# the c_rehash utility supplied with openssl.
#
# For advanced users only, generally you should use network.http.cacert.set
# to specify path to the bundle of certificates.
##network.http.capath.set = "/etc/ssl/certs"
#network.http.ssl_verify_peer.set = 1
#network.http.ssl_verify_host.set = 1
## Run the rTorrent process as a daemon in the background
system.daemon.set = true
# XML-RPC interface
network.scgi.open_local = (cat,"/tmp/rtorrent.socket")
# Logging:
# Levels = critical error warn notice info debug
# Groups = connection_* dht_* peer_* rpc_* storage_* thread_* tracker_* torrent_*
print = (cat, "Logging to ", (cfg.logfile))
log.open_file = "log", (cfg.logfile)
log.add_output = "info", "log"
##log.add_output = "tracker_debug", "log"
### END of rtorrent.rc ###
The rtorrent.rc
is used by rtorrent but it does through a error while using the socket, here is the log of the container :
Error in option file: /config/rtorrent/rtorrent.rc:130: Could not prepare socket for listening: Address in use
refering this line :
# XML-RPC interface
network.scgi.open_local = (cat,"/tmp/rtorrent.socket")
The socket file on host :
$ ls -al /tmp/
drwxr-xr-x 2 1001 1001 4096 Nov 7 11:39 rtorrent.socket
Test with nc on host:
$ nc -lkU /tmp/rtorrent.socket
nc: Address already in use
: 6881
port is not used on host (checked with netstat -anop | grep 6881
)
What do I miss ?
The default config file uses cat because it constructs the full path by concatenating rtorrent.sock to the cfg.basedir.
For absolute path, simply:
# XML-RPC interface
network.scgi.open_local = /tmp/rtorrent.socket
Thanks, I edited this line and others but it doesn't seems to be related to my issue 🤔
Is there something else that I should edit ?
Address already in use
you may want to make sure that you are not running two rTorrent instances at the same time.
Additionally, make sure that a socket can be created at /tmp. Note that many systems, for security reasons, mount /tmp
with nodev
. It is generally a bad idea to place the rTorrent socket in /tmp
since it is open to everyone, and rTorrent RPC interface allows arbitrary command execution without authentication.