Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to torrent on Raspbmc using Transmission

📅 2014-Jul-05 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ raspberry pi, raspbmc, torrent, transmission ⬩ 📚 Archive

Raspberry Pi can be converted into a capable HTPC by installing Raspbmc on it. It can be further used to download torrents by using Transmission. I mostly used the steps from this guide, though I had make some extra customizations to get it working. I have described the steps that worked for me below.

Setup the hardware

Raspbmc is typically installed on a SD card. Storage left on this card may not be enough to download and store big files. To extend the storage I used a portable harddisk. The Raspberry Pi is not powerful enough to provide power to the harddisk through its USB port.

So, I bought a USB hub that is powered from electricity using a power adapter. I connected this hub with its USB cable to the Raspberry Pi. I connected the harddisk to this hub using another USB cable.

I powered on the Raspberry Pi. After login into the Pi using SSH, I could see that Pi had detected and mounted the harddisk by using the command df. I noted down the mounted path of the harddisk, in my case this was /media/foo-disk.

Note: The USB hub may have many ports, but do this setup connecting only the harddisk. If that works fine, try connecting other additional devices, for say charging, to the hub. If you notice that your harddisk gets unmounted by the Pi after a while, then this might mean that the USB hub can only power one device, i.e., your harddisk. This is what I noticed with my hub and so I only use it to connect the harddisk.

Setup Transmission

$ sudo apt-get install transmission-daemon
$ sudo service transmission-daemon stop
$ cd /media/foo-disk
$ mkdir downloading
$ mkdir finished
$ sudo vi /etc/transmission-daemon/settings.json

The description of the various configuration parameters in this file can be found here.

"download-dir": "/media/foo-disk/finished",
"incomplete-dir": "/media/foo-disk/downloading",
"incomplete-dir-enabled": true,
"rpc-password": "raspberry",
"rpc-username": "pi",
"rpc-whitelist-enabled": false,

Note that Transmission will replace the text password you typed here with its hash after the daemon is started.

$ sudo update-rc.d transmission-daemon defaults
$ sudo service transmission-daemon start


Permission denied

The daemon needs permission to write to the harddisk. If not, you may see a Permission denied error in the web interface when the daemon tries to write to the harddisk.

$ sudo chown -R debian-transmission /media/foo-disk/downloading
$ sudo chown -R debian-transmission /media/foo-disk/finished
$ sudo vi /etc/init.d/transmission-daemon

and edit the line in it to:


Hard disk getting dismounted

The harddisk mounted by Raspbmc might get automatically dismounted if there is no activity for a few minutes. When this happens, Transmission fails with an Input/Output Error. To prevent this, I added a cronjob that creates a file after 4 minutes and deletes it after 5 minutes. To do this run:

$ sudo crontab -e

This opens a cronfile in the nano editor. Go down to the end of the file and add these two lines and save the file:

*/4     *       *       *       *       rm /media/foo-disk/keepMeUp.txt
*/5     *       *       *       *       touch /media/foo-disk/keepMeUp.txt

That is it, this worked fine on my Pi. I hope it does for you too 😊