Monday, March 31, 2014

DIY Portable AirPlay Speaker System

DIY Portable AirPlay Speaker System:



This is something I've been working off/on for over a year now. Originally inspired by the Boominator. However, I lack the carpentry skills and tools, so I decided to build this instead. I believe it's fairly unique in that it's totally portable (battery operated) and supports AirPlay.

Another photo of the back with captions on Amazon

YouTube Video:
Features:


  • AirPlay support provided by AirEnabler - broadcast it's own Wi-Fi network and allows iOS device to automatically maintain 3G/LTE connection for internet radio streaming from Pandora or iTunes Radio.
  • Battery operated; 6-8 hours on low-medium volume.
  • Runs off battery or AC wall charger and support charging while playing
  • Expandable to stereo (add 2nd speaker)
  • Switch out li-ion battery for 12v motorcycle battery for extended play (camping).








Friday, December 27, 2013

iPhone/Android VPN to PPTP VPN Server on TomatoUSB Router

iPhone/Android Phone Home - PPTP VPN Server for iPhone or Android on TomatoUSB Router

This is a quick tutorial on how to setup a PPTP VPN Server on your TomatoUSB Router. A PPTP VPN is ideal because it's fairly secure, simple to setup and both Android and iOS has built in PPTP VPN Clients which makes it convenient.

A VPN is a secure way for an iPhone or Android device to access local network resources such as internal web sites (SSL not required for secure access), samba shares, and SqueezeBox Server without the need to open up additional network ports on the router.

If you're looking for a router for this project, check out my [Tutorial] Apple AirPlay on TomatoUSB Router.

Assumptions:

1) You're running Shibby's BIG-VPN build of TomatoUSB
2) Dynamic DNS is setup (Required for Client Setup). See my
[Tutorial - 30 Minutes or Less] Site to Site VPN with TomatoUSB and OpenVPN post for instructions on setting up Dynamic DNS Address.

Steps:

1) Configure PPTP Server
2) Configure iPhone (iOS 7) VPN Client and Connect
3) Configure Android VPN Client and Connect - In Progress

Configure PPTP Server

Log into your TomatoUSB Router and go to VPN Tunneling->PPTP Server.

On the PPTP Server Configuration Page:

- Check Enable
- For Remote IP Address Range, pick a small IP Address range that is outside the scope of your DHCP Server but on the same network segment. For instance, I'm using 192.168.200.X as my network segment. My DHCP Server IP Adddress Range is 192.168.200.101-151. So I used 192.168.200.10-11 (outside the DHCP Range), giving me two IP Addresses (for two incoming iPhone).
- Set Broadcast Relay Mode to Both
- Set Encryption to MPPE-128
- Leave DNS Servers, WINS Servers, MTU and MRU at the default values.
- Under PPTP User List, add a user and set a password. You will need this info during the next step, Configure iPhone VPN Client.
- Save


Configure iPhone VPN Client and Connect

On your iPhone, go to Settings->General->VPN->Add VPN Configuration.
Select PPTP
Fill in the Description
For Server use your Dynamic DNS Address
Account name ("pptpuser" in this tutorial) and password.
Leave everything else as default.
Save.


Settings->General->VPN->Add VPN Configuration

Turn on VPN by going to Settings and sliding on "VPN". Note the "VPN" icon next to the clock when connected to VPN.

Turn iPhone VPN on by going to Settings and sliding on VPN

Configure Android VPN Client and Connect

Go to "Wireless and network" settings -> VPN settings.
Select "Add PPTP VPN"
Set VPN server name
Enable Encryption


Wednesday, November 6, 2013

How to Install Optware and SAMBA on the Pogoplug

In this tutorial, I'm going to show you how to install optware and samba on your Pogoplug to create a cheap and simple NAS.

What is optware? Optware is a package manager that allows you to install additional software on your embedded linux device such as the Pogoplug (think of it as a free little "App Store"), while maintaining the stock my.pogoplug.com functionality.

Requirements:

1) Pogoplug - V2 such as the E02, V3 (oxnas) such as the Pogoplug P21/P22/Pro or the V4, also known as the Series 4 and Mobile. Pretty much any existing Pogoplug model is supported.
2) USB Hard Drive - 2TB or less recommended.

Outline of Steps:

1) SSH into Pogoplug
2) Partition and Format USB Hard Drive
3) Install Optware
4) Install SAMBA
5) Make sure everything works after a reboot

SSH into Pogoplug

If you haven't activated your Pogoplug (new out of the box), you should be able to SSH into it using root/ceadmin as the username/password. If you have activated it, you'll need to enable SSH via my.pogoplug.com.

SSH into Pogoplug using Putty or similar app

Partition and Format USB Hard Drive

Plug in your USB Hard Drive to your Pogoplug.

#stop my.pogoplug.com service
killall hbwd

#partition drive
#create two partitions, a small 4GB partition
#for optware and the rest for your data
busybox fdisk /dev/sda

# Type in the following commands to erase
# and re-partition the USB Hard Drive 
#(WARNING - USB HARD DRIVE WILL BE COMPLETELY WIPED)

# p # list current partitions
# o # to delete all partitions
#
# Create 1st Partition for Optware
#
# n # new partition
# p # primary partition
# 1 (one) # first partition
# <enter> # default start block
# +4G # to create a 4GB partition

# Create 2nd Partition for Data
#
# n       # new partition
# p       # primary partition
# <enter> # default to second partition
# <enter> # default start block
# <enter> # default end block #use the whole flash drive
# w       # write new partition to disk

#download mke2fs to format partition
cd /tmp
wget http://dl.dropbox.com/u/42238/pogoplug/optware/mke2fs
chmod +x mke2fs

#format and label partition
./mke2fs -L optware -j /dev/sda1
./mke2fs -L data -j /dev/sda2

#remount root to be writable
mount -o remount,rw /

#create /opt folder
mkdir /opt

#mount usb drive as /opt
mount /dev/sda1 /opt


Install Optware

###########################################
# Install optware ipkg (package manager)
# Assumes /opt is mounted at this point
###########################################

#download ipkg
cd /opt
wget http://dl.dropbox.com/u/42238/pogoplug/optware/plug.tar.gz
tar -xzvf plug.tar.gz
rm plug.tar.gz

#Pogoplug Pro requires an updated wget
#Not needed for other models
#skip this section if not using Pro
cd /usr/bin 
mv wget wget.old
ln -s /opt/bin/wget /usr/bin/wget

# Setup profile
cd /etc
chmod 755 profile
source /etc/profile

#update available packages
ipkg update


Install Samba

ipkg install samba36 libnsl nano

#download example smb.conf
cd /opt/etc/samba

#Edit smb.conf (optional)
#to add additional samba shares
#nano /opt/etc/samba/smb.conf

#Start SAMBA
/opt/etc/init.d/S08samba start

You should now be able to access your Pogoplug's USB Hard Drive by \\pogoplug\usb


Make sure everything works after a reboot

#backup original rcS startup file
cp /etc/init.d/rcS /etc/init.d/rcS.original

#download mount script and make it executable
cd /etc/init.d
chmod +x mount_optext3

#add mount script to rcS file so it 
#runs automatically after a reboot
echo "/etc/init.d/mount_optext3" >> /etc/init.d/rcS

#start samba on reboot
echo "/opt/etc/init.d/S08samba start" >>  /etc/init.d/rcS

reboot

Adding an Additional/Second USB Hard Drive

1) Attach additional USB Drive to Pogoplug.

2) Partition additional USB Drive. See "Partition and Format USB Hard Drive" section, but just create one partition.

  busybox fdisk /dev/sdb

3) Format and Label additional USB Drive

    ./mke2fs -L data2 -j /dev/sdb1

4) Remount root to be writable

   mount -o remount,rw /

