BenV's notes

Torrent stuff

by on Nov.07, 2009, under Software

Every now and then I like to leech something, and it happens to be that using bittorrent has a lot to offer in terms of availability and usability. However, as usual I have my demands. My demands for a torrent program are basically:

  • It has to run on Slackware
  • It has to run as a daemon (in daemontools if possible)
  • There has to be an easy way to control and view the status, like a web based GUI.

A few years ago I used mldonkey for it. Worked fine, but their torrent support was getting worse and worse. (basically they didn’t update their product for ages, and when they did it didn’t improve much). It had a web interface that worked nicely though, and it was easy to control. Another cute thing was that it also supported other protocols that I still used back then like Edonkey.

However, at some point I got fed up with it and searched for a better product. Especially since I didn’t care about the other protocols anymore I could search for a pure torrent client. Many of them only support running as a client with some kind of fancy GUI… not good for running on our server. But then I found Rtorrent.
While it was a bitch to run on my server since it demanded to run in a terminal (and therefore refused to run under daemontools) — a problem I made bearable by running it in screen under a new user that was accessible through ssh keys — it worked very nicely. I had it running with a web interface called wtorrent.
But then yesterday I got very needy and demanded that it used IPv6 to connect to others. Sadly it fails to do that. Don’t know if it’s a configuration problem or simply because the author doesn’t have enough time to fix it. I tried the latest development builds and compiling it with –enable-ipv6, but it doesn’t seem to listen. In other words: time for a new client.

So after some searching I ran into Deluge. It seems to fulfill all my requirements, so I decided to give it a shot. A few bonus points are immediately earned because Deluge uses the more commonly used libtorrent, not to be confused by the other libtorrent that rtorrent uses. The bonus points are because the rasterbar libtorrent has plugin support among things and in general is a bit more up to date on the whole torrent protocol as far as I can tell. (makes you wonder why rtorrent doesn’t use it).
Time for installation!
Slackbuild had no problems chewing through libtorrent and spitting out a nice slackware package. However, Deluge is built in python so some manual work to get a package from it. (I seriously need to get some time to work on slackbuild to support this stuff).

root@Uil:/usr/src/deluge-1.2.0_rc3# mkdir pkg
root@Uil:/usr/src/deluge-1.2.0_rc3# python install --root `pwd`/pkg -O2
*blabla compile blabla*
root@Uil:/usr/src/deluge-1.2.0_rc3# cd pkg/ && makepkg /usr/src/packages/deluge-1.2.0rc3-i386-1.tgz

Voila, a nice package. After installing it, and creating a new user for it, it was time to see if it would work in daemontools.
However, I didn’t check any dependencies so trying to run the deluge program failed:

Traceback (most recent call last):
File "/usr/bin/deluged", line 8, in
load_entry_point('deluge==1.2.0-rc3', 'console_scripts', 'deluged')()
File "/usr/lib/python2.6/site-packages/", line 277, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.6/site-packages/", line 2180, in load_entry_point
return ep.load()
File "/usr/lib/python2.6/site-packages/", line 1913, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/lib/python2.6/site-packages/deluge/", line 47, in
import deluge.common
File "/usr/lib/python2.6/site-packages/deluge/", line 66, in
import xdg, xdg.BaseDirectory
ImportError: No module named xdg

Meh, xdg… fine. Fortunately python has easy_install as perl has cpan, so I installed a bunch of required things for it (like twisted, pyopenssl, chardet, mako). For xdg easy_install didn’t work though, so I handed it to easy_install using this url. After this it started up, even in daemontools! Another success.
For those who are interested, my daemontools run file looks like this:

exec 2>&1
sleep 1
set -e
export HOME=/mnt/general_stores2/deluge
cd $HOME
exec setuidgid deluge /usr/bin/deluged -d -c $HOME/etc -i eth_local -L info

You obviously need to adjust the paths and interface and whatnot to your own ideals 😉
After starting it for the first time it created some configuration and state files and is now waiting for connections. Woohoo.

So now, how do we connect to it? Seems like the web interface isn’t running yet. This is because deluge uses a client/server model where the daemon does
all the work, but it doesn’t deal with the interface side. So to run the web interface we have to start a separate deluge process. Let’s also put that in daemontools:

exec 2>&1
sleep 1
set -e
export HOME=/mnt/general_stores2/deluge
cd $HOME
exec setuidgid deluge /usr/bin/deluge -c $HOME/etc -L info -u web

After firing this one up you can connect using your browser on port 8112. Default password is deluge. After logging in you get the connection manager which shows the running daemon that you started up earlier. (or at least, that’s what it did here):

Deluge Connection Manager

Deluge Connection Manager

So have fun! Don’t forget to check out the plugins:

:, , ,

Leave a Reply

You must be logged in to post a comment.


  • 2018 (1)
  • 2016 (1)
  • 2015 (7)
  • 2014 (4)
  • 2013 (11)
  • 2012 (27)
  • 2011 (26)
  • 2010 (25)
  • 2009 (68)