Sunday 1 July 2012

Setting up Pogo in Ubuntu

I have been playing around a bit with getting Pogo setup on Ubuntu.  I found the experience a bit daunting, and wanted to journal my experience in case someone else out there is finding a similar stressful experience.




Following the steps that Brian Higgins provided on his posting http://brianhiggins.com/?p=5915


Step 1:
Open a terminal

Using Aptitude or Synaptic, install the required FUSE applications:

$ sudo apt-get install fusedav fuseext2 fusefat fusesmb

Step 2:
Download the 32bit or 64bit PogoPlug Companion driver for Linux from the Pogoplug website. (http://pogoplug.com/downloads)


Extract the single file named “pogoplugfs” to a directory like ~/myBIN/ for example.


Step 3:
Now copy the pogoplugfs to the /bin directory


$ sudo cp ~/myBIN/pogoplugfs /bin


Step 4:
Grant yourself rights to FUSE:


$ sudo usermod -a -G fuse $(id -u -n)


Step 5:
LOGOUT and LOGIN to make rights effective:
The quickest way is usually CTRL-ALT-BS or ALT-PRTSCR-K.


Step 6:
Create a mount point and grant permissions to it:


$ sudo mkdir /media/pogoplug
$ sudo chown root:fuse /media/pogoplug
$ sudo chmod 0775 /media/pogoplug


Step 7:
Mounting PogoPlug on Ubuntu (cannot sudo) as a background process:
$ /bin/pogoplugfs --user [YOUREMAIL] --password [YOURPASSWORD] --mountpoint /media/pogoplug


Unmounting the pogoplug volume leaves the mountpoint intact FYI:
$ sudo umount /media/pogoplug


*********************************************************************************************************


If you would like the PogoPlug to be mounted on reboot, I would suggest the following steps they worked well for me....


Optional Step 1:
Navigate to /etc/rc0.d
$ cd /etc/rc0.d


Optional Step 2:
Create a startup script using nano
$ sudo nano K99startpogo.sh


Insert the following into the text file:



#!/bin/bash


for (( i=0; i<=20; i++ ))
do


sleep 15
#find the current state of pogo
state=`pgrep pogoplugfs`


#if pogo off, turn it on, if it's on, exit
if [ "$state" = "" ]; then
/bin/pogoplugfs --user [YOUREMAIL] --password [YOURPASSWORD] --mountpoint /media/pogoplug

else
exit
fi


done


Hit CTRL+X to exit - be sure to save


Optional Step 3:
Make the script you just created executable:
$ sudo chmod +x K99startpogo.sh


(special thanks to http://en.kioskea.net/faq/3348-ubuntu-executing-a-script-at-startup-and-shutdown for this one)


After completing the Optional steps, you should be able to restart your Ubuntu and you will find that your pogoplug drive has been mounted successfully and you should now be able to access everything remotely as though it was a local installation.


I have found that this is actually fast enough to run mkv video files over the internet.  My next adventure is to see if I can share my recorded home videos remotely from the cottage....









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