How to install Arch Linux, My.Pogoplug and Samba on Pogoplug 4

The Pogoplug is a small but powerful device. On my last tutorial I showed you how to install SAMBA on Pogoplug 4, Pogoplug Pro and Pogoplug Office devices.

Now we’re going to do something more “adventurous”: completely change Pogoplug’s firmware by installing ArchLinux. Then we’re gonna install Samba, while still connecting the device to My.Pogoplug in order to have all the benefits from their “cloud solution”.

Please note that this tutorial doesn’t apply on Pogoplug Classic and Pogoplug Mobile devices. Don’t try to copy/paste this tutorial on Clasic/Mobile, you will brick your devices!

Content:

Disclaimer
– Prerequisites
– Part 1: Installing Arch Linux on Pogoplug 4
—- A. Connecting and preparing your device
—- B. Partitioning the USB Stick or SATA drive
—- C. Downloading and installing Arch Linux ARM
—- D. Downloading and installing U-Boot (bootloader):
– Part 2: Installing My.Pogoplug on Arch Linux
—- A. Downloading and installing My.Pogoplog
—- B. Verifying your device on the Pogoplug network
—- C. Mounting external drives
—- D. Configuring My.Pogoplug
—- E. Enabling and Starting My.Pogoplug
—- F. Registering on the Pogoplug network
—- G. Changing the hostname (optional)
Part 3: Installing and configuring SAMBA on Pogoplug 4
Useful? Buy me a drink.

Disclaimer:

– by following this tutorial you will void your device’s warranty;
– you need a basic understanding of how Linux works. If you don’t know anything about Linux, than you’re better off keeping the firmware untouched;
– even if this is a “copy/paste-based” tutorial, a lot of things can change in time and a lot of things can go wrong;
– I am not responsible for any errors this tutorial might cause;
– you can easily brick your device;

Prerequisites:

– setup your Pogoplug as a “normal” Pogoplug (activate it, set it up, etc);
– insert a blank USB stick or SD card, formatted as FAT32. Please note that this stick/card will contain all the necessary files for running Samba. You will need to keep this stick/card inserted on your Pogoplug;
– go to http://my.pogoplug.com -> Settings -> Security -> check “Enable SSH access for this Pogoplug device” and enter a password;
– SSH to your Pogoplug’s LAN IP by using Putty or any other SSH client (port 22). The username is “root” and the password is the one you’ve set at the previous point. If you don’t know how to find the LAN IP of your Pogoplug I strongly recommend you to stop at this point, as you obviously don’t have the necessary technical skills and you will probably damage/brick your device.

So, let’s begin.

Part 1: Installing Arch Linux on Pogoplug 4

This part is mainly inspired from the official ArchLinux documentation.

A. Connecting and preparing your device

1. Insert a USB 2.0 stick or SATA drive on the top port. The device cannot boot from the USB 3.0 ports or from the SD card!

2. With only the drive you intend to install Arch Linux ARM to plugged in (all data will be erased!!!), switch on the power.

3. Get the IP from your router and log in to the Pogoplug via SSH, port 22.

4. Stop the Pogoplug software so it doesn’t interfere with the install process:

killall hbwd

B. Partitioning the USB Stick or SATA drive

5. Start fdisk to partition the USB2 or SATA drive:

/sbin/fdisk /dev/sda

You should see:

Command (m for help):

6. Type “o.” This will clear out any partitions on the drive.

You should see:

Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that the previous content won't be recoverable.

7. Type “p” to list partitions. There should be no partitions left.

You hould see something similar, based on the stick/drive you’ve inserted:

Disk /dev/sda: 2003 MB, 2003828736 bytes
255 heads, 63 sectors/track, 243 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks  Id System

If you see anything under “Device” than something is wrong, start over.

8. Now type “n”.

You should see:

Command action
   e   extended
   p   primary partition (1-4)

9.  Type “p” for primary.

You should see:

