Thursday 28 July 2011

Installing a BitTorrent client on the Pogoplug

The Pogoplug can be turned into a dedicated BitTorrent client by following the steps below.


1. PREREQUISITES
As a prerequisite of this article, please complete the steps described in my previous post here in order to prepare your Pogoplug so you can install packages using the IPKG package management system.


2. INSTALLING THE BITTORRENT PACKAGE
To install the Transmission BitTorrent client, SSH to your Pogoplug and perform the following:

# install transmission
/opt/bin/ipkg install transmission
# start transmission in order to generate a default configuration file
/opt/bin/transmission-daemon
# stop the transmission process
killall transmission-daemon
# make a new configuration directory to hold the transmission configuration files
mkdir /opt/config
# move the freshly generated transmission configuration files off of the main flash drive and onto the spare flash drive
mv /root/.config/transmission-daemon /opt/config/
# move into the transmission configuration directory
cd /opt/config/transmission-daemon/
# backup the generated configuration file
cp settings.json settings.json.backup

3. CONFIGURING THE BITTORENT CLIENT
At this point, the Transmission BitTorrent client is installed on your Pogoplug, congratulations! Now we need to decide on a location for torrents to be downloaded to. To do this, perform the following (in a terminal session):

# Display disk usage
df -h
and observe the output. This command lists hard drives connected to the Pogoplug, as well as any mounted internal flash drives. You can choose any drive to download to, but I would advise a connected USB hard drive to prevent unnecessary reading of the flash drive, and also help prevent filling up the internal flash drives (which can lead to boot problems).
Anyway, you should see something similar to this:

-bash-3.2# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/mtdblock2           32.0M     14.4M     17.6M  45% /
none                    125.0M      3.2M    121.8M   3% /tmp
/tmp/.cemnt/sda1        916.9G    435.1G    472.5G  48% /tmp/.cemnt/mnt_sda1
/dev/mtdblock3           91.0M     14.7M     76.3M  16% /opt

The USB drives connected to your pogo plug will be mounted under "/tmp/.cemnt/". In my case, I chose the following destination folder (which already existed on my Pogoplug):


/tmp/.cemnt/mnt_sda1/My Documents/Downloads/


Now we will update the Transmission configuration file to use our selected directory. To edit the file, enter the following:

# Enter a text editor to edit Transmissions settings.
vi /opt/config/transmission-daemon/settings.json
You will need to update the following keys with your selected download directory: "download-dir", "incomplete-dir".


4. RUNNING THE BITTORENT CLIENT
To start the BitTorrent client, run the following:

# Start the Transmission client, pointing the application to the custom configuration directory
/opt/bin/transmission-daemon --config-dir /opt/config/transmission-daemon/

You should now be able to access the web interface for the BitTorrent client by entering the following into a browser on a device in the same local network as your Pogoplug:


http://pogoplug:9091/transmission/web/


Replacing "pogoplug" with the IP address/domain name of your Pogoplug device.
Your Pogoplug is now running a BitTorrent client :)


UPDATE: See my new post on how to allow for adding new torrent files from the my.pogoplug.com website :)



