Raspberry pi as network torrent downloader with Transmission

I wrote an article about transforming Raspberry Pi into a NAS to share files on a local network with an external usb storage: see technical details there, for brevity here just suppose you’ve a Raspberry PI  on local network with a USB drive attached.

Since Raspberry PI has limited resources, my choice go to Transmission daemon. It’s a very light version of Transmission running as a service (daemon) in background. There are different client available, but I use the Web interface:

Web client

Using web client, I can start and stop and download torrents within the local network and, if you expose raspberry in the DMZ and use a static IP or a dyndns, from everywhere you are.

Let’s install! On root console, type:

# apt-get install transmission-daemon

Edit the configuration file according to your filesystem:

# nano /var/lib/transmission-daemon/info/settings.json

Change “download-dir” and “incomplete-dir” into different directories on your external usb device, something like /media/MYDRIVE/mydownloaddir and /media/MYDRIVE/myincompletedir.

I also changed:

  • “rpc-url”: “/mysecretpath/”
  • “rpc-username”: “mysecretuser”
  • “rpc-password”: “mypassword” note: this will be hashed at the transmission restart
  • “rpc-whitelist”: “127.0.0.1,192.168.*.*,*.*.*.*” warning: copy the *.*.*.* only if you want to expose your Raspberry PI publicly on the Internet.

I leave unchanged:

  • “rpc-port”: 9091

Before restarting transmission, copy the configuration file somewhere as a backup copy, because sometimes Transmission overwrite it badly.

Restart transmission:

# service transmission-daemon restart

Now you should reach web interface in this way:

http://RASPBERRY_PI_LOCAL_IP:rpc-port/rpc-url/

e.g.

http://192.168.0.5:9091/mysecretpath/

or using the host name, for raspbian “raspberrypi”:

http://raspberrypi:9091/mysecretpath/

Typing username and password you can start to add torrent using the first icon on the left (Open torrent):

upload

Uploading a file from your local filesystem or providing a torrent url from an external service.

Important note: please remember that Raspberry PI has limited resources. Do not start too many torrents at once because hash calculations are cpu intensive.

After you finished download, seed for a while and then clear the completed items (right click to show options) you’ve already downloaded to keep Transmission running smoothly.

See also

Advertisements

