PogoplugV2

Installing Arch Linux and setting up everything on Plug Computers like PogoplugV2

Some weeks ago I’ve ordered a so called “Plug Computer”.PogoplugV2
These Computers are very small devices with an ARM SoC.
They are pretty cheap! I’ve got my PogoplugV2 for 10€ 🙂

I was lucky and got the gray version 😀
Some device info:

  • ARMv5te CPU (Marvell Kirkwood 1.2GHz)
  • 256MB RAM
  • 128MB NAND
  • 4 USB 2.0 Ports

Pretty great to use this device as a small homeserver/fileserver. Remember 10€!
I want to use my Pogoplug as a fileserver (for Windows PCs) and DLNA server to stream to my TV.
On top of that maybe some additional stuff in the feature 😉

But the default software sucks. No Samba support, no DLNA, no FTP, …
But this doesn’t matter because there is an Arch Linux for ARM Port.
This is an instruction how to install Arch Linux on a PogoplugV2.
Everything after the Arch Linux installation (Install Webmin, Samba, DLNA, …) can be used for all devices which run Arch Linux for ARM.

Prepare device and install Arch Linux

Arch Linux

Everything we have to do to install Arch Linux are 4 steps.

    1. Enabe SSH Access
    2. Format an USB Stick (min. 2GB size)
    3. Flash a custom Bootloader to boot from your USB Stick
    4. Install Arch Linux

An instruction how to do that is available here: http://archlinuxarm.org/platforms/armv5/pogoplug-v2-pinkgray
There are instuctions for other devices as well.
If you use Windows use PuTTY as a SSH client.

Setup everything

1. Login via SSH

Use PuTTY or another SSH client to access your Pogoplug.

username: root
password: root

 2. Change your root password

First you should change your root password.
Use the following command to do so:

 3. Update Arch Linux

Arch Linux has an own package manager called pacman.
With pacman you can install/remove packages and update Arch Linux.

To update Arch Linux use the following command:

 4. Change hostname and timezone

Note: For GUI lovers: skip this step and set hostname and timezone in the webmin interface (next step)

The default hostname is “alarm”. Let’s change it!

To get all available timezones use:

And to set your timezone:

For example:

Now reboot:

Wait a few seconds and reconnect to SSH.

 5. Install Webmin

Webmin is a pretty cool web-based interface for system administration.
It’s easy to use  and will help you to configure stuff faster.
To install it use:

Now we have to allow access from more IP addresses.
You have to edit the configuration file.

Find the following line: allow=127.0.0.1
Now add a new allow line with your local network broadcast ip or a specific ip and save the file.
For example:

Now we’ll enable & start the webmin service so it autostarts.

To access the Webmin interface open a browser and go to:
https://deviceip:10000

To lower memory usage go to:
Webmin>Webmin Configuration>Advanced Configuration and disable Pre-load Webmin functions library?”

 6. USB Auto Mount

If you want to remove your USB HDD and use it anywhere else it would be cool to have automounting like Windows.
There are a lot of auto mounting mechanisms for Arch Linux but a lot of them are outdated.
This one is using udevil to auto mount all USB HDDs on attach as /media/PARTITION_LABEL. So make sure all partitions have a label!

I want to access my HDDs via Samba to use them in Windows so I have to use either FAT32 or NTFS.
This sucks because FAT32 isn’t able to handle files >4GB so it’s useless.
And NTFS is fucking slow on Linux.

But with some special mount options we are able to increase the speed dramatically!
I’ve did some benchmarks with hdparm and dd before and after the optimization.
The read speed was pretty good already (about 29MB/s –> USB 2.0 limit).
But the write speed was really bad!

Before: ~6,5 MB/s write speed
After: ~28,5 MB/s write speed

As you can see the write speed on NTFS was really slow before. But there is a way to fix it 🙂
We have to edit the mount options and add a special ntfs-3g option to our udevil automount settings.
Open the udevil config file and edit it:

Search for default_options_ntfs= and allowed_options=

Now we add the option “big_writes” to both lines so it looks like:

Save the file.

Create the /media directory

Add the udevil service to autostart.

Let’s reboot to see whether it works

Wait a few seconds and reconnect to SSH.
Now you’ll have a new folder: /media/yourHDDname where your HDD is mounted.
And you should see something like /dev/sdX1 on /media/… if you type:

Note: All USB HDDs should go to standby automatically.
You can check with:

7. Blink LED to HDD activity

The PogoplugV2 has a green and orange LED.
So I thought it would be a cool idea change the color to HDD activity.
I’ve created an systemd service.

———————————

Only If you have a PogoplugV2!