4) Edit the smb.conf file and add an additional section that is similar to the "[usb]" section.

   nano /opt/etc/samba/smb.conf

[usb2]
  path = /tmp/.cemnt/mnt_sdb1/
  read only = no
  public = yes
  writable = yes
  guest ok = yes

5) Reboot. You should now be able to access the additional drive as \\pogoplug\usb2


Miscellaneous Notes

On the Pogoplug V2 (E02) and V4, you can actually use one of the internal flash partition for /opt. This is a fairly small partition (<75MB), but will be enough if only plan to run a simple NAS using SAMBA.

Using the internal flash partition is also a great way to avoid issues with using multiple USB hard drives.

Only recommended for more advanced users (don't email me for support unless you plan to send me a bitcoin/litecoin!).


####################################
# Pogoplug V2/V4 - Use internal flash partition for /opt
####################################
#remount root to be writable
mount -o remount,rw /

#create /opt folder
mkdir /opt

#erase mtdblock3
flash_eraseall /dev/mtd3

#mount internal flash partition as /opt
mount /dev/mtdblock3 /opt



Changes to above instructions if using internal flash for /opt
- only one partition needed on your USB hard drive
- "Install Optware" and "Install Samba" instructions unchanged
- modify the smb.conf file for correct partition
     path = /tmp/.cemnt/mnt_sda1/
- In the "Make sure everything works after a reboot" section, you don't need the mount_optext3 script
- Add the "mount /dev/mtdblock3 /opt" command before the "/opt/etc/init.d/S08samba start" command in the /etc/init.d/rcS file.

Future Updates

I'll be flushing this tutorial with additional howtos in the near future. Please leave a comment and what you would like to see added.


Tuesday, October 8, 2013

Pogoplug V2 and V3 Serial Connection - E02, P21/P22, Pro

This is a quick how to tutorial on setting up a serial console connection to the Pogoplug E02 (V2) or P21/P22 (V3 oxnas).

Instructions for the Pogoplug V4 here.

A serial console connection is useful for recovering from a corrupt uboot environment or for troubleshooting general boot up issues.

You should be able to add a serial connection to your Pogoplug for less than $10 and in under 30 minutes.

Requirements:

1) USB to TTL Converter - I have a couple cheap USB to TTL converters based on the PL-2303HX chipset. Note that this chipset is not supported under Windows 8 and most PL-2303HX being sold on Amazon and Ebay are using fake chips which are not supported by the official drivers on Prolific's website. I'm using the drivers found here.

Prolific PL-2303HX USB to TTL Converter

2) CD-ROM Audio Cable (Sound Blaster/MPC-2) - you need the one with a white connector (Sound Blaster plug) at one end and a black connector (MPC-2) at the other end. I got mine from a old computer. You can pick one up on Amazon for $2.55 shipped.



3) Safety pin - used to modify the CD-ROM Audio Cable.


4) Small flat head screwdriver (optional)

Outline of Steps:

1) Opening up the Pogoplug
2) Modify CD-ROM Audio Cable
3) Connect the USB to TTL Converter to the Pogoplug
3) Install Drivers and Connect via Putty

Lets get started.

Opening up the Pogoplug

This part is pretty easy. You actually don't even need any tools, just a little force. 

Pull off the black feet, starting from the bottom. Clear plastic slides back.
The shell is held together by small plastic clips. This is where a small flat head screwdriver may be helpful. 

Modify CD-ROM Audio Cable

On the end with the black connector, use the safety pin to push out the the wires as shown below.
  


If you want a permanent serial connection, at this point (before reinserting the wires) you can drill a small hole on the back of your Pogoplug for the CD-ROM audio cable.

Now, reinsert the wires with the white wire on the edge, red in the middle and then yellow as shown below. Use electrical tape to tape up the black wire (not used). In the picture below, white will be GND.



Connect the USB to TTL Converter to Pogoplug

The CD-ROM Audio Cable that we modified will work for both Pogoplug V2 and Pogoplug V3.

Here is how everything should connect up. The white end of the CD-ROM audio cable can be plugged directly into the serial port of the Pogoplug. The black end of the CD-ROM audio cable can be plugged directly into the USB to TTL converter.

Pogoplug V2 (E02) Serial Console Connection

Pogoplug V3 Serial Console Connection
Make sure GND on the Pogoplug is connected to GND on the USB to TTL converter.
TXD on the Pogoplug should connect to RXD on the USB to TTL converter.
RXD on the Pogoplug should connect to TXD on the USB to TTL converter.
VCC and the 3.3v is not needed and should not be connected.


Install Drivers and Connect via Putty

Download drivers and install it. I'm using the drivers found here.

Plug in the USB to TTL converter and open up Device Manager and verify that Windows detected the USB to TTL converter correctly. Note the COM port number (COM4 in the example below).



Download putty from here and start it up.

Change the Connection type to Serial.



Under Category, click on Serial and change the serial line configuration settings to the following:

Speed: 115200
Data bits: 8
Stop bits: 1
Parity: None
Flow control: None

Change the COM port to the correct one found in Device Manager. Click Open.



Now power up your Pogoplug. You should see something like the following in your Putty Serial Console.


That's it.

Sunday, July 14, 2013

DIY AirPlay Speaker System using a Asus WL-520gu Router



In this tutorial, I'm going to show you how to re-purpose a Asus WL-520gu router into an Apple AirPlay Speaker System. I have a custom built OpenWRT image already fully configured with AirPlay so all you have to do is flash and go.

Major kudos to the Wifi Radio project on MightyOhm.com which introduced me to OpenWRT and a major inspiration for this project.

Requirements

- Asus WL-520gu Router (Stock Firmware, Tomato, DD-WRT or OpenWRT)
- Compatible USB Sound Card (USD DAC - Digital Audio Converter). See below.
- Speakers/Stereo System (or Headphones).

Flashing the OpenWRT AirPlay Firmware

Download my OpenWRT image pre-configured with AirPlay (aka ShairPort). Note that this firmware is specifically designed for the Asus WL-520gu router. If you use this firmware on any other router, you will brick it.

If you are already running Tomato, DD-WRT or OpenWRT (with Luci) on your router, you can flash directly from the web interface.

If you are running OpenWRT without a web interface, here are the commands to flash via command line:

cd tmp
wget http://goo.gl/MNkAm
mv MNkAm openwrt-brcm47xx-squashfs.trx
mtd -r write openwrt-brcm47xx-squashfs.trx linux

Otherwise if you are running the Asus stock firmware or need to recover from a bad flash, follow these instructions - Asus WL-520UG: Loving Tomato Firmware. Obviously, flash with the OpenWRT AirPlay image above.

Enjoy some Music

Plug in your USB Sound Card to the router and connect it to your speakers. Then power cycle the router.

On your iOS device, connect to the open/unencrypted 'AirPlay520gu' wireless network.

Important Note: Wireless is enabled by default within the image. However, the router requires one extra reboot after being flashed before wireless will start properly (Don't ask me why, I don't know). So basically, if you don't see the 'AirPlay520gu' wireless network, give the router a reboot/power cycle.

You should now be able to AirPlay music from your iOS device to the 'AirPlay520gu' AirPlay Speakers.

iOS 7 Beta - AirPlay to WL-520gu router from iTunes Radio


Different Modes and Use Cases

Standalone Mode (Default, no configuration needed) - Broadcast unencrypted/open SSID of "AirPlay520gu". DHCP Server enabled with no default route or DNS server to allow iPhone to maintain connection to LTE/4G network for internet radio streaming.

Wireless Client Mode - Connects to existing wireless network similar to how your iphone/ipad connects to your network. This is how most commercial AirPlay Speaker System work. HowTo: Switch to 'STA' mode

