https://wiki.archlinux.org/api.php?action=feedcontributions&user=Maggiestar&feedformat=atomArchWiki - User contributions [en]2024-03-29T13:24:13ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Deluge&diff=472799Deluge2017-04-02T17:56:05Z<p>Maggiestar: /* Installation */ installation note</p>
<hr />
<div>[[Category:Internet applications]]<br />
[[de:Deluge]]<br />
[[es:Deluge]]<br />
[[ja:Deluge]]<br />
[[ko:Deluge]]<br />
{{Related articles start}}<br />
{{Related|rTorrent}}<br />
{{Related|systemd}}<br />
{{Related|systemd/User}}<br />
{{Related|iptables}}<br />
{{Related|OpenSSL}}<br />
{{Related articles end}}<br />
<br />
[http://deluge-torrent.org/ Deluge] is a lightweight but full-featured BitTorrent application written in Python 2. It has a variety of features, including but not limited to: a client/server model, DHT support, magnet links, a plugin system, UPnP support, full-stream encryption, proxy support, and three different client applications. When the server daemon is running, users can connect to it via a console client, a GTK+-based GUI, or a Web-based UI. A full list of features can be viewed [http://dev.deluge-torrent.org/wiki/About here].<br />
<br />
== Installation ==<br />
<br />
Install {{Pkg|deluge}} and optionally {{Pkg|python2-service-identity}} as users may experience a lengthy warning and have their client reject many valid certificate/hostname mappings. Alternatively, a split package [https://aur.archlinux.org/pkgbase/deluge-split/ deluge-split] can be built and components cherry-picked if only certain ones are needed. For example, space savings can be realized if only the backend is needed or if only the gtk-client is needed etc.<br />
<br />
{{Note|Currently, {{pkg|python2-twisted}} and its 4 other dependencies that pacman pulls in automatically when installing deluge are not removed due to a bug revolving around a dependency cycle, see: {{Bug|41031}}. Users can circumvent this by removing the affected packages (assuming they are not needed by other packages installed on the system): {{ic|pacman -Rs deluge python2-twisted}}.}}<br />
<br />
== Daemon ==<br />
Deluge works with a client/server model. The server is referred to as the daemon and runs in the background waiting for a client (console, gtk, or web-based) to connect. The client can disconnect but the daemon continues to run transferring the torrent files in the queue.<br />
<br />
Upon installation, pacman will create a non-privileged '''deluge''' user. This user is meant to run the provided daemon, {{ic|/usr/bin/deluged}}. Users are able to start the daemon several ways:<br />
# Systemd system service (runs as the deluge user).<br />
# Systemd user service (runs as another user).<br />
# Running it directly (runs as another user).<br />
<br />
{{Tip|For the highest level of security, running {{ic|deluged}} via the systemd system service ({{ic|deluged.service}}) is recommended since the deluge user has no shell access (limited account) or other group affiliation on the host system. In addition to the security benefits of running as the non-privileged deluge user, the system service can also run at boot without the need to start Xorg or a client.}}<br />
<br />
=== System service ===<br />
<br />
[[Start]] the service and optionally [[enable]] it if running at boot is desired.<br />
<br />
=== User service ===<br />
<br />
{{Warning|If multiple users are running a daemon, the default port (58846) will need to be changed for each user.}}<br />
A user service will allow {{ic|deluged}} to run when {{ic|systemd --user}} is started. This is accomplished by creating a user service file:<br />
{{hc|/etc/systemd/user/deluged.service|<nowiki><br />
[Unit]<br />
Description=Deluge Daemon<br />
After=network.target<br />
<br />
[Service]<br />
ExecStart=/usr/bin/deluged -d -P %h/.config/deluge/deluge.pid<br />
<br />
[Install]<br />
WantedBy=default.target<br />
</nowiki>}}<br />
The deluge user service can now be [[start]]ed and enabled by the user.<br />
<br />
The {{ic|deluged}} user service can also be placed in {{ic|$HOME/.config/systemd/user/}}. See [[systemd/User]] for more information on user services.<br />
<br />
== Configuration ==<br />
<br />
Deluge can be configured through any of the clients as well as by simply editing the JSON-formatted configuration files located in {{ic|$HOME/.config/deluge/}}. '''$HOME''' refers to the home directory of the user that {{ic|deluged}} is running as. This means that if the daemon is running as the '''deluge''' user, the default home directory is {{ic|/srv/deluge/}}.<br />
<br />
=== Shared directories for downloads/uploads ===<br />
When using the systemd deluged.service, the shared directory/directories need to be shared so that other users on the system are able to access the data. The general strategy is to:<br />
<br />
# Change the owner and group of the shared directory to deluge:deluge.<br />
# Set the [[File permissions and attributes]] on the shared directory to at least 770.<br />
# Add your user (or the user/users needing to access the files) to the deluge group.<br />
<br />
Example using {{ic|/mnt/torrent_data}}:<br />
# chown -R deluge:deluge /mnt/torrent_data<br />
# chmod 770 /mnt/torrent_data<br />
# usermod -a -G deluge YOURUSER<br />
<br />
{{Note|When usermod is used to change group affiliation, a logout/login is required before changes take effect.}}<br />
<br />
=== Firewall ===<br />
<br />
Deluge requires at least one port open for TCP and UDP to allow incoming connections for seeding. If deluge complaining that it cannot open a port for incoming connections, users must open port(s) to be used. In this example, ports 56881 through 56889 are opened for TCP and UDP:<br />
# iptables -A INPUT -p tcp --dport 56881:56889 -j ACCEPT<br />
# iptables -A INPUT -p udp --dport 56881:56889 -j ACCEPT<br />
User who are behind a NAT router/firewall must setup the corresponding ports to be forwarded. UPnP may also be used, but that will not work with the local firewall on the system because it requires predefined ports.<br />
{{Note|One can limit this to a single port, just be sure to enable both TCP and UDP.}}<br />
<br />
On many default configurations, when using iptables with connection tracking (conntrack) set to drop "INVALID" packets, sometimes a great deal of legitimate torrent traffic (especially DHT traffic) is dropped as "invalid." This is typically caused by either conntrack's memory restrictions, or from long periods between packets among peers (see [http://libtorrent.rakshasa.no/wiki/RTorrentUsingDHT] towards the bottom and [http://www.linuxquestions.org/questions/showthread.php?p=5145026]). Symptoms of this problem include torrents not seeding, especially when the torrent client has been active for more than a day or two continuously, and consistently low overhead traffic (in one experience, less than 3KiB/s in either in or out) with DHT enabled, even when deluge/libtorrent has been continuously running for more than forty-eight hours and many torrents are active. For this reason, it may be necessary to disable connection tracking of all torrent traffic for optimal performance, even with the listening ports set to ACCEPT (as the causes for dropping INVALID packets, for instance conntrack's memory problems, may supercede any rules to accept traffic to/from those ports).<br />
<br />
To fully turn off connection tracking for torrents, specify ports for both Incoming and Outgoing traffic in Deluge, for instance, 56881-56889 for incoming connections and 56890-57200 for outgoing connections.<br />
{{Note|Limiting incoming connections is not recommended with libtorrent as this will limit the ability to keep multiple connections to the same client, even for different torrents.}}<br />
<br />
Then issue the following commands (after substituting the relevant port ranges):<br />
# iptables -t raw -I PREROUTING -p udp --dport 56881:57200 -j NOTRACK<br />
# iptables -t raw -I OUTPUT -p udp --sport 56881:57200 -j NOTRACK<br />
# iptables -t raw -I PREROUTING -p tcp --dport 56881:57200 -j NOTRACK<br />
# iptables -t raw -I OUTPUT -p tcp --sport 56881:57200 -j NOTRACK<br />
# iptables -I INPUT -p icmp --icmp-type 3 -j ACCEPT<br />
# iptables -I INPUT -p icmp --icmp-type 4 -j ACCEPT<br />
# iptables -I INPUT -p icmp --icmp-type 11 -j ACCEPT<br />
# iptables -I INPUT -p icmp --icmp-type 12 -j ACCEPT<br />
The ICMP allowances are desirable because once connection tracking is disabled on those ports, those important ICMP messages (types 3 (Destination Unreachable), 4 (Source Quench), 11 (Time Exceeded) and 12 (Parameter Problem)) would otherwise be declared INVALID themselves (as netfilter would not know of any connections that they are associated with), and they would potentially be blocked.<br />
{{Warning|A port range of 1024:65535 would break every DNS query.}}<br />
<br />
=== Plugins ===<br />
{{Note|Plugins should be compiled with Python2.7: e.g. {{ic|$ python2.7 ''setup.py build''}}.}}<br />
<br />
A complete list of plugins can be found on the [http://dev.deluge-torrent.org/wiki/Plugins Deluge Wiki]<br />
<br />
[https://github.com/ratanakvlun/deluge-ltconfig ltConfig] is a useful plugin that allows direct modification to libtorrent settings and has preset support.<br />
<br />
It offers additional settings like {{ic|announce_ip}} (IP to announce to trackers), {{ic|half_open_limit}} (Remove maximum half-open connections limit) and more possible privacy and (seed) speedboost features.<br />
<br />
== Clients ==<br />
<br />
=== Console ===<br />
<br />
The console client can be run with:<br />
$ deluge-console<br />
Enter the {{ic|help}} command for a list of available commands.<br />
<br />
=== GTK+ ===<br />
<br />
{{Note|It is wise to disable Classic Mode in ''Edit -> Preferences -> Interface'' for daemon (server) setups.}}<br />
The GTK+ client can be run with:<br />
$ deluge-gtk<br />
or:<br />
$ deluge<br />
<br />
The GTK+ client has a number of useful plugins:<br />
* AutoAdd - Monitors directories for .torrent files<br />
* Blocklist - Downloads and imports an IP blocklist<br />
* Execute - Event-based command execution<br />
* Extractor - Extracts archived files upon completion '''''(beware of random high disk I/O usage)'''''<br />
* Label - Allows labels to be assigned to torrents, as well as state, tracker, and keyword filters<br />
* Notifications - Provides notifications (email, pop-up, blink, sound) for events as well as other plugins<br />
* Scheduler - Limits active torrents and their speed on a per-hour, per-day basis<br />
* WebUi - Allows the Web UI to be started via the GTK+ client<br />
<br />
=== Web ===<br />
A web-client is also provided should users not want GTK or shell-based access to the daemon. Just as with deluge daemon mentioned above, the web client as can be started several different ways:<br />
# Systemd system service (runs as the deluge user).<br />
# Systemd user service (runs as another user).<br />
# Running it directly (runs as another user).<br />
<br />
{{Tip|For the highest level of security, running {{ic|deluge-web}} via the systemd system service ({{ic|deluge-web.service}}) is recommended since the deluge user has no shell access (limited account) or other group affiliation on the host system. In addition to the security benefits of running as the non-privileged deluge user, the system service can also run at boot without the need to start Xorg or a client.}}<br />
<br />
When the web client s initially started, it will create {{ic|$HOME/.config/deluge/web.conf}}. The password in this file is hashed with SHA1 and salted. The default password is "deluge".<br />
<br />
Several things to note:<br />
* The web client offers many of the same features of the GTK+ UI, including the plugin system.<br />
* It is recommended to use HTTPS for the Web client to protect against a man-in-the-middle attack.<br />
* Users may be greeted by a warning from the browser that the SSL certificate is untrusted. Add an exception to this in the browser to continue on. See the [[OpenSSL]] page for information on creating your own certificate.<br />
* If multiple users are running a daemon, the default port (8112) will need to be changed for each user.<br />
<br />
Once running, users may connect to the web client by browsing to http://hostname:8112 or if using encryption: https://hostname:8112<br />
<br />
==== System service ====<br />
Deluge ships with {{ic|deluge-web.service}}, a systemd system unit, which is used to [[start]] the Deluge Web UI. The Deluge Web UI uses a Connection Manager, allowing managing of multiple Deluge clients running under the same host or on an entirely different one. Remember to [[start]] and optionally [[enable]] the {{ic|deluged}} service to allow the Web UI connect to the host Deluge client.<br />
<br />
==== User service ====<br />
A user service will allow {{ic|deluge-web}} to run when {{ic|systemd --user}} is started. This is accomplished by creating a user service file:<br />
{{hc|/etc/systemd/user/deluge-web.service|<nowiki><br />
[Unit]<br />
Description=Deluge Web UI<br />
After=deluged.service<br />
<br />
[Service]<br />
ExecStart=/usr/bin/deluge-web --ssl<br />
<br />
[Install]<br />
WantedBy=default.target<br />
</nowiki>}}<br />
The deluge user service can now be [[start]]ed and enabled by the user.<br />
<br />
The {{ic|deluge-web}} user service can also be placed in {{ic|$HOME/.config/systemd/user/}}. See [[systemd/User]] for more information on user services.<br />
<br />
== Headless setup ==<br />
<br />
Deluge is quite useful on a headless system, often referred to as a seed box, because of its client/server model. To set up deluge on a headless system, set up the daemon as shown above.<br />
<br />
=== Create a user ===<br />
<br />
To allow interaction with the server remotely, create a user in {{ic|$HOME/.config/deluge/auth}}. For example:<br />
$ echo "delugeuser:p422WoRd:10" >> $HOME/.config/deluge/auth<br />
{{Note|<br />
* The user/password created does not have to match any system users, and to maintain good security practices it should '''not'''!<br />
* The user/password in this file are not hashed or salted like in the web client config.<br />
* The user/password must match the user/password found in /srv/deluge/.config/deluge/auth otherwise the authentication fails.<br />
}}<br />
<br />
The number '''10''' corresponds to a level of '''Admin'''. Refer to the following table for additional values:<br />
<br />
{| class="wikitable" align="center"<br />
|-<br />
! Level Name !! Level Value<br />
|-<br />
| None || 0<br />
|-<br />
|Read Only || 1<br />
|-<br />
| Normal || 5<br />
|-<br />
| Admin || 10<br />
|}<br />
<br />
{{Note|In Deluge 1.35, these values have no effect, but multiuser options are under development.}}<br />
<br />
=== Allow remote ===<br />
<br />
The default settings disallow remote connections. Change the "allow_remote" setting in {{ic|$HOME/.config/deluge/core.conf}}:<br />
"allow_remote": true<br />
{{Note|<br />
{{ic|$HOME/.config/deluge/core.conf}} is automatically created at the first configuration change, if it does not exist you can set the value via {{ic|deluge-console}}:<br />
config --set allow_remote true<br />
}}<br />
<br />
=== Firewall ===<br />
<br />
Open the port for remote access. The following example uses the default daemon port (58846):<br />
# iptables -A INPUT -p tcp --dport 58846 -j ACCEPT<br />
See [[iptables]] for more information on firewall rules.<br />
<br />
Users behind a NAT router/firewall must forward the port to access the daemon from outside the network if this behavior is desired.<br />
<br />
=== Connect ===<br />
<br />
In the console client:<br />
connect <host>[:<port>] <user> <password><br />
<br />
In the GTK+ client, ''Edit > Connection Manager > Add''.<br />
<br />
In the Web client, ''Connection Manager > Add''.<br />
<br />
==== SSH Tunnel ====<br />
An SSH tunnel can be created to use an encrypted connection on any client. This requires an extra loopback address to be added, but this can be automated at boot. Without this step, the connection would be considered local. The actual command to establish an SSH tunnel cannot be automated as it requires user input. There are a few possible ways to go about doing that.<br />
{{hc|/etc/systemd/system/extra_lo_addr.service|<nowiki><br />
[Unit]<br />
Description=extra loopback address<br />
Wants=network.target<br />
<br />
[Service]<br />
Type=oneshot<br />
RemainAfterExit=yes<br />
ExecStart=/sbin/ip addr add 127.0.0.2/8 dev lo<br />
ExecStop=/sbin/ip addr del 127.0.0.2/8 dev lo<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
$ ssh -fNL 127.0.0.2:58846:localhost:58846 <ssh host><br />
The port '''58846''' should be replaced with the port the deluge server is running on and '''<ssh host>''' should be replaced with the server hosting both deluge and the SSH server.<br />
<br />
== Troubleshooting ==<br />
<br />
=== No module named service_identity ===<br />
<br />
Upon running {{ic|deluged}} or {{ic|deluge-console}}, you may recieve a message like the following:<br />
<br />
:0: UserWarning: You do not have a working installation of the service_identity module: 'No module named service_identity'. <br />
Please install it from <https://pypi.python.org/pypi/service_identity> and make sure all of its dependencies are satisfied. <br />
Without the service_identity module and a recent enough pyOpenSSL to support it, Twisted can perform only rudimentary TLS <br />
client hostname verification. Many valid certificate/hostname mappings may be rejected.<br />
<br />
You may be missing {{Pkg|python2-service-identity}}, which is an optional dependency to {{Pkg|python2-twisted}}. See {{Bug|43806}}.<br />
<br />
== See Also ==<br />
* [http://deluge-torrent.org/ Deluge homepage]<br />
* [http://dev.deluge-torrent.org/wiki Deluge wiki]</div>Maggiestarhttps://wiki.archlinux.org/index.php?title=Talk:Deluge&diff=458219Talk:Deluge2016-12-01T19:47:45Z<p>Maggiestar: /* Split package in the AUR */ my comments</p>
<hr />
<div>== Issue with the way conntrack is disabled ==<br />
<br />
ArchWiki recommends setting an outgoing port range.<br />
<br />
http://libtorrent.org/reference-Settings.html<br />
<br />
states that<br />
<br />
outgoing_ports<br />
if set to something other than (0, 0) is a range of ports used to bind outgoing sockets to. This may be useful for users whose router allows them to assign QoS classes to traffic based on its local port. It is a range instead of a single port because of the problems with failing to reconnect to peers if a previous socket to that peer and port is in TIME_WAIT state.<br />
<br />
WARNING<br />
setting outgoing ports will limit the ability to keep multiple connections to the same client, even for different torrents. It is not recommended to change this setting. Its main purpose is to use as an escape hatch for cheap routers with QoS capability but can only classify flows based on port numbers.<br />
<br />
This can likely be bypassed by disabling conntrack on all unprivileged or ephemeral ports and not restricting the outgoing port range in the settings. As things are documented right now, it stands to reason that things could get worse this way.<br />
<br />
--[[User:SAKUJ0|SAKUJ0]] ([[User talk:SAKUJ0|talk]]) 19:21, 30 September 2015 (UTC)<br />
<br />
== Workaround for issues with connection tracking ==<br />
<br />
This is an issue. Setting the outgoing ports can introduce new problems. So naturally, one would try to disable it for the entire outgoing port range if only deluge is intended to make outgoing connections. This introduces issues with DNS resolution. A work-around is to enter --source IP_DNS_SERVER rules that ACCEPT the raw packages before NOTRACK is joined.<br />
--[[User:SAKUJ0|SAKUJ0]] ([[User talk:SAKUJ0|talk]]) 19:21, 30 September 2015 (UTC)<br />
<br />
== <s>Split package in the AUR</s> ==<br />
<br />
Regarding your [https://wiki.archlinux.org/index.php?title=Deluge&type=revision&diff=457971&oldid=457970 edit]: [https://bugs.archlinux.org/task/16772 FS#16772] been rejected. I also know that most maintainers will not want the added burden of building the split package as I have since upstream does not supply make targets [http://forum.deluge-torrent.org/viewtopic.php?f=8&t=38735#p225355 yet]. My AUR package both supplies less files (no *.pyc or *.pyo) and it is a split package allowing flexibility in installed size and in respective deps. I would therefore argue it is not identical to {{pkg|deluge}}. [[User:Graysky|Graysky]] ([[User talk:Graysky|talk]]) 21:01, 28 November 2016 (UTC)<br />
<br />
:It still has no difference in features or lack thereof, it's purely about packaging semantics. That bug was closed with "upstream has no decent method", so, get in touch with upstream? -- [[User:Alad|Alad]] ([[User talk:Alad|talk]]) 21:23, 28 November 2016 (UTC)<br />
:edit: upstream agreed to work on it, but I still don't see how this package benefits this article. Keeping packages small isn't a main concern of the distribution, and we could go on splitting dozens of other packages and mention this in their respective wiki articles. -- [[User:Alad|Alad]] ([[User talk:Alad|talk]]) 21:29, 28 November 2016 (UTC)<br />
::Arch is about options and freedom. I know of several other Archers who would like a minimal package (install and deps). Seems reasonable to me to inform users of the option on this wiki page. [[User:Graysky|Graysky]] ([[User talk:Graysky|talk]]) 21:52, 28 November 2016 (UTC)<br />
<br />
:::It seems that whenever the topic Arch is mentioned, people come up with tropes like that. In any case, a trope isn't a convincing argument to modify wiki articles. If there's someone with a third opinion on this, feel free to mention it; until then, I'm closing this discussion. -- [[User:Alad|Alad]] ([[User talk:Alad|talk]]) 03:43, 29 November 2016 (UTC)<br />
<br />
::::For the record, I talked to [[User:Kyrias]] and he agreed it goes against [[Arch_User_Repository#Rules_of_submission]]. -- [[User:Alad|Alad]] ([[User talk:Alad|talk]]) 13:28, 29 November 2016 (UTC)<br />
<br />
: I see the benefit of deluge-split because Arch does not provide the split package and I can use much less space on my seedbox using just deluge-daemon from the AUR graysky made. +! to mention the package on this article. [[User:Maggiestar|Maggiestar]] ([[User talk:Maggiestar|talk]]) 19:47, 1 December 2016 (UTC)</div>Maggiestar