You have to correct your arcNumber and matchid because there is a bug in the current uboot and your Pogoplug isn’t detected as a PogoplugV2.

———————————

We need the iostat binary to create our own deamon.
Iostat will check hdd activity.

Create a new file called /usr/lib/systemd/system/blinkled.service with the following content:

Create another file called /usr/local/bin/blinkled
This command is pretty long 😉 It will execute iostat every 3 seconds. If there is HDD activity the Pogoplug will start to blink orange.
You can change heartbeat to default-on or timer as well.

And make it executable

To start our service use:

To autostart use:

 8. Update Kernel to >3.2

Warning: This specific instruction works for PogoplugV2 only!
You can brick your device!

The current kernel for PogoplugV2 is 3.1.x but 3.8.x or newer is available.
You have to update manually because newer kernels need a new uboot.

You need the newest uboot to boot Kernels >3.2 so you have to install it before:
If this is a fresh installation you probably have the newest uboot already and you don’t have to do that!

Then you have to correct your arcNumber and matchid if you didn’t follow “Blink LED to HDD activity”.

Now you can install the new Kernel files with:

 9. Install Samba

See this post

10. Install MiniDLNA

Install MiniDLNA and enable the service.

Now edit the config file

It’s pretty easy to understand the config file and the documentation is well.
You have to set at least one media_dir
All USB devices are mounted at /media/DEVICE_LABEL
For example:

Here are some additional options you could set:

MiniDLNA will update the DB automatically.
If you have a lot of files (>8192) you should increase your max inotify value for a single user so MiniDLNA can watch all files.
Create /etc/sysctl.d/90-inotify.conf and insert the following:

MiniDLNA is able to use thumbnails or cover images.
I’ve created a small bash script which will generate thumbnails for videos recursively.
You need ffmpegthumbnailer to create these thumbnails.

Let’s create the script:

This script will generate a thumbnails for every video file recursively.
You can add even more extensions to the TYPES array.

See: https://github.com/Obihoernchen/generateThumbs

Make it executable:

Execute it with something like:

Now start MiniDLNA

12. Configure static IP

Be careful you can mess up your whole network connection!

I don’t like dynamic IP addresses in my LAN. Especially for servers.
They should have a static IP like every server. Of course there are hostnames but not all devices are able to resolve them.

Arch uses netcfg to configure your network adapters. You can create multiple profile.
To create a new static ip profile create a new profile in /etc/network.d/ named wired-static-eth0

And add the following content, replace everything with your values and save the file.
Note: I use custom DNS settings because my router doesn’t allow me to edit DNS settings.

Now you need to change the default network profile to the new one.

Find NETWORKS= and edit it:

You have to be sure that everything is correct otherwise you are going to loose network connection and have to edit all files from your USB stick with another PC.
Just restart the netcfg service or restart to apply the new settings

 13. Enable color in Bash prompt

The current terminal doesn’t look that nice. Everything is white and boring…
But we can change this so your terminal will look like this:

Terminal with color

Just replace /etc/bash.bashrc with the following content:

More information and other examples: https://wiki.archlinux.org/index.php/Color_Bash_Prompt

To search for available packages in repos if your command doesn’t exist on your current system configuration install pkgfile

14. Disable some logging to extend USB stick lifetime

Flash drives have limited number of write cycles and default linux logging will write pretty much so your USB will be destroyed pretty fast.
That’s why a swap file on your USB stick is a really bad idea!
But you can disable some logging to extend the liefetime of your USB stick.