AP (Access Point) Mode - Connects to existing network via a wired Ethernet cable (or Ethernet over Powerline). Broadcast additional SSID to extend your wireless network coverage - add AirPlay and get better wireless coverage too! HowTo: Disable DHCP, change IP Address, Set SSID/Encryption type

Check the OpenWRT forums or Wiki for help on re-configuring your new AirPlay router!

Compatible/Recommended USB Sound Cards (Plug and Play)
Some additional USB DACs that I haven't tested personally, but should also work:
Note: The cheap "3D Sound" USB audio adapter may work, but there is at least two versions - one that works (C-Media chipset) and one that doesn't (6911 Chipset, JMTek, LLC 48Khz Only). My recommendation is to avoid them unless you're 100% positive you'll get the one with the C-Media chipset or to keep things simple, pick up the Syba SD-CM-UAUD USB Stereo Audio Adapter if you're on a tight budget or prefer the form factor.

DIY AirPlay Sound System for under $100

A great sounding AirPlay speaker system can easily be put together on a very limited budget and blow away anything sold at the Apple Store costing twice or three times as much. As an example, a LP-2020A+ Lepai Tripath Amplifier paired with the Dayton Audio B652 bookshelf speakers will give you awesome sound on a tight budget.

Syba USB Audio Adapter - $7
Lepai 2020A+ Amp - $23
Dayton Audio B652 Bookshelf Speakers - $52

Total cost $82 + router

What if I don't have a Asus WL-520GU Router?

Definitely do not buy one (unless you can get it super cheap, ~$10). This router has really dated hardware and is no longer manufactured.

Instead consider picking up a TomatoUSB compatible router or Pogoplug and following my other DIY AirPlay tutorials:
[Tutorial] - Pogoplug E02/V4 with Arch Linux ARM

Another option would be my Apple AirPlay AirEnabler Adapter Kit, which is a totally plug and play solution that allows you to add Apple AirPlay to any existing home stereo, car stereo, pc speaker system, ammo box portable speaker systemstereo cooler or my favorite the Boominator, "the ultimate party machine".

Friday, March 29, 2013

[Tutorial] CentOS 6 OpenVPN Client - Connecting to Existing Site to Site VPN (TomatoUSB)

In this tutorial, I'm going to show you how to add a CentOS 6 server as a OpenVPN client to your existing Site to Site VPN.

This is an extension of my [Tutorial - 30 Minutes or Less] Site to Site VPN with TomatoUSB and OpenVPN and assumes you already have your Site to Site VPN operational. However, you should be able to follow this tutorial and connect to any existing OpenVPN Server.

At the end of this tutorial, your CentOS server will be able to securely access your LAN resources (i.e, computers, printers) on both sites and vice versa (you will also be able to seamlessly access your CentOS server).

Overview of the Steps:

1) Generate Certs and Keys
2) Copy/Transfer over Certs and Keys to Client VPS
3) Install OpenVPN (client)
4) Configure OpenVPN Client
5) Connect


Generate cert/keys for VPS (CentOS 6 32-bit OpenVPN Client)

SSH into your TomatoUSB OpenVPN Server.

#Setup and initialize environment
cd /opt/openvpn-easy-rsa
source ./vars


#myvps_client is the Common Name
./build-key myvps_client


Copy/Transfer over Certs and Keys to Client VPS

Since my CentOS server is running SSH, I'm going to use SSH and SCP (secure copy) to transfer over the certificates and key. You can also transfer over the keys via SFTP or a USB drive.


#create the /etc/openvpn/keys folder on my centos server
ssh root@myvps.qnology.com mkdir -p /etc/openvpn/keys 

#copy over the certificates and keys
#all one line
cd /opt/openvpn-easy-rsa
scp keys/ca.crt keys/myvps_client.crt keys/myvps_client.key root@myvps.qnology.com:/etc/openvpn/keys

Install OpenVPN on CentOS 6

#Bring everything up to date
yum -y update

#Add EPEL (Extra Packages for Enterprise Linux) Repo
# RHEL/CentOS 6 32-Bit ##
cd /tmp 


wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm rpm -ivh epel-release-6-8.noarch.rpm

yum --enablerepo=epel install openvpn.i686

Configure OpenVPN Client

#copy sample client.conf to /etc/openvpn
cp /usr/share/doc/openvpn-2.2.2/sample-config-files/client.conf /etc/openvpn


#edit openvpn client.conf
nano /etc/openvpn/client.conf

Update the following lines
#remote OpenVPNServer.ADynamicDNSAddress.com 1194
#ca /etc/openvpn/keys/ca.crt
#cert /etc/openvpn/keys/myvps_client.crt
#key /etc/openvpn/keys/myvps_client.key

#start VPN manually to test
openvpn --config /etc/openvpn/client.conf


#test starting VPN as a service
service openvpn start

#autostart at OpenvPN client on reboot
chkconfig openvpn on



[Tutorial] - Pogoplug E02/V4 with Arch Linux ARM - NAS (SAMBA), AirPlay, AirPrint, Google CloudPrint, SqueezeBox (Logitech Media Server), SqueezeLite, Plex Media Server

Pogoplugs sporting 1TB USB HDs, USB DACs and USB Wifi

In this tutorial I'm going to show you how to setup the following on a Pogoplug running Arch Linux ARM (aka ALARM for short).

SAMBA
   - enable swapfile
Apple AirPlay
SqueezeLite Player (Logitech Media Server/SqueezeBox Client)
SqueezeBox (Logitech Media Server)
Plex Media Server
Apple AirPrint
Google CloudPrint
Re-install my.pogoplug.com service
Enable uPNP/DNLA (my.pogoplug.com)
Wireless Configuration
Motion Webcam
BitTorrent Sync
Transmission, Sabnzbd, SickBeard and CouchPotato
OpenVPN (client)
Webmin
Mongoose (Simple Web Server)
OwnCloud (nginx php-fpm sqlite)
Backup and Restore ALARM

Requirements:


Want to take a small gamble? Pick up the Pogoplug P21 (Black) or Pogoplug B01 (Pink). Eventhough the box is labeled as a P21/B01, chances are the Pogoplug itself will be a E02 model. I've bought at least 6 P21/B01 from various vendors - Adorama,  JR.com, and Ebay - and so far I have only received E02. Note that recently a small percentage of users (~20-30%)  have reported receiving a new P22 model which isn't supported under Arch Linux ARM.

Don't want to gamble and having a hard time finding the E02 model? I have a few extra for sale.

Check the bottom of the Pogoplug to confirm Model number. Ignore the Model number listed on the box.

The E02 model is the ideal choice with 256MB RAM and a 1.2Ghz CPU versus other models (Series 4) which only has 128MB RAM and 800Mhz CPU. Don't get fooled by the USB 3.0 Ports in the Series 4 model; the CPU is a bottleneck and there is no performance difference with the USB 3.0 ports. Saying that, I like the Pogoplug Series 4 form factor with its SATA USM slot. For the Pogoplug Series 4, I would recommend the USM slot compatible Seagate Backup Plus 1 TB USB 3.0 Portable Hard Drive.


Pogoplug Series 4 with (USM Compatible) Seagate Backup Plus 1TB USB 3.0 Portable HD

This will be a work in progress, so please excuse the typos and grammar.

Note/FAQ Troubleshooting:
- Watch out for run-on commands. I'm having issues with the blogger editor.
- For bootup issues, see Troubleshooting ALARM Boot Up Issues near the end.

Assumptions:
 - Pogoplug is installed behind a Router/Firewall on a secured LAN (home use only)
 - The Pogoplug is new and hasn't been registered on my.pogoplug.com. If it was, you may need to enable SSH via my.pogoplug.com

If you only want to setup a simple NAS and/or have a unsupported Pogoplug version V3 (oxnas), please take a look at my Optware Tutorial.

