Monday 12 March 2012

POGO-E02 (PINK) as a local samba server for XBMC

I wanted to shout out a few instructions that I compiled to be able to build a new Samba Share on my new POGO-E02.  Before I begin, I would like to offer a few words of caution.  I bricked a POGO-E02 experimenting (I am pretty sure it had to do with the Arch Linux installation that I later chose not to use in favour of the description below).  You too can brick that pretty pink or grey thing on your desk, so please embark on this little escapade at your own risk. 


Now I wouldn't be writing this little how to if it wasn't for the amazing help of Aaron Randall.  His blogs were the simplest and easiest to follow of the countless hours I spent hunting this stuff down.  I tip my hat to him and thank him kindly for taking the time to provide his expertise.  Aaron's blog can be found at http://aaronrandall.blogspot.com


First the back story...
So I wanted a simple way to share multiple external hard drives across my local network.  My particular need for this little guy was to be able to provide all of my family home movies as a share to several AppleTVs featuring XBMC.  I wasn't happy with the uPNP that comes resident on the POGOPLUG as it wouldn't work with the home movies that I had.  So my configuration has 4 x 4TB external hard drives plugged into the POGOPLUG  (I have a lot of recorded TV shows from OTA DTV).  The POGOPLUG is connected to a 1,000 mbit ethernet switch and I have two (2) AppleTVs (2nd generation) that are jailbroken with XBMC installed.  


