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
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.
- First, I installed the Transmission daemon on the Pi:
$ sudo apt-get install transmission-daemon
- After installation, the daemon is automatically started. Since I need to setup the daemon correctly, I stopped it:
$ sudo service transmission-daemon stop
- I created two directories on the harddisk: one to hold the files whose download is in progress and another to hold the completed downloads. Transmission can be setup to use the former while downloading and move them to the latter when finished.
$ cd /media/foo-disk $ mkdir downloading $ mkdir finished
- I opened the settings file of Transmission to make the changes:
$ sudo vi /etc/transmission-daemon/settings.json
The description of the various configuration parameters in this file can be found here.
- I edited the following parameters in the file:
"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.
- As one last step, I setup the daemon to be started whenever Pi boots up:
$ sudo update-rc.d transmission-daemon defaults
- I now started the daemon with the new settings:
$ sudo service transmission-daemon start
- The web interface of Transmission can be accessed from any computer in the network using the IP address and port
9091. You might want to configure your Pi with a static IP address to make this easier. For example, my Pi is at address 192.168.0.10 and so I access Transmission by typing in the browser:
Note that the web interface is fully configurable. Other than the buttons on top and the bottom, you can also right-click to get context menus. In the settings, you can even configure Transmission to download only at certain times of the day. This is perfect if you do not want your TV viewing in the evening interrupted by torrent downloading in the background.
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.
- The daemon writes to disk as the user
debian-transmission. One solution is to give this user write permissions to the directories on the hard disk:
$ sudo chmod -R debian-transmission /media/foo-disk/downloading $ sudo chmod -R debian-transmission /media/foo-disk/finished
- Another brute-force solution suggested online is to:
$ 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🙂