Last Updated: 02/09/2014

Arch Linux ARM Installation:

Official Instructions for installing Arch Linux on the Pogoplug E02 can be found here:
http://archlinuxarm.org/platforms/armv5/pogoplug-v2-pinkgray#qt-platform_tabs-ui-tabs2

For the Pogoplug Series 4 and Mobile, official instructions can be found here:
http://archlinuxarm.org/platforms/armv5/pogoplug-series-4#qt-platform_tabs-ui-tabs2

Note: If you get a command not found for "wget" or "reboot", try adding "busybox" in front of the command - "busybox wget http://xxx", "busybox shutdown"

My summarized version for the E02 is below (use the above link for the Series 4):

Turn on without usb drive attached first
SSH into Pogoplug
Login as root/ceadmin. 


#Stop the Pogoplug software
killall hbwd

#Install UBoot - E02 only
cd /tmp
wget http://jeff.doozan.com/debian/uboot/install_uboot_mtd0.sh
chmod +x install_uboot_mtd0.sh
./install_uboot_mtd0.sh

#Would you like to disable the Pogoplug services? [Y/n]
#n - to keep original Pogoplug software 
#when booting without USB drives attached
#y - if you're not planning on ever using the stock
#Pogoplug software again

#Plug in USB Flash Drive or Hard Drive
#Use the back bottom USB port

If you plan to setup the Pogoplug as NAS using SAMBA with a hard drive, my recommendation would be to install ALARM directly on the hard drive and skip using a USB flash drive. This will avoid some potential boot up issues. To do this, create two partition, a small 4GB partition for ALARM and the rest for data.

#Partition your USB flash/hard drive
/sbin/fdisk /dev/sda

# Type in the following commands to erase
# and re-partition USB flash/hard drive 
#(WARNING - FLASH/HARD DRIVE WILL BE COMPLETELY WIPED): 

# p # list current partitions
# o # to delete all partitions
# n # new partition
# p # primary partition
# 1 (one) # first partition
# <enter> # default start block
# <enter> # default end block (to use the whole drive)
# If you're using a hard drive, create a small
# 4GB partition instead of using the whole drive,
# leaving the rest for a data partition
# +4G # to create a 4GB partition
# w # write new partition to disk

#Format USB Flash Drive
cd /tmp

wget http://archlinuxarm.org/os/pogoplug/mke2fs
chmod 755 mke2fs

#format and label partition
./mke2fs -L ROOTFS -j /dev/sda1

#mount usb flash drive
mkdir -p /tmp/usb
mount /dev/sda1 /tmp/usb


#Download Arch Linux ARM (aka ALARM)

#and extract to USB Drive:
cd /tmp/usb
wget http://archlinuxarm.org/os/ArchLinuxARM-armv5te-latest.tar.gz
tar -xzvf ArchLinuxARM-armv5te-*.tar.gz

#Unmount USB Drive and reboot
rm ArchLinuxARM-armv5te-*.tar.gz
sync  # Takes a while when using a flash drive
cd ..
umount /tmp/usb
reboot

Note that after the reboot, the IP Address of your Pogoplug may have changed. However, you should be able to hit it by name, "alarm". Otherwise double check your router or use a IP scanning tool like AngryIP (Legacy) to confirm the IP Address of your Pogoplug.

SSH back into your Pogoplug and login with the username and password of root/root. Success? Congratulations! At this point, Arch Linux is now running on your Pogoplug.


Initial Arch Linux ARM Configuration and Package installation

#Upgrade kernel and install some initial packages
#Hit Enter when prompted with "Enter a selection (default=all):"
#'Y' when prompted with linux-kirkwood and linux are in conflict.
#Remove linux? [y/N]
#Go get some coffee
pacman -Sy linux-kirkwood linux-kirkwood-headers ntp yaourt base-devel nano wget

#list timezone
timedatectl list-timezones

#set timezone
timedatectl set-timezone America/Los_Angeles

#autostart ntp 

#pogoplug has no hardware clock
systemctl enable ntpd

systemctl start ntpd


#force time update after network starts
#all one line
echo "ExecUpPost='/usr/bin/ntpdate -u pool.ntp.org'">>/etc/netctl/eth0

#Add ROOTFS to fstab so fsck will run when needed
e
cho "LABEL=ROOTFS / ext3 rw,noatime 0 1" >> /etc/fstab

#if you run into issues running
#fw_setenv and fw_printenv commands
pacman -Sy uboot-env
echo "/dev/mtd0 0xc0000 0x20000 0x20000">>/etc/fw_env.config

#Have uboot mount partition as ext3 
#safer in power outages
#E02 only, V4 defaults to ext3 already
fw_setenv usb_rootfstype ext3

#Correct machid - make LED Green versus Orange
#Only for E02
fw_setenv machid dd6

#double check if ethaddr is defined
#please leave a comment if not defined
#trying to figure out why this is for some people
fw_printenv ethaddr

#if you get: ##Error: "ethaddr" not defined

#replace XX:XX:XX:XX:XX with the MAC
#found on the bottom of your pogoplug
#fw_setenv ethaddr "XX:XX:XX:XX:XX"

reboot


SAMBA Server - Setup your Pogoplug as a Network Attached Storage (NAS)

Updated 9/25/2013