31 comments:

  1. Hi,

    I was doing ok until the vi /opt/config/transmission-daemon/settings.json bit and then I don't know what to do. I had to close putty to get out of it.

    Ben

    ReplyDelete
  2. Great! Must know some SSH to do this correctly. Also, is Transmission-daemon set to start automatically on reboot? Please advise. Thanks!

    Zac
    bestbusinesses@gmail.com

    ReplyDelete
  3. Hi Ben,

    Vi is a text editor. It can take a little while to learn how to use, mainly due to the fact that it is controlled entirely by keyboard commands. However, if you are interested in spending the time learning how to use it, you will (hopefully) find that it is incredibly fast to write with.

    There are plenty of online tutorials; Google "vi tutorial" or take a look here http://www.unix-manuals.com/tutorials/vi/vi-in-10-1.html.

    Alternatively, if you do not wish to learn how to use Vi, you can run the following on your Pogoplug to install a different (and probably more straight-forward for beginners) text-editor, Nano:

    /opt/bin/ipkg install nano

    Then you can edit the Transmission config file using:

    /opt/config/transmission-daemon/settings.json

    Hope that helps :)

    Aaron

    ReplyDelete
  4. Hi Zac,

    Transmission-daemon will not start automatically after rebooting. However, you have a couple of options to achieve this:

    OPTION 1: Create a bash script to start your manually installed services. Something like:

    # Create a startup script
    touch /etc/startup.sh

    # Edit the startup script
    vi /etc/startup.sh

    Then you could add the following to the startup.sh contents:

    # Mount the spare internal flash drive
    mount -o remount,rw /
    mount /dev/mtdblock3 /opt

    # Start the Transmission daemon
    /opt/bin/transmission-daemon --config-dir /opt/config/transmission-daemon/

    After each reboot you would simply SSH onto the Pogoplug and run the following:

    /etc/startup.sh


    OPTION 2: (NOT RECOMMENDED) Edit the startup bash script, found at "/etc/init.d/rcS". You could add the contents of startup.sh (above) into this script, then your services will start automatically when the Pogoplug boots.

    I don't recommend this method - if you make a typo in the rcS file, you could find that your Pogoplug will not boot.

    Based on how often you need to reboot your Pogoplug (I'm guessing not that often?), I would go with the first suggestion.

    Kind regards,

    Aaron

    ReplyDelete
    Replies
    1. I found one error with the above instructions on the startup.sh file. I found that in order to overcome the permission denied error I had to use:

      chmod 755 startup.sh

      I also found that after I had tested it a few times and was confident, I took a chance on adding it to the rcS file and it works like a charm.

      thank you ever so kindly for the instructions.

      Delete
  5. This guide works like a dream. I know almost nothing about Unix/Linux, other than a few vi commands.

    My next challenge is to get Samba running. Are you still going to tackle this at some point, and do you think it should be possible without installing something like openpogo?

    Once again, thanks for your work so far, and I'll be following your updates closely now :-)

    Andy Bailey

    ReplyDelete
  6. Hi Andy,

    Thanks for the positive feedback :)

    I certainly will create a blog post for Samba setup, and you can definitely install Samba on the Pogoplug without OpenPogo (this is exactly what I've done).

    The Samba install/setup is very straightforward, I'll do my best to get a post out in the next day or two.

    Cheers,

    Aaron

    ReplyDelete
  7. Hi Andy,

    Please see the following post for instructions on installing Samba on the Pogoplug. Let me know how it goes :)

    http://aaronrandall.blogspot.com/2011/10/installing-samba-on-pogoplug.html

    ReplyDelete
  8. Aaron,

    The Samba installation works like a dream. It's a much better way of connecting than using the Pogoplug application. Thank you.

    I only have one other question:

    In one of your replies, you recommended the use of a bash file (/etc/startup.sh) to restart Transmission. I've used that file, and also added a line to start Samba.

    I went one step further, and added /etc/startup.sh to the end of the /etc/init.d/rcS file, with the intention of starting the applications automatically, but avoiding the chance of typos.

    Doing it this way starts Samba with no problems, but Transmission always fails - it's running, but if I check using a web browser, it gives a message against each torrent stating that the download directory can't be found. If I restart Transmission that all is fine. Equally, if I remove the line from /etc/init.d/rcS and run it from putty, it works that way too.

    Am I missing something here? I wondered whether the Pogoplug took a while to re-map the drives, so at the time of launching Transmission the download directory wasn't available. As I said before, I don't really know Linux, so don't want to mess anything up. I just thought it would be easy to get everything to start as soon as power was restored. Any ideas?

    Again, many thanks for your postings, they've been a great help.

    Andy Bailey

    ReplyDelete
  9. Andy,

    Unfortunately I'm not using the rcS file (out of fear of bricking my device), so I can't test this issue. However, it may be an idea to post to the Pogoplug forums to see if anyone can help you there.

    It looks like this post also describes the issue where drives aren't mounted while the rcS file is running:

    http://goo.gl/6b4qu

    Sorry I can't be of more help. If you find a solution please post it back here :)

    Kind regards,

    Aaron

    ReplyDelete
  10. Heyyyy greaaaaat Aaron, thanks :)
    So far I thought I had to install some OpenPogo to use extra features (1st one was torrent client; 2nd one would be the ability to use attached drive as any other network drive, through SMB for ex.)

    Btw, could you give me any idea on how to mount a network drive onto the pogo? On the same network I have a drive accessible through SMB?

    Huge thanks in advance!
    Bruno

    PS: I'll have a look on how to restart all services when device reboots (mine is not so stable: have to reboot it 2 to 3 times a week)

    ReplyDelete
  11. update: to use USB attached drive on the network, I found how to and installed SMB server.

    To mount SMB disk, it seems more tricky: you need to install SMB client and it's getting more complicated... but I'll try ;p

    ReplyDelete
  12. Hi Bruno,

    Glad to hear you found the post useful!

    Apologies for the delay in replying, I've been without Internet access for a few days while it's being upgraded, and will be offline for a few more (sending this from my phone).

    I can check once I'm back online, but I believe that I've accomplished something similar using "smbmount". It might be worth looking through the Ipkg package list for "smbmount" or "smbfs".

    Let me know how it goes :)

    Aaron

    ReplyDelete
  13. Hi Aaron!

    Thanks for you kind feedback :)

    In fact, I gave up with the SMB mounting: I finally attached the other drive to the Pogoplug. In my config that was simplier.

    First I have to say that SMB server + bittorrent server were running fine while pogoplug services were still available.

    Now I have a problem. Today I had to reboot the PP because PP services were not available anymore (orange light): this used to happen many times a week (what make me say that PP is not really a stable device/service), so it didn't surprise me. But after having rebooted, my drives were not mounting anymore, in the PP app, but in fact on the system itself (df -h gives me none of my 2 disks). But when I check with "cat/proc/scsi/scsi", then I can see my drives.

    I'm now looking about that issue and trying to find a way to create a script or sthg to auto-mount the disks and to start the 2 servers. Help would be appreciated :-p

    Take care,
    Bruno

    ReplyDelete
  14. Hi Bruno,

    The standard Pogoplug services should take care of mounting your drives for you - I'm not sure that mounting them yourself will solve the issue.

    Have you considered requesting a replacement Pogoplug? If your device is within a year of purchase, you're probably entitled to a replacement under warranty. Maybe a new device will be more stable (my Pogoplug does not need rebooting, it "just works").

    I would suggest an email to support@pogoplug.com, they seem pretty responsive.

    Let me know how it goes.

    Aaron

    ReplyDelete
  15. Hi Aaron,

    I am getting this error after the install "Error:
    Unable to save resume file: Read-only file system
    "
    Any suggestions?

    Thanks in advance.
    David

    ReplyDelete
    Replies
    1. Hi David,

      I have a few questions for you which may help us to resolve this issue:

      What Pogoplug version do you have?
      What user are you SSHd to the Pogoplug as? (root?).
      Did you remember to remount the root disk with read-write permissions? ("mount -o remount,rw /").
      Are you definitely starting the Transmission Daemon with the custom config path? ("/opt/bin/transmission-daemon --config-dir /opt/config/transmission-daemon/).

      Cheers,

      Aaron

      Delete
  16. Hey Aaron. Everything seemed to go just fine in this tutorial except after all said and done and i go to the website it only shows me this...

    403: Forbidden

    Unauthorized IP Address.

    Either disable the IP address whitelist or add your address to it.

    If you're editing settings.json, see the 'rpc-whitelist' and 'rpc-whitelist-enabled' entries.

    If you're still using ACLs, use a whitelist instead. See the transmission-daemon manpage for details.

    I vi back to the file and it says nothing about whitelists. Any thoughts? Thanks for all your help.

    ReplyDelete
  17. Ok so it looks like I got transmission working from playing in vi. I have posted some questions on this post and on your samba post that i am still unsure of though! Thanks in advance.

    -Danny

    ReplyDelete
  18. Aaron, I too had this issue and it has semi-morfed into a different one :P I realized that in my.pogoplug.com there was a blue exclamation mark next to my drive that said it was ejected improperly. I followed the steps in correcting it. After that I was fine. I could see my drives using df -h, I could even create folders and move things around on my computer. But now my issue is, every time I launch transmission, it freezes. The torrents in transmission freeze and don't progress. Trying to ssh into the device freezes and the only option is to pull the plug to eliminate power to the pp. I have started the Daemon, I can access transmission via website and add a torrent, but after seconds of the torrent being started, everything comes to a screeching halt. Any suggestions?

    (Hopefully I have answered Davids question as it seems that was my initial issue as well. Running disk utility on my mac and reinserting the drive into the PP worked for that)

    Thanks again,
    Danny

    PS. All of your tips on the SAMBA page have worked great. All i need now is to button up this transmission business!

    ReplyDelete
    Replies
    1. Hi Dan-I-el,

      Great news you managed to find the solution to your HD issues.

      With regards to Transmission crashing, perhaps you could try running the Transmission daemon with debug output, that might give a clue to what is causing it to freeze.

      Try starting Transmission with the following:

      /opt/bin/transmission-daemon --config-dir /opt/config/transmission-daemon/ --log-debug

      Then with a terminal open, access the Transmission webpage and try and start a torrent. Report back here with the debug output (copy and paste it from the terminal) and I'll see if I can help you resolve this issue :)

      Regards,

      Aaron

      Delete
  19. Aaron, great post. But some clarification please... I have a Pogoplug Pro (the one with wifi) and want to use it both as a Pogoplug device and a bittorrent client. Is that possible by the method you've described above?

    What's confusing me is that most tutorials online talk about installing OpenPogo (or it's new avatar, the ArchLinuxARM) and completely replacing Pogoplug functionality (like streaming to PS3 and using the iOS app to access the pogoplug), while your tutorial doesn't say anything about loosing the pogoplug basic OS.

    Can you please explain?

    ReplyDelete
    Replies
    1. Hi Nitin,

      The method I have described keeps all of the existing Pogoplug functionality intact, so you can continue to use the streaming to PS3 and iOS app alongside the Transmission server. I haven't tested these steps on a Pogoplug Pro so I can't comment on whether they will work with that particular model.

      Let me know how it goes :)

      Aaron

      Delete
  20. Hi Aaron,

    thanks for your posts, with your instructions everything works very well! :-)
    Right now I'm adding more and more packages to my Pogoplug Pro and do some testing with a .sh startup script. But I don't want to log in manually everytime to launch this one cause my Pogoplug doesn't stay on all the times... On the other side, I don't want to modify the rcS-file too much. Is it possible to just add the line with the startup-script to the rcS-file? So I could work out eveything until it's "perfect" and then just add one single line and I'm done :-)

    And if I mess up that rcS file, is there a way of restoring it?

    Thanks for your help! :-)

    ReplyDelete
    Replies
    1. Hi Achim,

      As you say, you can create and test the script before integrating it with your rcS file - sounds like a good idea :)

      Then when you are happy, simple add a single line to run that script at the end of your rcS file. Make sure that the script exists under the root ("/") and not on /opt/ (as "opt" won't necessarily exist straight away).

      With regards to restoring the rcS file, I suggest that you take a backup of the file before modifying. If something goes wrong but your Pogoplug isn't broken enough to prevent SSH access, then you'll be able to restore from backup. Personally, I haven't required the need to modify the rcS file (as I very rarely reboot), however it appears that other users (see comments above) have successfully used the startup.sh script I recommended from within their rcS file, so hopefully you should be ok.

      Let me know how it goes :)

      Aaron

      Delete
    2. Hi Aaron

      I just tested it as mentioned above and it works great :-) no hassle with that rcS-file, I think starting the script on the last line is the safest way.

      So now I'm totally happy with this thing as I can just turn the power on in the morning, send some torrent-files to it (using my phone) and come back in the evening with a bunch of new stuff :-)

      Thanks again for your great blog!

      Delete
    3. Great stuff Achim, glad to hear it! And thanks for reporting back :)

      Any new questions or comments, please head over to my new blog:

      http://aaronrandall.com/blog/

      And for this post in particular:

      http://aaronrandall.com/blog/installing-a-bittorrent-client-on-the-pogoplug/

      Take care,

      Aaron

      Delete
  21. I have a pogoplug series 4 and when I did the optware install on a usb drive, ipkg works, installs transmission, but when I go to start transmission-daemon, nothing happens, no error, nothing...then I do a ps -a and a netstat to see if it's running, it is NOT. the settings.json file is there but isn't automatically created since the daemon won't run, but gives no errors.

    ReplyDelete
  22. Hi Aaron. I've gotten an amazing SMB server running thanks to you, but I've been seeing consistent issues when running transmission. Sometimes it works great, but other times it crashes the SMB server, and pogoplug services at first download. The torrent url works, the download folders are all set appropriately, but for some reason Transmission keeps causing a crash. If you have any ideas on troubleshooting these issues I'm all ears and would love to work through them. I've had Transmission and the Upload watch folder trick working and it's awesome and would love to get them working for the long haul.

    ReplyDelete