27 thoughts on “Raspberry pi as network torrent downloader with Transmission

  1. chickenbeef

    Hey, thanks for the great guide. Almost got it working 100% on my Pi but I can’t seem to change the download location from the Pi’s SD to my flash drive (/media/PI/Downloads). I’m using Raspbian as the OS.

    First I got an error saying there was no space on the flash drive (But there was enough) so I reinstalled raspbian and setup transmission again. Now I get a “Permission denied (/media/PI/Downloads)” error in transmission, I’ve tried setting permissions with the following commands –

    sudo chmod g+rw /media/usbstick
    sudo chgrp -R debian-transmission /media/usbstick

    but it says operation not permitted.

    Could you please help me with a possible solution?

    Reply
    1. chirale Post author

      Just create a directory “downloads” mkdir mydownloads and then chmod 777 mydownloads. Is the filesystem writeable? If not, is the drive you’re trying to mount formatted with NTFS? If it’s NTFS, try to read this howto, a pingback about my previous article about Samba. If it isn’t your case, try to reboot your RaspberryPi with the drive attached. When the windows system starts, your drive will be mounted and should be writeable by pi. Hope it helps.

      Reply
  2. chickenbeef

    Update:

    Managed to get it working by formatting my flash drive as NTFS and unmounting it then manually mounting it with the owner as transmission. Downloads without any errors but now my problem is that after a reboot or if I unplug the flash drive and plug it in then it auto mounts with the owner as “pi” not transmission. Any idea how to change this/work around it?

    Thanks!

    Reply
    1. chirale Post author

      You shouldn’t have to mount the drive as transmission, pi should be fine. My FAT filesystem works well with automounting as pi. 1) I power on Raspberry PI 2) after windows system starts, the drive is automounted 3) I open a shell and I run the transmission daemon as pi: pi@raspberrypi ~ $ service transmission-daemon start . Try to take a look to the previous reply for NTFS specific questions.

      Reply
      1. chickenbeef

        Yeah, I’m not sure why it doesn’t work on my side when the drive is mounted as pi. I even tried Deluge and it gave the same error about not having permission to write to the drive.

        I edited my fstab so when it boots up it mounts my flash drive with owner as Deluge.

        /dev/sda1 /media/PI1 ntfs-3g auto,gid=deluge,umask=0 0 0

  3. cmonnats23

    Setup is ran beautifully and everything seems to work great. However, running into an issue on my PC. When I go to the link i created, enter the username and password, i get a “409: Conflict” error on the screen along with some ‘to fix this…’ messages. I dunno what I did wrong. Anyone want to help me? I will respond with more details if someone responds! Thanks!

    Reply
    1. chirale Post author

      Try to force reload of the page (Chrome: CTRL+Shift+R) or use a new anonymous session to get the rid of the cache. Then re-enter credentials and the error should disappear. If not, you’re not alone: many users are experiencing this problem, try to google: “409 site:transmissionbt.com” and get the more recent posts using search filters. This is one of these posts. Hope it helps.

      Reply
  4. Quiff

    Is it possible to log in this way?

    user:password@http://192.168.0.4:9091

    Only I have a TV with internet and when you go to it in the normal way you get requested for login details to which you can’t get to the keyboard to enter?

    Reply
    1. chirale Post author

      It is: http://user:password@LOCAL_IP:9091. If you have DHCP and you want to expose your raspberrypi on the Internet I suggest to give RaspberryPi a domain through dynamic DNS like freedns.afraid.org and use the auto-update script to avoid to remember LOCAL_IP and to access RaspberryPi everywhere.

      Reply
  5. Neo

    Hi chirale,
    I am very new to linux and stuck at the very first step. I get the following error. Can you please help.

    root@raspberrypi:/home/pi# apt-get install transmission-daemon
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package transmission-daemon

    Reply
    1. chirale Post author

      Hi Neo, try to update the package list using sudo apt-get update and then sudo apt-get install transmission-daemon. You can try to search the package using apt-cache search transmission and then choosing the right name from the list. Hope this helps.

      Reply
  6. Mikkel Jürs

    Hey Chirale, I know this is abit off, as you’re making the Pi a NAS, but I have a NAS, and I’d love it to store files down on that – as I’m using my NAS as a very central part of my network. When storing on a flash drive you use the /media/, is there any way to make it storing down on my NAS? It’s on the Windows SMB network in WORKGROUP. 🙂

    Reply
    1. chirale Post author

      So you want to run transmission on RaspberryPi and then write downloaded files on your NAS? Then this howto by JST Lawrence can help you. Basically, you’ll mount a samba path (with credentials if any) into a new mountpoint /mnt/YOURNAS and then you can use it like the previously cited /media/MYDRIVE/mydownloaddir mountpoint. Have fun and please reply here about how you solve this issue.

      Here a sample of a fstab entry to a Windows Public directory:
      //192.168.0.111/Users/Public /mnt/winpublic cifs defaults,rw,username=yourusername,password=yourpassword,domain=WORKGROUP 0 0
      Where 192.168.0.111 is your NAS address and yourusername and yourpassword are your credentials.

      Reply
  7. Linux Virgin

    thank you for this much needed guide! just got my Pi today and it’s my first time ever using linux! so i’m having a hard time.. thing is i setup the config file and save/writeout no problem, but when i restart the daemon and read the file again it’s all back to default! i’m currently setting up the config file as root, will try again as the pi user. any and all help is much appriciated!

    Reply
  8. Mikkel Jürs

    Hey Chirate, I now came to the steps I asked you about abit above. When ever I go “sudo nano /etc/fstab” and put in the line: “//10.0.0.7/share/Download /mnt/winpublic cifs defaults,rw,username=admin,password=password,domain=WORKGROUP 0 0” and then I sudo mount -av then it pops up with: “couldn’t chdir to /mnt/winpublic: no such file or directory.

    I tried it with smb://nas/share/Download instead of //10.0.0.7, inside the filemanager I can access the NAS with both smb://nas and 10.0.0.7 (with no forward slash), when I accessed the nas through filemanager, I didn’t have to type in any credentials, so I tried it without the username and password. The Domain is WORKGROUP 🙂

    Any clue why it won’t make a permanent directory?

    Regards
    Mikkel

    Reply
      1. chirale Post author

        That’s right, It’s the way mount works, read a device an put in in an existing folder aka “mountpoint”. Thank you for visiting!

  9. minky

    You may want to add “service transmission-daemon stop” BEFORE editing the “settings.json” file, otherwise transmission will just overwrite it. I hope this helps other newbies like myself getting transmission to run, and thank you for the helpful article 🙂

    Reply
  10. john

    really nice tutorial.
    i am having an issue with the rpc-whitelist. i add my network 192.168.1.* and save it, but it keeps only the 127.0.0.1. any ideas since i am not able to see it from my network?

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s