The Pogoplug makes an excellent NAS. Expect read/write performance between 23MB-28MB/s on a wired gigabit network using ext3/ext4. If you are using a 10/100Mb network, expect a maximum transfer rate of 9-10MB/s, which is the limit of 10/100Mb network. Wireless will be slower. Using NTFS partition will also affect performance (don't use it).

If you plan to setup the Pogoplug as NAS using SAMBA with a hard drive, my recommendation would be to install ALARM directly on the hard drive and skip using a USB flash drive. This will avoid some potential boot up issues. To do this, create two partition, a small 4GB partition for ALARM and the rest for data.

The instructions below assumes you have ALARM installed on the first partition of your USB hard drive. Replace "/dev/sda2" (second partition on first hd) with "/dev/sdb1" (first partition second hard drive) if you have ALARM installed on a USB Flash Drive and adding a new USB Hard Drive for SAMBA.

Note that these instructions are only applicable to 2TB drives or less. If you have a 3TB drive, you need to use gdisk to setup a hybrid MBR, which is not covered in this tutorial.





#Create a 2nd Partition on your USB Drive
/sbin/fdisk /dev/sda

# Type in the following commands to create a 2nd
# partition on your USB hard drive 
#
WARNING - HARD DRIVE SHOULD NOT CONTAIN ANY DATA, 
EXCEPT ALARM INSTALLATION ON 1st PARTITION
p       # list current partitions
# n       # new partition
# p       # primary partition
# <enter> # default to second partition
# <enter> # default start block
# <enter> # default end block #use the whole flash drive
# w       # write new partition to disk

#Format newly created 2nd partition, label as USB
#a reboot may be required for new partition 
#to be recognized
mkfs.ext3 -L USB /dev/sda2

#mount disk
mkdir -p /media/usb

#mount 2nd partition (/dev/sdb1)
mount /dev/sda2 /media/usb

#install samba and upgrade everything
pacman -Syu samba

#Create folder we'll be sharing
#will also hide the swap and lost+found folder
mkdir -p /media/usb/share

#download example smb.conf for public share
#no authentication require, everyone has 
#read/write access to / (root$) and usb (/media/usb/share)
cd /etc/samba
wget http://dl.dropbox.com/u/42238/pogoplug/v2/smb.conf

#Edit smb.conf (optional)
#change name, add additional shares
#nano /etc/samba/smb.conf


#start samba
systemctl start smbd nmbd

#mount after reboot
#all one line
echo "LABEL=USB /media/usb ext3 rw,noatime,nofail 0 0" >> /etc/fstab


#autostart samba on reboot
systemctl enable smbd nmbd

#test from computer: 

#\\pogoplug\root$
#\\pogoplug\usb

#reboot and test

reboot

Enable Swapfile

Only create a swapfile if you're using a hard drive. It is not recommended to setup a swapfile on a USB flash drive as it can wear out and fail.

#This will create a 1024MB swap file
#Named "swapfile.img" in /media/usb (usb hd).
dd if=/dev/zero of=/media/usb/swapfile.img bs=1M count=1024

mkswap /media/usb/swapfile.img

#update swap file permissions
chmod 0600 /media/usb/swapfile.img

#You can now turn the swap file on using:
swapon /media/usb/swapfile.img

#check if swap is enabled
free

#turn swap off by using:
#swapoff /media/usb/swapfile.img

#enable swapfile on reboot
echo "/media/usb/swapfile.img none swap sw,nofail 0 0" >> /etc/fstab

#reboot and test
reboot
free


Apple AirPlay (aka Shairport) - Play some music from your iOS Device or iTunes through your PogoPlug

Compatible/Recommended USB Sound Cards (Plug and Play)

#Install some required packages
pacman -Sy libao alsa-utils avahi libpulse

#audio fix
echo "use_mmap=no" >> /etc/libao.conf


#Configure alsa - asound.conf file
cd /etc
wget https://dl.dropbox.com/u/42238/pogoplug/v2/asound.conf


#download pre-compiled version of shairport
#compiled 9/24/2013
cd /usr/local/bin
wget http://dl.dropbox.com/u/42238/pogoplug/v2/shairport


#make shairport executable

chmod a+x shairport

#or compile shairport on your own
cd /tmp
wget --no-check-certificate https://github.com/abrasive/shairport/tarball/1.0-dev
tar xzf 1.0-dev
cd *shairport*
make
make install

#restart dbus
systemctl restart dbus

#autostart avahi-daemon
systemctl start avahi-daemon
systemctl enable avahi-daemon

#start shairport and test
shairport -a Living_Room -v


#Test, Control C to stop

#autostart shairport on reboot
#edit shairport.service file to update AirPlay name
cd /etc/systemd/system

wget http://dl.dropbox.com/u/42238/pogoplug/v2/shairport.service

#start shairport and test

systemctl start shairport
systemctl status shairport

#autostart shairport on reboot
systemctl enable shairport

#reboot and test
reboot

#Schedule ShairPort to restart daily
#switch editor to nano
export EDITOR="/usr/bin/nano"

#edit/create crontab
crontab -e

#paste in the below and exit
#restart shairport @ 5AM everyday
00 05 * * * /usr/bin/systemctl restart shairport


#list crontab
crontab -l



Adjusting the volume

#Find name of mixer control
amixer

#Simple mixer control 'PCM',0
#  Capabilities: pvolume pswitch pswitch-joined
#  Playback channels: Front Left - Front Right
#  Limits: Playback 0 - 38
#  Mono:
#  Front Left: Playback 27 [71%] [-8.26dB] [on]
#  Front Right: Playback 27 [71%] [-8.26dB] [on]

#set volume to 90%
amixer set PCM 90%


#save setting
alsactl store

#Troubleshooting commands
lsusb
aplay -L
cat /proc/asound/card0/pcm0p/sub0/hw_params



SqueezeLite Player (SqueezeBox/Logitech Media Server Client)

pacman -Sy faad2 libmad mpg123 libao alsa-utils avahi
#if not already done
#audio fix
echo "use_mmap=no" >> /etc/libao.conf


#Configure alsa - asound.conf file
cd /etc
wget https://dl.dropbox.com/u/42238/pogoplug/v2/asound.conf


mkdir -p /usr/local/bin
cd /usr/local/bin

#v1.3

#originally from https://code.google.com/p/squeezelite/downloads/list
wget https://dl.dropboxusercontent.com/u/42238/pogoplug/v2/squeezelite-armv5te
mv squeezelite-armv5te squeezelite

#make executable
chmod a+x squeezelite

#download service file
cd /etc/systemd/system
wget http://dl.dropbox.com/u/42238/pogoplug/v2/squeezelite.service

#edit name (optional)

#nano /etc/systemd/system/squeezelite.service

#start squeezelite and avahi-daemon
systemctl start squeezelite 
avahi-daemon

#autostart squeezelite and 
avahi-daemon on reboot
systemctl enable squeezelite avahi-daemon



SqueezeBox (Logitech Media Server) Installation

Updated 9/25/2013 - LMS updated to 7.7.3

pacman -U http://dl.dropbox.com/u/42238/pogoplug/v2/logitechmediaserver-7.7.3-2-arm.pkg.tar.xz

#start logitechmediaserver
systemctl start logitechmediaserver

#autostart logitechmediaserver on reboot
systemctl enable logitechmediaserver

#make music and playlist folder

mkdir -p /media/usb/share/music
mkdir -p /media/usb/share/playlist

#update permissions
chmod 777 /media/usb/share/music
chmod 777 /media/usb/share/playlist

#Configure @ http://pogoplug:9000

#LMS Build Instructions
#Requires Swap of 512MB or more
#Takes 3 hours

#mkdir -p /media/usb/share/build
#cd /media/usb/share/build
#wget #https://aur.archlinux.org/packages/lo/logitechmediaserver/logitechmediaserver.tar.gz
#tar -xvzf logitechmediaserver.tar.gz
#cd logitechmediaserver
#makepkg -Acs --asroot



Plex Media Server

Major kudos to moonman on ALARM forum for providing the PKGBUILD.

Plex is probably the best solution for accessing your music over the internet using a computer, iPhone or Android device.

Note that Plex on ARM does not support transcoding. This means your media need to be natively supported by your Plex Client (e.g., mp4/m4v on iOS devices).

If you're having issues adding your media, try changing the permissions on the folder - chmod 777 /media/usb/share/music

Update 1/3/2014 - Note that a newer version of plexmediaserver is now available in the official pacman repo now. I haven't tested it so you're on your own.

#To install from pacman repo
#pacman -Sy plexmediaserver
pacman -U http://dl.dropbox.com/u/42238/pogoplug/v2/plexmediaserver-0.9.8.4.125-1-arm.pkg.tar.xz

#version 0.9.8.6 - untested
#pacman -U http://dl.dropbox.com/u/42238/pogoplug/v2/plexmediaserver-0.9.8.6.175-1-arm.pkg.tar.xz


#optional - not needed if you're already 

#updating the time after the network starts 
#force time update prior to starting plex
#all one line
sed -i '/ExecStart/ i\ExecStartPre=/usr/bin/ntpdate -u pool.ntp.org' /usr/lib/systemd/system/plexmediaserver.service


#reload unit files
systemctl --system daemon-reload

#start 
plexmediaserver
systemctl start plexmediaserver


#autostart plexmediaserver on reboot
systemctl enable plexmediaserver

#Configure @ http://alarm:32400/manage



AirPrint Server - Print to your non-AirPrint enabled printers

#Install CUPS and print drivers

pacman -Sy cups gutenprint pycups python2 avahi 

#link python to python2
ln -s /usr/bin/python2 /usr/bin/python


#For HP Printer Drivers
pacman -S hplip

#For Samsung Printer Drivers
pacman -S splix

#Backup original cupsd.conf

cd /etc/cups
mv cupsd.conf cupsd.conf.org


#download my cupsd.conf
wget http://dl.dropbox.com/u/42238/pogoplug/cupsd.conf

#Start CUPS

systemctl start cups.service


Configure CUPS Printer(s)

Now open up your web browser and go to http://pogoplug:631/admin.

This part is YMMV. Not all printers will work.


Click the "Add Printer" Button.

In my case, I am using a Brother HL-2270DW (highly recommended, works great and cheap toner) which has built in wireless and supports various printing options - socket, ipp, http, etc. I'm going to use socket (AppSocket/HP JetDirect) which is the same option you would select if you had your USB printer directly connected to your PogoPlug. 


USB attached printers should be auto detected (untested).

For the Brother wireless printer, the Connection address I'm using is "socket://<PrinterIPAddress>:9100" ( for the record "ipp://<PrinterIPAddress>/pcl_p1" would also work).


If you're using a DD-WRT or TomatoUSB Router as your print server, "socket://<RouterIPAddress>:9100", would be the correct Connection address..

Name your printer. Check the "Share This Printer" checkbox. Select the Make/Model of your Printer. Basically you are selecting the drivers to use. For my Brother HL-2270DW, I went with "Generic"->"Generic PCL 6/PCL XL Printer".

Click Add Printer.

Set your Default Options.

Print a test page. Maintenance->Print Test Page.

Printing a test page needs to work. If not, you can not continue. Not all printers will work. Try different drivers (or a different printer) if you're having a problem with printing a test page.


Back in the SSH Console


#download avahi airprint script

mkdir -p /opt/airprint
cd /opt/airprint

#this is all one line
wget -O airprint-generate.py --no-check-certificate https://raw.github.com/tjfontaine/airprint-generate/master/airprint-generate.py

#make script executable
chmod 755 airprint-generate.py

#add mime types needed for iOS6
echo "image/urf urf string(0,UNIRAST<00>)" > /usr/share/cups/mime/airprint.types
echo "image/urf application/pdf 100 pdftoraster" > /usr/share/cups/mime/airprint.convs

#autostart avahi-daemon
systemctl start avahi-daemon
systemctl enable avahi-daemon

#restart cups to pick up new mime types
systemctl restart cups

#Generate AirPrint service file
cd /etc/avahi/services
/opt/airprint/airprint-generate.py

#Check for AirPrint-<PrinterName>.service file
ls

#Test AirPrint from iOS Device

#autostart cupsd after reboot
systemctl enable cups


As a reference please check out this posting - [Tutorial] Apple AirPrint on TomatoUSB Router


Google CloudPrint - Print over the internet via Chrome Web Browser. Share your printer with friends/family.

pacman -Sy git

#download cloudprint
mkdir /opt
cd /opt
git clone git://github.com/armooo/cloudprint

#build and install cloudprint
cd /opt/cloudprint
python setup.py build
python setup.py install



#Run once to create auth files
cloudprint

#enter your google account email and password
#Google username:
#Password:

#Test print from your Chrome web browser
#Control+C to close cloudprint

#To run as daemon
pacman -Sy yaourt

#Not sure why, but python2-daemon complains about these
#two files so we're renaming them
mv /usr/bin/easy_install-2.7 /usr/bin/easy_install-2.7.bak
mv /usr/lib/python2.7/site-packages/setuptools.pth /usr/lib/python2.7/site-packages/setuptools.pth.bak

#No need to edit anything
yaourt -ASy python2-daemon

#setup cloudprint to run on startup via systemd service
cd /etc/systemd/system
wget http://dl.dropbox.com/u/42238/pogoplug/v2/cloudprint.service
systemctl enable cloudprint.service

#Reboot and test CloudPrint

#Clear google credentials/auth files
#rm /root/.cloudprintauth
#rm /root/.cloudprintsaslauth

Cloudprint is very fragile. If you're having start-up or printing issues try the following steps.

- Clear your Google CloudPrint Print Queue - https://www.google.com/cloudprint/#jobs
- Delete your stored credential and reboot and start over.

One more thing regarding CloudPrint, my recommendation is to set up a new Google Account dedicated just for CloudPrint. Use this account for the above cloudprint login, and then share your printer(s) with your main account. I'm a little paranoid of having my email authentication stored on my router (even though its hashed or whatever).


Re-install my.pogoplug.com service (original software) 

Great piece of software. My favorite is the iOS/Android app automatic photo/video backup feature. This is a simple and effective way to backup your phone's camera stream.

[Updated 9/25/2013] - Cloud Engine software was updated to 3.3.5.

Please go here for latest instructions/update:
http://archlinuxarm.org/forum/viewtopic.php?f=18&t=3343 (Thanks moonman!)

#If upgrading from previous release
#uninstall old version
pacman -R pogoplug

#you may need to delete this file otherwise
#the new package will complain
#rm /usr/local/cloudengines/bin/hbplug.conf

#install pogoplug software

pacman -U http://dl.dropboxusercontent.com/u/15043728/ArchLinuxArm/my.pogoplug.com/pogoplug-3.3.5-1-arm.pkg.tar.xz
#download my sample pogoplug.conf file
#if upgrade, you can skip this
cd /etc
wget http://dl.dropbox.com/u/42238/pogoplug/v2/pogoplug.conf

#edit configuration file

#edit vfsdir0
#add svcid (ID) from the bottom of your PogoPlug (no dashes)

nano /etc/pogoplug.conf

##example below: vfsdir<number>=<name>,<path>
#vfsdir0=PogoPlug_USB,/media/usb/share
#installdir=/usr/local/cloudengines
##datadir=.
#datadir=.
#nohotplug=1
##use the ID from the bottom of your Pogoplug 

#26 char (no dashes)
#svcid=35DFBFL73RD2CX5FJMAAAA1111

#tcpport=89


#note /etc/pogoplug.conf will be copied to
#/usr/local/cloudengines/hbplug.conf on service startup 
#hbplug.conf is the file that matters.
#if things are not working as expected, verify
#the content of the hbplug.conf file

#start pogoplug service

systemctl start pogoplug


#autostart pogoplug service on reboot
systemctl enable pogoplug

#reboot and register @ http://my.pogoplug.com
reboot



Enable uPNP/DNLA (my.pogoplug.com)

The Cloud Engine my.pogoplug.com software has a (limited) built-in uPNP/DNLA server. Also note that Plex Media Server and Logitech Media Server both have built in DNLA Servers.

On my.pogoplug.com -> Settings -> Media












Wireless Configuration
Last Updated: 8/14/2013

The following USB wireless adapters are Plug and Play:
Alfa AWUS036H (RTL8187)
Etekcity High Power 802.11 B/N/G 300M USB Wireless 1000mw Wifi Network Adapter with Dual Antenna (RT3072)

These USB wireless adapters are not Plug and Play:
Airlink101 AWLL5099
Mini Wireless 150Mbs USB Ralink RT5370


NETCFG has been replaced by NETCTL
https://wiki.archlinux.org/index.php/Netctl


#install netctl and related packages
pacman -Sy wireless_tools netctl ifplugd wpa_actiond

#Connect to wireless network and create wireless profile
cd /etc/netctl
wifi-menu


#check if wireless profile got created
#you should see wlan0-SSIDName
ls /etc/netctl

#Auto Connect to Wireless Network
systemctl enable netctl-auto@wlan0.service

#Auto Connect to Wired Network
systemctl enable netctl-ifplugd@eth0.service

#reboot and test
ifconfig
iwconfig


Motion WebCam

Attach a USB Webcam to your Pogoplug and turn it into a surveillance system.
More info - http://www.lavrsen.dk/foswiki/bin/view/Motion/MotionGuide

Confirmed working with:
Logitech HD Webcam C270


#install motion and other required packages
pacman -S motion x264 fswebcam

#change to motion folder and edit motion.conf file
cd /etc/motion

#turn off localhost access only
sed -i 's:webcam_localhost on:webcam_localhost off:' ./motion.conf

#adjust resolution to 640x480
sed -i 's:width 320:width 640:' ./motion.conf
sed -i 's:height 240:height 480:' ./motion.conf

#disable http remote control
sed -i 's:control_port 8080:control_port 0:' ./motion.conf

#change webcam http port to 8088
sed -i 's:webcam_port 8081:webcam_port 8088:' ./motion.conf

#change folder where picture/video are saved
sed -i 's:/usr/local/apache2/htdocs/cam1:/media/usb/share/motion_capture' ./motion.conf

#create required folders
mkdir -p /var/run/motion
mkdir -p /media/usb/share/motion_capture
#Start motion and access webcam @ http://pogoplug:8081
#Bug in Chrome, no longer allow you to view stream.
#Use Firefox or VLC

#A little hack to get motion to detect webcam correctly
fswebcam -r 320x240 -d /dev/video0 -v /dev/null

#start motion (non-daemon mode)
motion -n

#download service file, includes fswebcam hack
cd /etc/systemd/system
wget http://dl.dropbox.com/u/42238/pogoplug/v2/motion.service

#auto start motion on reboot
systemctl enable motion

BitTorrent Sync

BitTorrent Sync is a free utility that uses the bittorrent protocol to keep folders in sync across devices. It can be used with OS X, Windows, Android and Linux.

#create folder
mkdir -p /usr/local/bin
cd /usr/local/bin

#download and untar
wget http://btsync.s3-website-us-east-1.amazonaws.com/btsync_arm.tar.gz
tar -xzvf btsync_arm.tar.gz

#delete unneeded files
rm LICENSE.TXT btsync_arm.tar.gz

#download service file
cd /etc/systemd/system
wget http://dl.dropbox.com/u/42238/pogoplug/v2/btsync.service

#start btsync
systemctl start btsync

#autostart btsync on reboot
systemctl enable btsync


#http://pogoplug:8888/gui



Transmission, Sabnzbd, SickBeard and CouchPotato

Requires a swap partition or swapfile - 1GB recommended.

pacman -Sy sabnzbd sickbeard-git couchpotato-git transmission-cli python2-pyopenssl

#start and stop all apps to create config files
systemctl start transmission sabnzbd couchpotato sickbeard

#check status
systemctl status transmission sabnzbd couchpotato sickbeard

#shut them down
systemctl stop transmission sabnzbd couchpotato sickbeard

#transmission - allow login from any computer
cd /var/lib/transmission/.config/transmission-daemon/

sed -i 's^"rpc-whitelist-enabled": true^"rpc-whitelist-enabled": false^' ./settings.json

#sabnzbd - allow login from any computer
cd /opt/sabnzbd
sed -i 's^host = localhost^host = 0.0.0.0^' ./sabnzbd.ini

#start all
systemctl start transmission sabnzbd couchpotato sickbeard


#auto start after reboot
systemctl enable transmission sabnzbd couchpotato sickbeard

#make sure you change the permission of your folders appropriately
#chmod 777 /media/usb/share/downloads

# sabnzbd - http://alarm:8080
# couchpotato - http://alarm:5050/
# sickbeard - http://alarm:8081/
# transmission - http://
alarm:9091

TimeMachine Backup
Configure Netatalk in Arch Linux for Time Machine Goodness


OpenVPN (Client)

As a reference please check out my other two tutorials on OpenVPN:
[Tutorial - 30 Minutes or Less] Site to Site VPN with TomatoUSB and OpenVPN
[Tutorial] CentOS 6 OpenVPN Client - Connecting to Existing Site to Site VPN (TomatoUSB)


pacman -Sy openvpn

#generate keys on CA and copy them over
mkdir -p /etc/openvpn/keys

#copy sample client.conf to /etc/openvpn
cp /usr/share/openvpn/examples/client.conf /etc/openvpn

#edit openvpn client.conf
nano /etc/openvpn/client.conf

#Update the following lines
#remote vpnserverIPAddress 1194
#ca /etc/openvpn/keys/ca.crt
#cert /etc/openvpn/keys/pogoplug.crt
#key /etc/openvpn/keys/pogoplug.key

#start VPN manually to test
openvpn --config /etc/openvpn/client.conf

#autostart OpenVPN client on reboot
systemctl enable openvpn@client.service

Webmin

pacman -Sy webmin perl-net-ssleay nano


#allow any IP to connect
sed -i 's^127.0.0.1^0.0.0.0' /etc/webmin/miniserv.conf

#start webmin
systemctl start webmin

#auto start after reboot
systemctl enable webmin


#https://alarm:10000


Mongoose (Simple Web Server)
https://code.google.com/p/mongoose/


pacman -U http://dl.dropbox.com/u/42238/pogoplug/v2/mongoose-3.7-1-arm.pkg.tar.xz
pacman -Sy php-cgi

#Optional - Edit mongoose.conf

#nano /etc/mongoose/mongoose.conf

systemctl start mongoose
systemctl enable mongoose

#place files in /srv/http
#Access Web Server @ http://alarm:8088


OwnCloud (nginx php-fpm sqlite)

Note - I'm no longer actively working on owncloud. The default PogoPlug software works well enough for my needs. There is a bug with using a self sign certificate (expect a WebDav error). You'll need to mount a different disk for your owncloud data folder - /srv/http/owncloud/data (I was not able to get owncloud working if I used a different data folder path).

pacman -Sy owncloud nginx php-fpm sqlite3 php-sqlite

#copy owncloud files

cd /srv/http
cp -R /tmp/owncloud .

#update owner

chown http:http /srv/http/owncloud 
chown http:http /srv/http/owncloud/config
chown http:http /srv/http/owncloud/apps


#uncomment out required modules
sed -i 's^;extension=gd.so^extension=gd.so^' /etc/php/php.ini
sed -i 's^;extension=xmlrpc.so^extension=xmlrpc.so^' /etc/php/php.ini
sed -i 's^;extension=zip.so^extension=zip.so^' /etc/php/php.ini
sed -i 's^;extension=iconv.so^extension=iconv.so^' /etc/php/php.ini
sed -i 's^;extension=sqlite3.so^extension=sqlite3.so^' /etc/php/php.ini
sed -i 's^;extension=pdo_sqlite.so^extension=pdo_sqlite.so^' /etc/php/php.ini



#Maximum execution time of each script, in seconds
sed -i 's^max_execution_time = 30^max_execution_time = 300^' /etc/php/php.ini



#Maximum amount of time each script may spend parsing request data.
sed -i 's^max_input_time = 60^max_input_time = 600^' /etc/php/php.ini



#Maximum allowed size for uploaded files.
sed -i 's^upload_max_filesize = 2M^upload_max_filesize = 100M^' /etc/php/php.ini



#Maximum size of POST data that PHP will accept.
sed -i 's^post_max_size = 8M^post_max_size = 400M^' /etc/php/php.ini


#Maximum amount of memory a script may consume
sed -i 's^memory_limit = 128M^memory_limit = 512M^' /etc/php/php.ini



#http://doc.owncloud.org/server/5.0/admin_manual/installation/installation_others.html#nginx-configuration

#backup config and download working nginx.conf
cd /etc/nginx 

mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.original
wget http://dl.dropbox.com/u/42238/pogoplug/nginx.conf



#Configure SSL
#http://wiki.nginx.org/HttpSslModule


#create folder to store certs
mkdir -p /etc/nginx/certs
cd /etc/nginx/certs

#Now create the server private key

#you'll be asked for a passphrase
openssl genrsa -des3 -out pogoplug.key 1024

#Create the Certificate Signing Request (CSR):
openssl req -new -key pogoplug.key -out pogoplug.csr

#Remove the necessity of entering a 
passphrase 
#for starting up nginx with SSL using the above private key:
cp pogoplug.key pogoplug.key.org

openssl rsa -in pogoplug.key.org -out pogoplug.key

#sign the certificate using the above private key and CSR
openssl x509 -req -days 3650 -in pogoplug.csr -signkey pogoplug.key -out pogoplug.crt


#start nginx and php-fpm
systemctl start php-fpm
systemctl start nginx

#autostart nginx and php-fpm after reboot
systemctl enable php-fpm
systemctl enable nginx


#Finish configuration via https://PogoPlugIPAddress/owncloud/ or https://pogoplug/owncloud




Backup and Restore

Having a backup is always a good idea and is highly recommended. Its quick and simple and will save you the hassle of re-installation from scratch if anything ever happens to your flash drive (very common) or if you want to duplicate/clone your setup to another Pogoplug.

Offline Backup (Recommended) - These two methods, Disk Image and Tarball, requires unplugging the usb drive you want to backup and plugging it into another linux computer or VM, another pogoplug running ALARM (Arch Linux ARM), or same Pogoplug running alarm using a different USB flash drive.

Credit/Reference

1) Disk Image