So the goal of the POGOPLUG was to provide a bulletproof SAMBA share of my existing external hard drives without the use of a noisy power sucking computer.  I spent an entire weekend working through this including the bricking of a POGOPLUG and arrived at what I think is a pretty elegant little setup.  So elegant in fact that I am hoping to duplicate the setup for my father and mother in law (who aren't very technically savvy).  


I normally don't blog, but I found that for what is a relatively simple process, there is remarkably little information readily available.


So without further adieu, please see the process I followed below:


  1. Find your POGOPLUG ip address.  I found this by going to my internet gateway and looking in the DHCP table for an entry that matched the MAC ID on the bottom of the POGO.  In my case this was a 192.168.0.# number.  Write this number down.
  2. Log into your POGOPLUG online account that you created during the initial setup of the POGO.  Go into the advanced tab / Security.  Make sure that "Enable SSH access for this Pogoplug enabled device" is clicked.  Also keep the password handy for reference.  (if you didn't put a password in, it is "ceadmin"
  3. Use your favourite SSH protocol to login to the POGO.  My favourite is putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/)
  4. Using your favourite SSH protocol to the IP Address from 1. and the password you have you will connect to the POGO as "root" and "ceadmin" or "your password"
  5. The following instructions are a credit to Aaron Randall.
mount -o remount,rw /


mkdir /opt


mount /dev/mtdblock3 /opt


cd /opt


wget http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/ipkg-opt_0.99.163-10_arm.ipk


tar -xOvzf ipkg-opt_*_arm.ipk ./data.tar.gz | tar -C / -xzvf –


mkdir -p /opt/etc/ipkg


echo "src cross http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable" > /opt/etc/ipkg/armel-feed.conf


echo "src native http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/native/unstable" >> /opt/etc/ipkg/armel-feed.conf


/opt/bin/ipkg update



# Install samba server*************************************************
/opt/bin/ipkg install samba2

# Navigate to the samba config directory*******************************
cd /opt/etc/samba/

# Backup the default configuration file********************************
cp smb.conf smb.conf.backup 

# Edit the configuration file******************************************
vi smb.conf  # or use nano below

# Install nano text editor*********************************************
/opt/bin/ipkg install nano


# Edit the configuration file******************************************

/opt/bin/nano /opt/etc/samba/smb.conf


#insert the following information into the smb.conf file***************
[global]
        workgroup = workgroup
        server string = Pogoplug Samba2 Server
        hosts allow = 192. 127.  # you may need to put 10. here
        null passwords = yes
        guest account = root
        log file = /opt/var/log/samba/log.%m
        max log size = 50
        security = share
        encrypt passwords = yes
        smb passwd file = /opt/etc/samba/smbpasswd
        dns proxy = no
        preserve case = yes
[External]
        comment = external hd
        path = /tmp/.cemnt/
        available = yes
        public = yes
        writable = yes
        printable = no
        create mask = 0777
        guest ok = yes
        browseable = yes
[sda1]
        comment = sda1 hard drive
        path = /tmp/.cemnt/mnt_sda1/
        available = yes
        public = yes
        writable = yes
        printable = no
        create mask = 0777
        guest ok = yes
        browseable = yes
[Root$]
        comment = root
        path = /
        available = yes
        public = yes
        writable = yes
        printable = no
        create mask = 0777
        guest ok = yes
        browseable = yes
#end of smb.conf file*********************

#testing the smb.conf file*****************************************
/opt/bin/testparm

# Start the Samba Server*******************************************
/opt/etc/init.d/S80samba start

# Restart the Samba Server*****************************************
/opt/etc/init.d/S80samba restart

#subsequent adjustments to share information***********************
/opt/bin/nano /opt/etc/samba/smb.conf

# restart manually*************************************************
# this is necessary each time the power is cycled
mount -o remount,rw /
mount /dev/mtdblock3 /opt
/opt/etc/init.d/S80samba start



         6. So now everything should be setup and working and you should be able to see everything on the appleTV.  I first had some problems getting it to work in XBMC and discovered that if I used the IP address and the share (smb://192.168.0.#/sda1) it worked well.  Those problems are also what led me to making the root share named as [Root$] to make it hidden from XBMC.  You can of course adjust the smb.conf file can be configured in a multitude of ways to make it easier for you - google is a great resource here.
        7. The next issue is making the restarting of the pogo automatic.  I must urge extreme caution here.  If you make a mistake here, you may have a new door stop (and not a very good one since it is really quite lite).    So for the automatic restart, I would strongly suggest creating a script and testing that it works properly.  The following is the instructions that I followed and worked well for me:

#Create a script for startup options called startup.sh****************
touch /etc/startup.sh
/opt/bin/nano /etc/startup.sh

#startup.sh script
mount -o remount,rw /
mount /dev/mtdblock3 /opt
/opt/etc/init.d/S80samba start

#give the shell permission to execute the script**********************
chmod 755 startup.sh

#subsequent reboots***************************************************
/etc/startup.sh

    Once we are confident that the startup.sh script works properly and all of the shares are rebooting, we can consider (subject to my strong warnings) adjusting the rcS file and insert the startup.sh to start on bootup (similar to the autoexec.bat file, but more dangerous if you make a typo).  

#building startup.sh into startup sequence****************************
/opt/bin/nano /etc/init.d/rcS
#add "/etc/startup.sh" to the end of the "rcS" file and save**********


The above method has worked flawlessly thus far for me.  I have unplugged the power multiple times and each time the samba shares come back to life on the network.  
The beauty of this setup is that I can remotely view all of the files on the external drives, and my in-laws still have full use of all of the files.  Now I can upload family photos or home movies on demand to them without having to make a seperate trip to see them each time.  Not to mention the added benefit of having offsite backups.  The above setup preserves the full functionality of the POGO while allowing SAMBA sharing of the files across the network.  For full HD home movies that can be a bit of a bandwidth hog, I there have been no issues with buffering which is great news.  


I sincerely hope that the above has been helpful and hope you too enjoy your POGO as a very useful alternative to a full blown server!  Not bad for $50.


Please leave me a comment to let me know what you think - I enjoy the feedback and hope that you found this helpful.  


Thanks,
Marvels

10 comments:

  1. Hi!

    Thank you for the kind words, and I'm glad you find my posts useful :)

    Any chance you could update the link in your post to point to my new blog URL: http://aaronrandall.com/blog/

    That's where all of my new posts and comments go now.

    Many thanks,

    Aaron

    ReplyDelete
  2. Hey Marvel,

    Many thanks for the great post. I finally got up and running. Where I'm missing something is in the last step of connecting to Pogoplug from XBMC.

    When I go to add a SMB share, I can sometimes see my WORKGROUP and the Pogoplug listed there. When I try to add it, it times out and I get an "invalid argument" my other SMB shares from laptops show up and connect just fine though.

    When I try to manually connect via XBMC I put in my ip of 192.168.0.8 for the server and sda2 as the path for the drive with my content. For user I use root and for password I use the same password that I use for SSH access in terminal. However, when I hit "OK" it always takes me to another dialog box for "lock settings". I use the same username and password as before and check a box for "remember this path". I hit "OK" again and it waits a few seconds, then the same "lock settings" dialog pops up again. If I cancel out, but add the share anyway it looks like this ( smb://192.168.0.8/sda2 ) but of course doesn't let me connect. Just pops up the "lock settings" dialog again.

    My windows install of XBMC sees the workgroup and pogoplug and connects first try. Just Mac and IOS version are having some serious problems. I'm running Eden on both Mac and IOS and 10.1 from March 2011 on Windows.

    Any ideas? I'm so close, but also soooo stumped.

    I have the E-02 version, or at least that's what my sticker tells me.

    ReplyDelete
  3. nevermind I got it figured out. Thanks for the great resource.

    ReplyDelete
  4. For everybody who is struggling to install SAMBA on Pogoplug 4, Pogoplug Pro and Pogoplug Office here's a very comprehensive step-by-step idiot-proof tutorial: http://www.razva.ro/how-to-install-samba-on-pogoplug-4/ :)

    ReplyDelete
  5. I did this and it bricked my unit. Am I suppose to add /ect/startup.sh on the second set of lines?

    #building startup.sh into startup sequence****************************
    /opt/bin/nano /etc/init.d/rcS
    #add "/etc/startup.sh" to the end of the "rcS" file and save**********

    Is this is what I am suppose to do below

    #building startup.sh into startup sequence****************************
    /opt/bin/nano /etc/init.d/rcS /ect/startup.sh
    #add "/etc/startup.sh" to the end of the "rcS" file and save**********

    ReplyDelete
  6. I am a owner of the Pink Pogoplug and my question is very basic.

    I have tons of pictures, home videos, backups for which I use Pogoplug. I also use the web portal and IPhone/IPad to access Pogoplug.

    Given all that, do I get something additional with Samba?
    What is the difference between uPNP and Samba and why do I need to install Samba -- what do I get with it?


    Second question:

    I have purchased a Camcorder, which can download the recorded videos using Wifi. I want it to download directly to Pogoplug.

    I also have dropbox and google drive? Should I use Pogoplug to store the offline data?

    Will Samba help?


    Thanks,
    Rajesh

    ReplyDelete
    Replies
    1. You are right Pogoplug comes with its native UPNP, however i found some serious limitation for my set up.
      1. I couldn't access all my video files from my media streamer.
      2. It didnt allow me to view all files in Windows explorer. I wanted to access files and edit them. I dont wanna install Pogoplug software to all devices
      3. With Samba server all my devices PC\Phones\Tablet can browse files. In future lets say i dont want to use their cloud software (I'm not comfortable with sharing all my family photos on cloud however secure it is), i can kill their programme and use Pogoplug as a server where i can hook up all my external drive and make it work as low power server.

      Answer to second question:
      - You can hook up your camcorder either to pogoplug (USB cable) directly and access them through PC and download files OR you can connect your camcorder to your PC and then transfer the files to pogoplug. You can write a small script to sync your files from PC to Pogoplug.

      Delete
  7. Awesome "How to guide " , thx a Marvel and Aaron. I'm able to set up Samba server without issues. Had trouble finding my IP as I plugged Pogoplug to another router (with its DHCP turned ON) so my main router was not displaying the MAC ID with IP address. Eventually i was able to figure it out.
    Here is link for another Video tutorial as well which i followed in case anyone interested: http://myownhomeserver.com/2012/11/how-to-make-a-cheap-home-server-using-a-pogoplug-v2/

    Thanks once again

    ReplyDelete
  8. How does one punch this in? The person above asked but no answer was stated.

    #building startup.sh into startup sequence****************************
    /opt/bin/nano /etc/init.d/rcS
    #add "/etc/startup.sh" to the end of the "rcS" file and save**********

    Like this?
    /opt/bin/nano /etc/init.d/rcS /etc/startup.sh

    Or

    /opt/bin/nano /etc/init.d/rcS/etc/startup.sh

    Or

    /opt/bin/nano /etc/init.d/rcS
    /etc/startup.sh

    ReplyDelete
  9. Good tips to solve this problem of POGO-E02 (PINK) as a local samba server for XBMC ...greatly appreciated!!
    Pogo Technical Support please visit the link.

    ReplyDelete