Partition number (1-4):

10. Type “1” for the first partition on the drive, and then press ENTER, accepting default values.

You hould see something similar, based on the stick/drive you’ve inserted:

First cylinder (1-243, default 1): Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-243, default 243): Using default value 243

11. Exit by typing w.

You should see:

The partition table has been altered!
Calling ioctl() to re-read partition table

12. Now we can create the ext3 filesystem:

cd /tmp
wget http://archlinuxarm.org/os/pogoplug/mke2fs
chmod +x mke2fs
./mke2fs -j /dev/sda1

After executing these 4 commands you should see something similar, based on the stick/drive you’ve inserted:

mke2fs 1.41.9 (22-Aug-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
122160 inodes, 487966 blocks
24398 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=503316480
15 block groups
32768 blocks per group, 32768 fragments per group
8144 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

13. Mount the newly created partition:

mkdir alarm
mount /dev/sda1 alarm

C. Downloading and installing Arch Linux ARM

14. Download Arch Linux ARM:

cd alarm
wget http://archlinuxarm.org/os/ArchLinuxARM-kirkwood-latest.tar.gz

It’s a ~170mb file, but it will take some time (5-15 minutes), depending on your connection and/or mirror’s load.

15. Uncompress the archive:

tar -xzf ArchLinuxARM-kirkwood-latest.tar.gz

This will take around 5-7 minutes. If it takes more than 8 minutes, start over with a speedier/better USB stick.

16. Now let’s clear some space by removing the archive:

rm -rf ArchLinuxARM-kirkwood-latest.tar.gz

17. Sync everything:

sync

This can take a while, depending on your drive, but not longer than 5-7 minutes.

18. Finally unmount the drive:

cd ..
umount alarm

 D. Downloading and installing U-Boot (bootloader):

19. Go back to /tmp, download U-Boot and run the installer:

cd /tmp
wget http://archlinuxarm.org/os/ppv4/ppv4-install.sh
chmod +x ppv4-install.sh
./ppv4-install.sh

The install procedure should post something like this:

######################################
##
## Pogoplug Series 4 U-Boot Installer
##
######################################

## PREPARATION
# Switching to /tmp...
# Ensuring we're ready to proceed...
killall: hbwd: no process killed
# Checking board revision...
#############################
## RETRIEVING FILES
# Downloading U-Boot files..
[ETC ETC - connecting and downloading]
Length: 199485 (195K) [application/octet-stream]
Saving to: `uboot.bin.gz'

100%[=====================================================================================================================================================================>] 199,485      273K/s   in 0.7s

2014-07-20 20:59:03 (273 KB/s) - `uboot.bin.gz' saved [199485/199485]

# Verifying MD5
# Decompressing

#############################
## FLASHING NAND
# Erasing mtd0 @ 0x100000 for 4 erase blocks (new U-Boot location)
Erase Total 4 Units
Performing Flash Erase of length 131072 at offset 0x160000 done
# Flashing U-Boot..
Writing data to block 8 at offset 0x100000
Writing data to block 9 at offset 0x120000
Writing data to block 10 at offset 0x140000
Writing data to block 11 at offset 0x160000
# Done

#############################
## UPDATING ENVIRONMENT

#############################
## U-Boot install complete!

If you notice errors than something is obviously wrong, you should start over.

20. Reboot your device.

/sbin/reboot

21. Congratulations, you’re done installing Arch Linux ARM! Now you should be able to connect to your device by using the same IP.

The default username is “root” and the default password is “root”.

22. Reconnect to your device, login (root/root) and change the default password:

passwd

23. Update all packages by using “pacman”:

pacman -Syu

You should see something like this:

:: Synchronizing package databases...
 core                                                                                               168.6 KiB   148K/s 00:01 [###########################################################################] 100%
 extra                                                                                             1992.4 KiB   382K/s 00:05 [###########################################################################] 100%
 community                                                                                            2.3 MiB   597K/s 00:04 [###########################################################################] 100%
 alarm                                                                                               28.5 KiB  6.95M/s 00:00 [###########################################################################] 100%
 aur                                                                                                 63.3 KiB   154K/s 00:00 [###########################################################################] 100%
:: Starting full system upgrade...
resolving dependencies...
looking for inter-conflicts...

Packages (42): [ETC ETC - list of packages]

Total Download Size:    75.48 MiB
Total Installed Size:   214.35 MiB
Net Upgrade Size:       8.36 MiB

:: Proceed with installation? [Y/n]

24. Confirm with “y”. You should see:

:: Retrieving packages ...
 bash-4.3.018-3-arm 1176.8 KiB   587K/s 00:02 [###########################################################################] 100%
[ETC ETC - packages list, installing, downloading]
synchronizing filesystem...

This can take a while, depending on how many packages need to be updated.

25. Finally reboot, in order to be sure that everything works properly.

reboot

Give yourself a treat, you’re done with this part. 🙂

Part 2: Installing My.Pogoplug on Arch Linux

This part is inspired from this thread. Please note that I’m not the maintainer of that thread, nor involved in any way in that project.

A. Downloading and installing My.Pogoplog

26. Install wget:

pacman -S --noconfirm wget

27. Go to “/root” and download the latest My.Pogoplug package.

cd /root
wget http://dl.dropboxusercontent.com/u/15043728/ArchLinuxArm/my.pogoplug.com/pogoplug-X.X.arm.pkg.tar.xz

IMPORTANT: in order to get the latest package please access this thread. I’ve inserted “X.X” in order to stop you from downloading outdated packages, so please don’t complain about “ERROR 404: Not Found”.

28. Install the My.Pogoplug package:

pacman -U --noconfirm pogoplug-*-arm.pkg.tar.xz

You should see something like this:

(1/1) installing pogoplug                                                                                                    [###########################################################################] 100%
Preventing updates...
***********************************************************
Run
/usr/local/cloudengines/bin/hbplug | grep "Device ID\|CRYPTO"
several times until CRYPTO KEY says VALID and wait 60 sec
after running it each time.

If after 5 attempts it still says UNSET
reboot the device and try again.

When it finally says valid, copy the generated Device ID
to /usr/local/cloudengines/bin/hbplug.conf under svcid
variable, then move hbplug.conf to /etc/pogoplug.conf
mv /usr/local/cloudengines/bin/hbplug.conf /etc/pogoplug.conf

Beware! each CRYPTO KEY is tied to DEVICE ID
And each reboot you will have a new DEVICE ID
until you have it fixed in /etc/pogoplug.conf
***********************************************************
Don't forget to (re)register your device at my.pogoplug.com
synchronizing filesystem...

B. Verifying your device on the Pogoplug network

29. Run the registration command:

/usr/local/cloudengines/bin/hbplug | grep "Device ID\|CRYPTO"

The first time you will run the command you will see something like this:

[154557.875][MAIN  ][HBPLUG][08] CRYPTO KEY: UNSET
[154558.326][MAIN  ][HBPLUG][08] Device ID: A66P989XXXXXX3YYYYYYYAWTAB

As you can see the “CRYPTO KEY” is “UNSET”.

30. Run the registration command, again:

/usr/local/cloudengines/bin/hbplug | grep "Device ID\|CRYPTO"

Your device should be registered. The crypto key should state something like this:

[154743.363][MAIN  ][HBPLUG][08] CRYPTO KEY: VALID
[154743.565][MAIN  ][HBPLUG][08] Device ID: A66P989XXXXXX3YYYYYYYAWTAB

31. If the crypto key is “VALID” than press “ctrl+c” in order to get back to the terminal.

Notes:

– If the device doesn’t register from the second time don’t worry, run it again;
– You cannot run the registration command for more than five (5) times. After five retries you need to reboot the device (by using the “reboot” command) and run the registration command again (step #30). The device will eventually register. Run the command again & reboot until it registers;

C. Mounting external drives

If the drive you’re trying to attach is NTFS partitioned, please follow step #32.1. If the drive is EXT partitioned than please follow step #32.2.

32.1. (ignore if you have an EXT partitioned drive!) Most external USB & SATA drives are NTFS partitioned. In order to mount them you need you should install “ntfs-3g”.

pacman -S --noconfirm ntfs-3g

==================================

32.2. (ignore if you have an NTFS partitioned drive!) If your external drive is EXT partitioned than you already know how to mount a drive.

But for example’s sake, you should list the partitions:

lsblk -f

Note the second drive:

NAME   FSTYPE LABEL UUID                                 MOUNTPOINT
sda
└─sda1 ext3         bbf501fc-1480-4936-b171-2a4ea730465c /
sdb
└─sdb1 ext4   2tb   E0D20B59D20B3378

Create the mount directory:

mkdir /mnt/usbdrive

Edit fstab:

nano -w /etc/fstab

Insert the device and mount directory:

/dev/sdb1 /mnt/usbdrive ext4 defaults 0 0

Jump to step #35.

==================================

33. Connect the USB or SATA drive, then see what’s the drive name:

lsblk -f

You should see something like this:

NAME   FSTYPE LABEL UUID                                 MOUNTPOINT
sda
└─sda1 ext3         bbf501fc-1480-4936-b171-2a4ea730465c /
sdb
└─sdb1 ntfs   2tb   E0D20B59D20B3378

As you can see I have two drives connected:

– sda1, which is partitioned “ext3”, it’s the USB 2.0 stick I’m using for the filesystem;
– sdb1, which is partitioned “ntfs”, it’s the external drive I’m trying to mount.

So in this example my external drive is “sdb1”. Yours can have another name, so please note it down.

33. We’re gonna create the directory in which we’ll mount the drive:

mkdir /mnt/usbdrive

You can use any other name for “usbdrive”, just keep it inside the “/mnt/” directory.

33. Now let’s mount the external drive at startup. Edit “/etc/fstab”:

nano -w /etc/fstab

You should see something like this:

#
# /etc/fstab: static file system information
#
# <file system> <dir>   <type>  <options>       <dump>  <pass>

34. Insert the device and mount directory, at the end of the file:

/dev/sdb1 /mnt/usbdrive ntfs-3g defaults 0 0

Save with “ctrl+x”

Note: don’t forget to replace “sdb1” and “/mnt/usbdrive” with the values you’ve previously noted!

35. Reboot, in order to load the drive and be sure that everything is ok:

reboot

36. Reconnect to the device and try to make a test directory.

cd /mnt/usbdrive
mkdir pogoplug-test-directory
ls -la

You should see all the files & folder from your USB/SATA drive, including “pogoplug-test-directory”. Example:

drwxrwxrwx 1 root root     0 Feb 14 09:51 Photos
drwxrwxrwx 1 root root     0 Jul 20 16:17 pogoplug-test-directory
drwxrwxrwx 1 root root     0 Feb 14 09:57 Videos
drwxrwxrwx 1 root root  8192 Feb 10 17:08 Work

If you get any errors like “Could not create” or “Filesystem is read-only” please start over from step #32.

If everything is ok you should remove the test directory:

rm -rf pogoplug-test-directory

D. Configuring My.Pogoplug

Right now we have the My.Pogoplug daemon installed and the external drive mounted. So in the next step we’ll edit the configuration file in order for “the cloud” to “see” the drive.

37. Move the configuration file to its right place:

mv /usr/local/cloudengines/bin/hbplug.conf /etc/pogoplug.conf

38. Edit the configuration file:

nano -w /etc/pogoplug.conf

You should see something like this:

installdir=/usr/local/cloudengines
tcpport=89
datadir=.
nohotplug=1
svcid=A66P989XXXXXX3YYYYYYYAWTAB

39. At the end of the file insert:

vfsdir0=plugdata,/mnt/usbdrive

Save with “ctrl+x”.

Note: don’t change order of variables! Add more directories under each other. Example:

vfsdir0=...... 
vfsdir1=...... 
vfsdir2=......

E. Enabling and Starting My.Pogoplug

40. Enable My.Pogoplug so the daemon will run at device startup:

systemctl enable pogoplug.service

41. Now you can start the service:

systemctl start pogoplug.service

You can see the status of the service by running:

systemctl status pogoplug.service

You should see something like this:

● pogoplug.service - my.pogoplug.com service daemon
   Loaded: loaded (/usr/lib/systemd/system/pogoplug.service; enabled)
   Active: active (exited) since Sun 2014-07-20 17:00:37 MDT; 28s ago
  Process: 293 ExecStart=/usr/bin/sh /usr/local/cloudengines/pogoplug.sh (code=exited, status=0/SUCCESS)
 Main PID: 293 (code=exited, status=0/SUCCESS)

Jul 20 17:00:37 alarm sh[293]: rm: cannot remove ‘./bin/hbplug.conf’: No such file or directory
Jul 20 17:00:37 alarm sh[293]: Starting hbplug:
Jul 20 17:00:37 alarm systemd[1]: Started my.pogoplug.com service daemon.

42. Now everything is put together, so let’s reboot and see if everything works properly:

reboot

F. Registering your device on the Pogoplug network

43. After rebooting:

– check if the external drive is mounted and writable (step #36);
– check if the service is running (step #41, except the start command).

If everything is fine than you should go ahead and activate the device as usually, through the Pogoplug website.

Congratulations, you’re done installing the My.Pogoplug daemon and registering your device in the Pogoplug network!

G. Changing the hostname

This part is optional. As you can see your device will is called “alarm”. You can change its name through the Pogoplug website -> Settings. Still this will not change the hostname, so your device will be listed as “alarm” on the network.

44. Change the name of the device:

hostnamectl set-hostname pogoplug

Obviously, you can replace “pogoplug” with anything else.

45. Edit “/etc/hosts”:

nano -w /etc/hosts

You will see something like this:

#
# /etc/hosts: static lookup table for host names
#

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1       localhost.localdomain   localhost
::1             localhost.localdomain   localhost

# End of file
127.0.0.1       upgrade.pogoplug.com

46. At the end of the “127.0.0.1” line, after “localhost”, leave a space and insert the previously set hostname. In our example the line should look like this:

127.0.0.1 localhost.localdomain localhost pogoplug

Save with “ctrl+x” and “reboot”. Your device should reboot with the new hostname.

Note: you can check the hostname by typing “hostname” and pressing “enter”.

Part 3: Installing and configuring SAMBA on Pogoplug 4

This is the last part of our tutorial. We will download, install and setup Samba, so you can upload/download files directly from your Windows network, without the need to install the Pogoplug software (which is *really* bad and useless). You can also map the network directory as a network drive.

47. Install Samba by using pacman:

pacman -S --noconfirm samba

This will take a while, as it requires to install ~120mb of dependencies.

48. In order to access your shares you need to create a Samba username.

First you should create a normal Linux user:

useradd pogoplug

Note: you can replace “pogoplug” with any other user.

Now you should create the Samba user.

pdbedit -a -u pogoplug

Note: the Samba user needs to have the same name as the Linux user you’ve previously created.

You will be asked to set a password. You will use this password in order to access your network share/drive.

For resetting the Samba password use this command:

smbpasswd pogoplug

Note: replace “pogoplug” with your Linux/Samba username you’ve previously created.

49. Copy the default Samba configuration file to /etc/samba/smb.conf

cp /etc/samba/smb.conf.default /etc/samba/smb.conf

50. Configure Samba by editing “/etc/samba/smb.conf”

nano -w /etc/samba/smb.conf

Use the arrow keys in order to navigate through the file. Use “ctrl+w” to search.

51. Edit the file by making the following modifications (you can already find them inside the file, so you just need to modify them):

workgroup = WORKGROUP
server string = Pogoplug

Note: you can rename “Pogoplug” into any other name. This will be the name your device will use your network.

hosts allow = 192. 127. 10.

Note: if your network is not using “192.X.X.X” or “10.X.X.X”, please edit the line accordingly.

52. Go at the end of the file and insert these lines:

[usbdrive]
comment = Pogoplug USB Drive
path = /mnt/usbdrive
valid users = pogoplug
public = no
writable = yes
printable = no
create mask = 0765

Notes:

– you can change the “[usbdrive]” line. This will be the directory listed as shared on your drive;
– you can change the comment value (Pogoplug USB Drive) into any other description. Just don’t delete the “comment = ” part;
– at “path” you should use the path you’ve created/mounted and used at step #33;
– at “valid users” you should use the Samba user you’ve created at step #48.

Save the file with “ctrl+x”.

53. Enable “smbd” and “nmbd” services” at device startup:

systemctl enable smbd
systemctl enable nmbd

54. Start the Samba daemon:

systemctl start smbd
systemctl start nmbd

You can check the status of both services by running:

systemctl status smbd
systemctl status nmbd

Both daemons should state something like this:

[ETC ETC]
Active: active (running)
[ETC ETC]

55. You’re done! Reboot the device for the last time and enjoy!

reboot

That’s it. CONGRATULATIONS! Please let me know if you have any questions or corrections by leaving a comment bellow.

Was this tutorial useful? Buy me a drink by using the “donate” button below. 🙂

12 Comments

  1. I followed your tutorial but cant get samba working.

    [FAILED] Failed to start Samba NetBIOS name server.
    See ‘systemctl status nmbd.service’ for details.
    Starting Samba SMB/CIFS server…
    [FAILED] Failed to start Samba SMB/CIFS server.

    [root@alarm ~]# systemctl status nmbd
    * nmbd.service – Samba NetBIOS name server
    Loaded: loaded (/usr/lib/systemd/system/nmbd.service; enabled)
    Active: failed (Result: exit-code) since Sun 2014-10-26 19:19:43 CET; 1min 8s ago
    Process: 182 ExecStart=/usr/bin/nmbd -D (code=exited, status=1/FAILURE)

    Oct 26 19:19:43 alarm systemd[1]: nmbd.service: control process exited, code=exite…s=1
    Oct 26 19:19:43 alarm systemd[1]: Failed to start Samba NetBIOS name server.
    Oct 26 19:19:43 alarm systemd[1]: Unit nmbd.service entered failed state.

    Is what I get 🙁

  2. What’s the model of this Pogoplug? does it work on any model of series 4
    ?

  3. Everything was going great. Thank you for your tutorial…but I rebooted at step 35 and I get the solid green light on the PP. My router cannot see it and therefore no IP Address. I cannot Putty into my Pogoplug.

    Any Advice?

    1. I booted into Ubuntu on my laptop and found I had fat fingered the line in the fstab file. I sudo’d and corrected it. I still cannot SSH into my PogoPlug.

      I am stuck…

      1. I received help from the Arch Linux ARM Forums. Mistyped a line in the fstab. I can Putty back in again.

  4. I followed all the instructions on the above guide and i can able to reach till arch installation. After installing arch and after the point of restarting manually “/sbin/reboot” i cant login into ssh using root as username and root as password. When opening ssh with root as username and enter root as a password it says invalid authentication.

    1. ssh doesnot allow direct root login. use the alarm/alarm login and su root/root

  5. Hello , after I rebooted at step 20 , My router cannot see it and therefore no IP Address. I cannot SSH into my PogoPlug. Anyone who can help me? Thank you a lot.

Leave a Comment

Your email address will not be published. Required fields are marked *