#assumes /dev/sdb is the flash drive you want to backup
dd if=/dev/sdb of=/savetopath/pogoplug.e02.rootfs.backup.img bs=4M


#restore, swap if (in) and of (out)
dd if=/savetopath/pogoplug.e02.rootfs.backup.img of=/dev/sdb

2) Tarball (recommended and what I use)

#assumes the flash drive you want to backup is /dev/sdb1

mkdir /tmp/usb
mount /dev/sdb1 /tmp/usb

#backup to root
cd /tmp/usb
tar -cvzf /pogoplug.e02.rootfs.backup.tar.gz ./

#restore
cd /tmp/usb
tar -xzvf /pogoplug.e02.rootfs.backup.tar.gz

Online Backup using rsync
http://mouhassan.wordpress.com/2012/06/30/backing-up-arch-linux-arm-alarm-on-pogoplug/


NTFS Formatted Drives

I'm not a fan of using NTFS drives with the Pogoplug for various reasons - performance, complexity, non-native linux, etc. If you have the option, my recommendation is to keep things simple and dedicate a ext3 formatted drive to your Pogoplug.

However, I understand in certain cases you have no choice - like when your data is already on a NTFS drive and you have nowhere to back it up. So saying that, try the following:

pacman -Sy ntfs-3g udevil
systemctl enable devmon@root.service
systemctl start devmon@root.service
df -h
#you should see your drive mounted under
#/media/xxx