Just edit syslog-ng.conf and disable some of the “log { source(src); filter…” lines at the end of the file.
You can comment out (add a “#” in front of the line) all lines if you want to disable everything.

I’ve disabled some of them. That’s my example:

On top of that you could disable logging of some servers like samba, minidlna and so on.
I don’t do that because I want to have these logs but to do so set the log path in the config files to /dev/null

184 thoughts on “Installing Arch Linux and setting up everything on Plug Computers like PogoplugV2”

  1. Hello, I think your site might be having browser compatibility issues.
    When I look at your blog site in Firefox, it looks fine but when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up!
    Other then that, awesome blog!

  2. Hi, thanks for the help, could figure out why the item ” 13. Enable color in Bash prompt” does not work properly? or help me solve? tks ..

    login as: alarm
    alarm@pogoplug’s password:
    Last login: Sat Apr 16 22:57:12 2016 from 192.168.1.32

    , _ _ _
    /#\ __ _ _ __ ___| |__ | (_)_ __ _ ___ __
    -bash: /etc/bash.bashrc: line 49: unexpected EOF while looking for matching
    -bash: /etc/bash.bashrc: line 127: syntax error: unexpected end of file
    [alarm@pogoplug ~]$

  3. Update….

    After configuring Samba the Pogo is now sort of visible on the network (not voluntarily… I still have to look for it with IP address) and is now connected to the Sonos as music library.

    Three thumb drives are connected to the Pogo now, the software and two larger ones with music (vFAT). I set them with the same comment and they work well together. I still need to resolve a few things such as permissions as I cannot write yet to these drives and potentially to make it appear as a server on the network.

    Thank you so much for this write up and the support… it is fun and useful.

    There are many sonos users that are looking for a solution to compact network storage that can be dedicated to the audio system. With either the Pogo-E02 or the V4 and a few small thumb drives they can get low energy low cost solution. Especially with the V4 where one can “burn” the software on SD card, and have very low profile NAS.

    I am sure that I’ll have more questions, but it works… thank you much,
    Eyal

  4. Another small win towards the goal — thank you…. Installing the ntfs-3g did the trick and now I can access and play the music from the Pogo on my Win 7.

    Also the status of the Pogo shows some encouraging signs…. this is a copy of the status page without the table lines:

    Media library
    Audio files 13022
    Video files 0
    Image files 0

    Connected clients

    ID Type IP Address HW Address Connections
    0 Generic UPnP 1.0 192.168.1.183 B0:83:FE:5E:1C:50 0
    1 Generic UPnP 1.0 192.168.1.67 00:0E:58:A8:C1:38 0
    2 Generic DLNA 1.5 192.168.1.251 C8:60:00:E2:1F:06 0

    The desktop I am working from is the 192….251 and the Sonos which is the 192…67 is looking for new DLNAs established some connection to the Pogo.

    However, the Sonos which is the goal… still not there….

    When I use the desktop version of the Sonos configuration software it doesn’t recognize the Pogo (it looks for network nodes).

    When I try the same from the Android app of Sonos it actually brings “//POGO-E02/Media” as one of the potential media libraries, but when I chose it, it fails with error message “There is no share media on the computer //POGO-E02”. It does the same whether I try to connect with or without user-name.

    Any further ideas?

    I also loaded the Samba, but still cannot see the Pogo as another server on the network.

    Thanks,
    Eyal

  5. Great Obi, so it is a V2.

    Seems like I have Linux version 4.0.4.1, but because I am not familiar with the lingo… I am not sure if this is the kernel version and if it require an upgrade. Should I take Steps 7 and 8 above as stated?

    [root@pogo-e02 ~]# uname -a
    Linux pogo-e02 4.0.4-1-ARCH #1 PREEMPT Mon May 18 02:08:33 MDT 2015 armv5tel GNU/Linux

    Regarding manual mount, it first failed with certain USB drives (500Gb HDD) with the following error:
    [root@pogo-e02 ~]# mount /dev/sdb1 /media
    mount: unknown filesystem type ‘ntfs’

    But when I tested a different device, a thumb drive (32Gb San disk) it worked with no subfolder of the device, but after reboot it showed up as you described. I am not sure what is wrong with the USB (2)HDD that was not recognized.

    Also, I can “see” the Pogo from Win 7 file system (Explorer) as miniDLNA (with odd properties), but it will not show or allow me to access the files on the thumb drive.

    Which log files will be helpful in this case?

    I guess something is missing in the system, or an install was incomplete as I don’t have hdparm on my system.

    Thanks for the patience and all the help…
    Eyal

  6. Hi Obi,
    Thank you again.
    Sonos connect is part of the Sonos Wifi audio system. The connect is mainly used to stream music from devices on the network to either Sonos components or to other/existing audio system via RCA plugs. It has a nice mobile app where you can control the music player from the phone.
    Basically, I bought the Pogo as a USB to LAN adaptor so I can connect an external HD to the network (as simple NAS) for the sonos as a music library storage. Well, the Pogo is not reachable from the Sonos in its native software, so I am following your very detailed recipe to create what I think I need.

    So far I got to Step 6 successfully and then after install of udevil, enabling it and reboot I don’t see anything in the /media or in the mount list. The devmon@root.service shows as running.

    What am I missing?

    The partitions of the USB thumb drive where I loaded the Arch and another USB HDD I connected to check are identified at the hardware partitions.

    Also, how do you find what the Pogo version I have – is it PogoplugV2 or not. Mine is a Pogoplug-E02 / Pogo-P22. And how can I verify the kernel version?

    I know it is novice questions…. and they are.

    Thank you
    Eyal

    1. Are you able to mount the partition of your HDD manually? Does this work?
      Are you able to automount a normal fat32 formatted usb stick?
      And please provide some logs.

      For kernel version just type uname -a
      Pogoplug-E02 should be Pogoplug v2 should look like the article picture.

  7. Hi Obi,
    It is an impressive post and great guide to make use of the pogo. I bought mine recently as simple NAS for Sonos Connect. With the software that comes with, I struggle to get the Sonos to see the Pogo. I haven’t touch unix/Linux systems for decades and your guide may be the reason I’ll do it…
    I do have a few questions before I start…
    a. is there a way to set the pogos (either Pogo-E02 or Pogo-V4) to do what I need?
    b. if not, which will be better for my purpose ?
    Thank you for the great work,
    Eyal

    1. Hi Eyal,

      glad to hear that. Thanks 🙂
      mhh I don’t know much about Sonos Connect.
      But if it is able to use native NAS it should work fine with a pogoplug and arch linux. Or you could use samba. Shouldn’t be a problem.

      Pogo v2 or v4 should be perfect for music streaming.

  8. I’m sorry, but, I have Pogo V4 (with the Sata on top.) and I copied your script verbatim into my bash.bashrc…

    I get an error at line 47 with an unexpected eol , and another unexpected eol at line 105.

    I have the latest ArchLinux installed in my Pogo using USB.

    I SSH in using BitviseSSH, and I have UTF-8 and the language set.

    What are all the things I need to check?

    1. I’m having the same problem with the bashrc.

      -bash: /etc/bash.bashrc: line 55: unexpected EOF while looking for matching
      -bash: /etc/bash.bashrc: line 133: syntax error: unexpected end of file

      What gives?

    2. For those with the bash.bashrc errors, try this one out: http://pastebin.com/jYmxCYpp

      It works on mine. I just combined elements from the file used on this site, and a working edited one found on another site. Source details are in the comments at the top of the file.

  9. Just a notice, I had some issues with streaming video from the Samba share when using those optimization settings in smb.conf. Also the video file copied to PC was choppy.

    When I stumbled upon this post http://archlinuxarm.org/forum/viewtopic.php?f=53&t=7660#p41853

    I commented the optimizations and left only

    socket options = TCP_NODELAY IPTOS_LOWDELAY

    Now the videos streamed without flaws and copied over as well. Speed is the same on the 100mbit LAN (11.5MB/s) and CPU usage when copying has dropped from 99% to 25-30%.

    Would be worth to write a disclaimer in the original post.

    Thanks for the rest of the tutorials though, helped me set up my pogo :]

  10. Used your tutorials to set up Archlinux, Samba and MiniDLNA on my Pogoplug v2 – works like a charm.
    Only problem is: MiniDLNA doesn’t rescan the attached drives. I can reach the drives via the Network-Section in the Windows-Explorer and can add files to them. But MiniDLNA doesn’t recognize them, the counter visible under MY_IP:8200 stays the same, even hours later. Any ideas how to solve this?

  11. First, thank you for the excellent tutorial! Newbie to all this and your site has helped me more than you know:)

    Trying to install the MiniDLNA. Understand all steps but stumped on:

    “It’s pretty easy to understand the config file and the documentation is well.
    You have to set at least one media_dir
    All USB devices are mounted at /media/DEVICE_LABEL”

    How the heck do I figure out my “DEVICE_LABEL”?

    Getting to last steps and having the “No such file or directory” error.

    Woody

    1. Hi,
      thank you 🙂

      That’s pretty easy. Attach your usb drive and do ls in /media
      ls /media
      Example output: cacheStick horst toshobi zincobi

      This will show you all mounted drives. Each folder is a drive with foldername = label of this drive.
      In this example chacheStick, horst, toshobi and zincobi are the device labels.

      If you want to change the label of a partition have a look at this: http://www.cyberciti.biz/faq/linux-partition-howto-set-labels/

  12. What about a guide for installing btsync (bittorrent sync)?
    I can get it to run, but only manually. Want it to start while booting.
    I think the archlinux wiki is not very easy to follow.

    1. It’s pretty easy to do this:
      Have a look at this teamspeak script (from another server ;)):

      /usr/lib/systemd/system/teamspeakd.service
      [Unit]
      Description=TeamSpeak3 Server
      After=network.target

      [Service]
      Type=oneshot
      RemainAfterExit=yes
      User=teamspeak
      Group=servers
      WorkingDirectory=/srv/teamspeak
      ExecStart=/srv/teamspeak/ts3server_startscript.sh start
      ExecStop=/srv/teamspeak/ts3server_startscript.sh stop

      [Install]
      WantedBy=multi-user.target

      Just create such a file for your btsync and change all parameters to your needs (should be self-explanatory).

      Then enable the startup script and start it. That’s all.
      systemctl enable teamspeakd
      systemctl start teamspeakd

      1. I tried to alter those settings but I culd not get it to work. Then I took the btsync.service from the “tarball” in AUR Respitory wich is the code undeneath. Still could not get it to run. The tarball package comes with alot of other stuff, like btync.install. But I dont need all that other config stuff in the pkg anyway, I only need for it to start on boot. btsync binary is in /usr/bin folder.

        [Unit]
        Description=Bittorent Sync service
        After=network.target

        [Service]
        User=btsync
        Group=btsync
        ExecStart=/usr/bin/btsync –config /etc/btsync.conf –nodaemon
        Restart=on-abort

        [Install]
        WantedBy=multi-user.target

        1. As usual i got it to work with some fiddeling, but I dont know what did the fix 😛 anyway here is my btsync.service file if anyone else needs to know what makes it work.

          [Unit]
          Description=Bittorent Sync service
          After=network.target

          [Service]
          Type=forking
          User=root
          Group=root
          ExecStart=/usr/bin/btsync
          # –config /etc/btsync.conf –nodaemon
          Restart=on-abort

          [Install]
          WantedBy=multi-user.target

  13. Regarding permissions and automount with udevil.
    I put my external disk in /media and share this folder with samba. But i can not write to the disk cause of permissions. I tried setting “mount_point_mode = 0755” in udevil.conf from 0755 to 0777 and add a “mount_point_mode_fat32 = 0777”
    The disk is still not writable over smb.

      1. fat32.
        I also tried to alter the “fmask” and “dmask” for “default_options_vfat”. But then I could not even read the disk. Atleast it responded to the change so maybe if i get the fmask and dmask right it will work.

          1. Yes I can write to it via ssh, atleast make a file and a folder. I thought the smb.conf was ok cause I can write to /media but not /media/my_external_disk

            Here is my smb.conf.

            [global]
            workgroup = WORKGROUP
            server string = POGOPLUG
            netbios name = POGOPLUG
            # hosts allow = 192.168.0.
            printcap name = /dev/null
            load printers = no
            disable spoolss = yes
            printing = bsd
            log file = /var/log/samba/log.%m
            max log size = 50
            security = user
            dns proxy = no

            # For public share without login
            map to guest = Bad User

            # Android bugix for reading files (samba4 bug see:
            unix extensions = false

            # Fix for file batch copy issues (see:
            oplocks = no
            level2 oplocks = no

            # Some Tuning (See Optimize Performance)
            socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
            write cache size = 2097152
            getwd cache = yes
            min receivefile size = 16384

            # Global security
            public = yes

            #============================ Share Definitions ==============================

            # Public
            #[Storage]
            # comment = Storage
            # read only = no
            # writeable = yes
            # path = /media/

            # whole HDD, only for Ksn
            [Storage]
            comment = Ksn
            public = no
            valid users = Ksn
            read only = no
            writeable = yes
            path = /media/


            Thank you :D

          2. mhh please try to login with your Ksn user via ssh and try to write to /media/my_external_disk.
            Did you try to set default_options_vfat = …, fmask=0000, dmask=0000,AND allowed_options = …, fmask=0133, dmask=0022, fmask=0000, dmask=0000,

            Please post the permissions of /media/my_external_disk.

          3. Lol, did not notice the replies came at the bottom now.
            Anyway I could not figure out how to enable ssh for my ksn user as the samba guide disabled it.
            Tried this: “usermod -s /sbin/login ksn” and then reboot

          4. I think the problem is that the disk is mounted by root user.

            I do a ls -l for my disk:
            drwxr-xr-x 20 root root 32768 Dec 31 1969 sdb1-ata-WDC_WD5000AAKS-0

            The disk is mounted and owned by root user. Trying some options in udevil…

  14. Hello so I have been following the directions to the best of my ability.
    in step 4, i get this:

    [root@alarm ~]# hostnamectl set-hostname myhostname
    Failed to get D-Bus connection: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory

    I moved on hoping that I would have more luck on a different step and I still have problems.
    when I type,

    [root@alarm ~]# systemctl enable webmin
    Operation failed: Invalid argument

    Hopefully someone can help me out with these issues! I’d love to get this thing running and usable already. Thanks in advance!

  15. hi,
    i dont see the code in “13. Enable color in Bash prompt”
    please can you fix that.
    i want that theme so bad!!! 🙂
    thanks

  16. Hi,

    Thank you for this customization post, most awesome 🙂

    I only can’r get the color prompt to show “ArchLinux” at boot.

    Otherwise all was good, thank you!

    J.

Leave a Reply

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