#You might need to edit
nano /etc/udevil/udevil.conf



Please see Obihoernchen's blog for some NTFS performance tip. Also note, people have reported boot up issues with NTFS drives attached.

Again, this is something I don't use so I can not support it. And again, keep things simple and use a dedicated ext3 drive if possible.


Reverting Back to Stock

E02 model only. V4 doesn't have the option to boot to stock OS with USB flash drive unplugged.
Credit to Moustafa.

This isn't truly reverting your Pogoplug back to stock. What it will do is allow you to disconnect your USB flash drive from your Pogoplug and have it boot up to the default Pogoplug OS and connect to the my.pogoplug.com service.

During the uBoot installation, the script asks whether to disable pogoplug service, and the default answer is y

Would you like to disable the pogoplug services? [Y/n]

You can turn back on the my.pogoplug.com service by the following steps:
  1. Boot into original firmware (disconnect all USB drives)
  2. Connect using SSH
  3. Edit /etc/init.d/rcS script, and remove the comment(#) in front of the line reading /etc/init.d/hbmgr.sh start
After rebooting into original firmware again, the my.pogoplug.com services will be available as before.

Troubleshooting ALARM Boot Up Issues

The most common (and frustrating) issue with the Pogoplug and Arch Linux ARM is getting your Pogoplug to boot up consistently. This is not going to be an exhaustive troubleshooting guide, but I did want to point out some things I've learned and experienced that may help you.

- Double check your router for the correct IP Address of your Pogoplug. Otherwise use a network scanning tool like AngryIP (Legacy) to confirm the IP Address of your Pogoplug. On my iPhone, I use a free app call iNet.

- Not all USB drives (flash or hd) will behave the same. Use a high quality name brand USB drive if possible. If you experience boot up issues, try a different USB flash drive or hard drive. I've noted the USB drives that I've had success with above.

- USB flash drive or hard drive is corrupted due to improper shutdown. Plug the flash drive into a linux computer or another Pogoplug running ALARM and perform a fsck.

#/dev/sdb1 = drive and partition that needs fixing
fsck /dev/sdb1

- A cold/hard boot (disconnect/reconnect power cord) can behave differently than a warm boot (executing the 'reboot' command via the console). Yes, very strange. I've experienced where if I do a cold boot, the default Pogoplug OS will boot up and not ALARM. However, if I execute a reboot command from within the default Pogoplug OS, ALARM will boot up properly. I've also experienced the opposite, where ALARM will boot up properly from a cold boot, but if I execute a 'reboot' command via the console, ALARM will not boot properly. This all depends on your USB flash/hard drive. Try the following, it may help and typically it shouldn't hurt. I'm using the below bootcmd for two of my Pogoplugs with Western Digital My Passport drives.

#E02 - Only. Fix boot issue with some USB drives
#credit - http://archlinuxarm.org/forum/viewtopic.php?f=18&t=1717&p=9527#p9527
#print default bootcmd value
fw_printenv bootcmd

#default bootcmd
#[root@pogoplug ~]# fw_printenv bootcmd

#bootcmd=usb start; run force_rescue_bootcmd; run ubifs_bootcmd; #run usb_bootcmd; usb stop; run rescue_bootcmd; run pogo_bootcmd; #reset

#update bootcmd value to start, stop and start usb again
#all one line
fw_setenv bootcmd "usb start; usb stop; usb start; run force_rescue_bootcmd; run ubifs_bootcmd; run usb_bootcmd; usb stop; run rescue_bootcmd; run pogo_bootcmd; reset"


#confirm update
fw_printenv bootcmd

- If you plan to attach a hard drive for SAMBA, try installing ALARM on a small partition on the hard drive (4GB) and skip using a USB flash drive. This will allow you to avoid any boot up issues related to multiple USB drives attached. [Update - 9/25/2013] I've updated the SAMBA installation section.

- If you have multiple USB drives attached, try Moustafa blog - Booting Pogoplug From The Correct USB Disk. Note that Moustafa's blog isn't applicable if you're having boot up issues with only one USB drive attached.

Setup Netconsole to see what truly is happening. Netconsole allows you to remotely view the Pogoplug boot up process. Here is a tutorial on setting up Netconsole.

- Do a re-installation. Unplug your USB drive and start over. During the uboot installation, reset the uboot env back to default.

- Try using a static IP Address. After installing ALARM to your USB drive (do not reboot), while still in the Pogoplug OS, edit the /tmp/usb/etc/netctl/eth0 file. You'll need to use vi (google if you're not familiar with using vi).

#while in the Pogoplug OS, after installing ALARM
vi /tmp/usb/etc/netctl/eth0

The content of the eth0 file should look like the following:

Description='A basic static ethernet connection'
Interface=eth0
Connection=ethernet
IP=static
Address=('192.168.1.100/24')
Gateway='192.168.1.1'
DNS=('192.168.1.1')

- Corrupted uBoot Environment. You'll need to reset via a Serial console. Please see my tutorial on setting up a Serial Console Connection for the Pogoplug E02.

Miscellaneous Commands

#update hostname to pogoplug
hostnamectl set-hostname pogoplug

#change password
passwd

#poweroff (note that the light will not turn off)
sync #just in case
poweroff

#check what ports are used/listening on
netstat -nptl

#check disk space usage, human readable output
df -h


-------------------------------------------------------------------

That's it for now.

Please leave a comment if this is helpful or if you run into any issues. Thanks

Please consider donating to the Arch Linux ARM group. They are the ones that made this possible.