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:

passwd root

 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:

pacman -Syu

 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!

hostnamectl set-hostname myhostname

To get all available timezones use:

timedatectl list-timezones

And to set your timezone:

timedatectl set-timezone <Zone>/<SubZone>

For example:

timedatectl set-timezone Europe/Berlin

Now reboot:

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:

pacman -Sy webmin perl-net-ssleay

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

nano /etc/webmin/miniserv.conf

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:

allow=127.0.0.1 ## Allow local access
allow=192.168.0.0 ## Allows all users from 192.168.0.1 - 192.168.0.255

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

systemctl enable webmin
systemctl start webmin

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!

pacman -Sy udevil

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:

nano /etc/udevil/udevil.conf

Search for default_options_ntfs= and allowed_options=

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

..., noatime, big_writes, uid=...

Save the file.

Create the /media directory

mkdir /media

Add the udevil service to autostart.

systemctl enable devmon@root

Let’s reboot to see whether it works

reboot

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:

mount

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

hdparm -C /dev/sda

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.

pacman -Sy uboot-env
fw_setenv arcNumber 3542
fw_setenv machid dd6
reboot

———————————

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

pacman -Sy sysstat

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

[Unit]
Description=Blink LED if hard drive is active daemon

[Service]
Type=oneshot
ExecStart=/usr/local/bin/blinkled
ExecStop=/usr/bin/killall iostat
RemainAfterExit=true

[Install]
WantedBy=multi-user.target

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.

#!/bin/bash
/usr/bin/iostat -z -d 3 | /usr/bin/sed -u -e '1d' -e 's/Device.*/none/' -e 's/sd.*/heartbeat/' -e '/^$/d' > /sys/class/leds/status:orange:fault/trigger &

And make it executable

chmod u+x /usr/local/bin/blinkled

To start our service use:

systemctl start blinkled

To autostart use:

systemctl enable blinkled

 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!

cd /tmp
wget http://jeff.doozan.com/debian/uboot/install_uboot_mtd0.sh
chmod +x install_uboot_mtd0.sh
./install_uboot_mtd0.sh

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

pacman -Sy uboot-env
fw_setenv arcNumber 3542
fw_setenv machid dd6
reboot

Now you can install the new Kernel files with:

pacman -Sy linux-kirkwood linux-headers-kirkwood
reboot

 9. Install Samba

See this post

10. Install MiniDLNA

Install MiniDLNA and enable the service.

pacman -Sy minidlna
systemctl enable minidlna

Now edit the config file

nano /etc/minidlna.conf

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:

media_dir=V,/media/zincobi/Videos

Here are some additional options you could set:

friendly_name=POGOPLUG DLNA Server
db_dir=/var/cache/minidlna
log_dir=/var/log
presentation_url=http://YOUR_DEVICE_IP_HERE:8200/

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:

# Increase inotify max watchs per user for local minidlna
fs.inotify.max_user_watches = 100000

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.

pacman -Sy ffmpegthumbnailer

Let’s create the script:

nano /usr/local/bin/generateThumbs.sh

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

#!/bin/bash

DIR=$1

if [ -z "$DIR" ]; then
	printf "%sn" "This script will generate thumbnails for all video files inside the given directory"
	printf "%sn" "moviexy.avi --> moviexy.jpg"
	printf "%sn" "ffmpegthumbnailer is required"
	printf "%sn" "Usage: generateThumbs "
	exit 1
fi

TYPES=( mov mp4 avi mkv m4v xvid divx wmv mpg mpeg )

# Create a regex of the extensions for the find command
TYPES_RE="\("${TYPES[1]}
for t in "${TYPES[@]:1:${#TYPES[*]}}"; do
    TYPES_RE="${TYPES_RE}\|${t}"
done
TYPES_RE="${TYPES_RE}\)"

find "$DIR" -regex ".*.${TYPES_RE}" -type f | while read -r FILEPATH
do
	printf "%sn" "--- Start Thumbnailcreation for ---"
	printf "%sn" "$FILEPATH"
	THUMBFILE="${FILEPATH%.*}.jpg" # remove video ext. and add .jpg
	if [ -f "$THUMBFILE" ]; then
		printf "e[1;33m%se[0mn" "Thumbnail exists"
	else
		printf "e[1;32m%se[0mn" "Generating thumbnail..."
		ffmpegthumbnailer -i "$FILEPATH" -o "$THUMBFILE" -s 160 -q 10
	fi
	printf "%sn" "--- End Thumbnailcreation ---"
done
exit 0

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

Make it executable:

chmod u+x /usr/local/bin/generateThumbs.sh

Execute it with something like:

generateThumbs.sh /media/YOURDEVICELABEL/Videos

Now start MiniDLNA

systemctl 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

nano /etc/network.d/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.

CONNECTION='ethernet'
DESCRIPTION='A basic static ethernet connection using iproute'
INTERFACE='eth0'
IP='static'

#IP of your pogoplug
ADDR='192.168.0.2'

#ROUTES=('192.168.0.0/24 via 192.168.1.2')

#Gateway (For example your router)
GATEWAY='192.168.0.1'

#DNS set to ('Gateway IP') if you want to use the DNS your router provides
DNS=('8.8.8.8' '8.8.4.4')

## For IPv6 autoconfiguration
#IP6=stateless
## For IPv6 static address configuration
#IP6='static'
#ADDR6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#ROUTES6=('abcd::1234')
#GATEWAY6='1234:0:123::abcd'

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

nano /etc/conf.d/netcfg

Find NETWORKS= and edit it:

NETWORKS=(wired-static-eth0)

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

systemctl restart netcfg

 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:

# /etc/bash.bashrc
#
# https://wiki.archlinux.org/index.php/Color_Bash_Prompt
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !

# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.

# If not running interactively, don't do anything!
[[ $- != *i* ]] && return

# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control.
#  (E11)
shopt -s checkwinsize

# Enable history appending instead of overwriting.
shopt -s histappend

case ${TERM} in
        xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
                PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "3]0;%s@%s:%s
# /etc/bash.bashrc
#
# https://wiki.archlinux.org/index.php/Color_Bash_Prompt
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
# If not running interactively, don't do anything!
[[ $- != *i* ]] && return
# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control.
#  (E11)
shopt -s checkwinsize
# Enable history appending instead of overwriting.
shopt -s histappend
case ${TERM} in
xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
;;
screen)
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
;;
esac
# fortune is a simple program that displays a pseudorandom message
# from a database of quotations at logon and/or logout.
# Type: "pacman -S fortune-mod" to install it, then uncomment the
# following line:
# [[ "$PS1" ]] && /usr/bin/fortune
# Welcome Message
# Arch Linux Logo Welcome Message
c1="$(tput sgr0)$(tput setaf 4)"
c2="$(tput bold)$(tput setaf 4)"
c3="$(tput bold)$(tput setaf 0)"
echo
echo "        $c2,$c1                       _     _ _"
echo "       $c2/$c1#$c2\\$c1        __ _ _ __ ___| |__ | (_)_ __  _   ___  __"
echo "      $c2/$c1###$c2\\$c1      / _\` | '__/ __| '_ \\| | | '_ \\| | | \\ \\/ /"
echo "     $c2/$c1#####$c2\\$c1    | (_| | | | (__| | | | | | | | | |_| |>  <"
echo "    $c2/$c1##,-,##$c2\\$c1    \\__,_|_|  \\___|_| |_|_|_|_| |_|\\__,_/_/\\_\\"
echo "   $c2/$c1##(   )##$c2\\$c1"
echo "  $c2/$c1#.--   --.#$c2\\  $c3 A simple, elegant GNU/Linux distribution."
echo " $c2/$c1\`           \`$c2\\$(tput sgr0)"$'\n'
# Show date
DATE="$(tput setaf 1)[$(tput setaf 6)$(date)"
DATE="${DATE}$(tput setaf 1)]"
echo $DATE
# Show kernel info
KERNEL="$(tput setaf 1)[$(tput setaf 6)$(uname -srmn)"
KERNEL="${KERNEL}$(tput setaf 1)]"
echo "$KERNEL"$'\n'
# Reset colors
tput sgr0
# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS. Try to use the external file
# first to take advantage of user additions. Use internal bash
# globbing instead of external grep binary.
# sanitize TERM:
safe_term=${TERM//[^[:alnum:]]/?}
match_lhs=""
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs} ]] \
&& type -P dircolors >/dev/null \
&& match_lhs=$(dircolors --print-database)
if [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] ; then
# we have colors <img src="http://obihoernchen.net/wordpress/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley">
# Enable colors for ls, etc. Prefer ~/.dir_colors
if type -P dircolors >/dev/null ; then
if [[ -f ~/.dir_colors ]] ; then
eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then
eval $(dircolors -b /etc/DIR_COLORS)
fi
fi
# -- CUSTOM PS1 String START --
PS1="\$? \$(if [[ \$? == 0 ]]; then echo \"\[\033[01;32m\]\342\234\223\"; else echo \"\[\033[01;31m\]\342\234\227\"; fi) $(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h'; else echo '\[\033[01;32m\]\u@\h'; fi)\[\033[01;34m\] \w \$\[\033[00m\] "
#PS1="\[\033[0;37m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[0;31m\]\u\[\033[0;37m\]@\[\033[0;96m\]\h'; else echo '\[\033[0;33m\]\u\[\033[0;37m\]@\[\033[0;96m\]\h'; fi)\[\033[0;37m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;37m\]]\n\[\033[0;37m\]\342\224\224\342\224\200\342\224\200\076 \[\033[0m\]"
# --- Custom PS1 String END ---
# Use this other PS1 string if you want \W for root and \w for all other users:
# PS1="$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h\[\033[01;34m\] \W'; else echo '\[\033[01;32m\]\u@\h\[\033[01;34m\] \w'; fi) \$([[ \$? != 0 ]] && echo \"\[\033[01;31m\]:(\[\033[01;34m\] \")\$\[\033[00m\] "
alias ls="ls --color=auto"
alias dir="dir --color=auto"
alias grep="grep --colour=auto"
alias dmesg='dmesg --color'
man() {
env LESS_TERMCAP_mb=$'\E[01;31m' \
LESS_TERMCAP_md=$'\E[01;38;5;74m' \
LESS_TERMCAP_me=$'\E[0m' \
LESS_TERMCAP_se=$'\E[0m' \
LESS_TERMCAP_so=$'\E[38;5;246m' \
LESS_TERMCAP_ue=$'\E[0m' \
LESS_TERMCAP_us=$'\E[04;38;5;146m' \
man "$@"
}
# Uncomment the "Color" line in /etc/pacman.conf instead of uncommenting the following line...!
# alias pacman="pacman --color=auto"
else
# show root@ when we do not have colors
PS1="\u@\h \w \$([[ \$? != 0 ]] && echo \":( \")\$ "
# Use this other PS1 string if you want \W for root and \w for all other users:
# PS1="\u@\h $(if [[ ${EUID} == 0 ]]; then echo '\W'; else echo '\w'; fi) \$([[ \$? != 0 ]] && echo \":( \")\$ "
fi
PS2="> "
PS3="> "
PS4="+ "
# Try to keep environment pollution down, EPA loves us.
unset safe_term match_lhs
# Try to enable the auto-completion (type: "pacman -S bash-completion" to install it).
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
# Try to enable the "Command not found" hook ("pacman -S pkgfile" to install it).
# See also: https://wiki.archlinux.org/index.php/Bash#The_.22command_not_found.22_hook
[ -r /usr/share/doc/pkgfile/command-not-found.bash ] && . /usr/share/doc/pkgfile/command-not-found.bash
7" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"' ;; screen) PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "3_%s@%s:%s3\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"' ;; esac # fortune is a simple program that displays a pseudorandom message # from a database of quotations at logon and/or logout. # Type: "pacman -S fortune-mod" to install it, then uncomment the # following line: # [[ "$PS1" ]] && /usr/bin/fortune # Welcome Message # Arch Linux Logo Welcome Message c1="$(tput sgr0)$(tput setaf 4)" c2="$(tput bold)$(tput setaf 4)" c3="$(tput bold)$(tput setaf 0)" echo echo " $c2,$c1 _ _ _" echo " $c2/$c1#$c2\$c1 __ _ _ __ ___| |__ | (_)_ __ _ ___ __" echo " $c2/$c1###$c2\$c1 / _\` | '__/ __| '_ \\| | | '_ \\| | | \\ \\/ /" echo " $c2/$c1#####$c2\$c1 | (_| | | | (__| | | | | | | | | |_| |> <" echo " $c2/$c1##,-,##$c2\$c1 \\__,_|_| \\___|_| |_|_|_|_| |_|\\__,_/_/\\_\\" echo " $c2/$c1##( )##$c2\$c1" echo " $c2/$c1#.-- --.#$c2\\ $c3 A simple, elegant GNU/Linux distribution." echo " $c2/$c1\` \`$c2\$(tput sgr0)"$'\n' # Show date DATE="$(tput setaf 1)[$(tput setaf 6)$(date)" DATE="${DATE}$(tput setaf 1)]" echo $DATE # Show kernel info KERNEL="$(tput setaf 1)[$(tput setaf 6)$(uname -srmn)" KERNEL="${KERNEL}$(tput setaf 1)]" echo "$KERNEL"$'\n' # Reset colors tput sgr0 # Set colorful PS1 only on colorful terminals. # dircolors --print-database uses its own built-in database # instead of using /etc/DIR_COLORS. Try to use the external file # first to take advantage of user additions. Use internal bash # globbing instead of external grep binary. # sanitize TERM: safe_term=${TERM//[^[:alnum:]]/?} match_lhs="" [[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)" [[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)" [[ -z ${match_lhs} ]] \ && type -P dircolors >/dev/null \ && match_lhs=$(dircolors --print-database) if [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] ; then # we have colors <img src="http://obihoernchen.net/wordpress/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley"> # Enable colors for ls, etc. Prefer ~/.dir_colors if type -P dircolors >/dev/null ; then if [[ -f ~/.dir_colors ]] ; then eval $(dircolors -b ~/.dir_colors) elif [[ -f /etc/DIR_COLORS ]] ; then eval $(dircolors -b /etc/DIR_COLORS) fi fi # -- CUSTOM PS1 String START -- PS1="$? $(if [[ $? == 0 ]]; then echo \"\[3[01;32m\]243\"; else echo \"\[3[01;31m\]247\"; fi) $(if [[ ${EUID} == 0 ]]; then echo '\[3[01;31m\]\h'; else echo '\[3[01;32m\]\u@\h'; fi)\[3[01;34m\] \w $\[3[00m\] " #PS1="\[3[0;37m\]244240$([[ $? != 0 ]] && echo \"[\[3[0;31m\]247\[3[0;37m\]]240\")[$(if [[ ${EUID} == 0 ]]; then echo '\[3[0;31m\]\u\[3[0;37m\]@\[3[0;96m\]\h'; else echo '\[3[0;33m\]\u\[3[0;37m\]@\[3[0;96m\]\h'; fi)\[3[0;37m\]]240[\[3[0;32m\]\w\[3[0;37m\]]\n\[3[0;37m\]2442402406 \[3[0m\]" # --- Custom PS1 String END --- # Use this other PS1 string if you want \W for root and \w for all other users: # PS1="$(if [[ ${EUID} == 0 ]]; then echo '\[3[01;31m\]\h\[3[01;34m\] \W'; else echo '\[3[01;32m\]\u@\h\[3[01;34m\] \w'; fi) $([[ $? != 0 ]] && echo \"\[3[01;31m\]:(\[3[01;34m\] \")$\[3[00m\] " alias ls="ls --color=auto" alias dir="dir --color=auto" alias grep="grep --colour=auto" alias dmesg='dmesg --color' man() { env LESS_TERMCAP_mb=$'\E[01;31m' \ LESS_TERMCAP_md=$'\E[01;38;5;74m' \ LESS_TERMCAP_me=$'\E[0m' \ LESS_TERMCAP_se=$'\E[0m' \ LESS_TERMCAP_so=$'\E[38;5;246m' \ LESS_TERMCAP_ue=$'\E[0m' \ LESS_TERMCAP_us=$'\E[04;38;5;146m' \ man "$@" } # Uncomment the "Color" line in /etc/pacman.conf instead of uncommenting the following line...! # alias pacman="pacman --color=auto" else # show root@ when we do not have colors PS1="\u@\h \w $([[ $? != 0 ]] && echo \":( \")$ " # Use this other PS1 string if you want \W for root and \w for all other users: # PS1="\u@\h $(if [[ ${EUID} == 0 ]]; then echo '\W'; else echo '\w'; fi) $([[ $? != 0 ]] && echo \":( \")$ " fi PS2="> " PS3="> " PS4="+ " # Try to keep environment pollution down, EPA loves us. unset safe_term match_lhs # Try to enable the auto-completion (type: "pacman -S bash-completion" to install it). [ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion # Try to enable the "Command not found" hook ("pacman -S pkgfile" to install it). # See also: https://wiki.archlinux.org/index.php/Bash#The_.22command_not_found.22_hook [ -r /usr/share/doc/pkgfile/command-not-found.bash ] && . /usr/share/doc/pkgfile/command-not-found.bash

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

pacman -Sy pkgfile
pkgfile --update

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.

  nano /etc/syslog-ng/syslog-ng.conf

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

# Disable some logging
#log { source(src); filter(f_acpid); destination(d_acpid); };
log { source(src); filter(f_authpriv); destination(d_authlog); };
#log { source(src); filter(f_syslog); destination(d_syslog); };
#log { source(src); filter(f_cron); destination(d_cron); };
#log { source(src); filter(f_daemon); destination(d_daemon); };
#log { source(src); filter(f_kernel); destination(d_kernel); };
#log { source(src); filter(f_lpr); destination(d_lpr); };
#log { source(src); filter(f_mail); destination(d_mail); };
#log { source(src); filter(f_news); destination(d_news); };
#log { source(src); filter(f_ppp); destination(d_ppp); };
log { source(src); filter(f_user); destination(d_user); };
#log { source(src); filter(f_uucp); destination(d_uucp); };
#log { source(src); filter(f_debug); destination(d_debug); };
#log { source(src); filter(f_messages); destination(d_messages); };
log { source(src); filter(f_err); destination(d_errors); };
log { source(src); filter(f_emergency); destination(d_console); };
#log { source(src); filter(f_everything); destination(d_everything); };
#log { source(src); filter(f_iptables); destination(d_iptables); };

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

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

  1. I tried reading through all the posts and didn’t see anything quite like my issue. I am currently using two ntfs external drives and followed the instructions on enabling them. my pogoplug will still not see them at all. they are named, maybe its because I am not sure how the automount instructions ties in with the editing of the pogoplug.conf files
    would vfsdir1=[drivenameforpogoplug], /Media/[HardDriveName] ?

    I don’t want to specify a folder because I want the entire drive seen at this point.

    nano /etc/pogoplug.conf

    ##example below: vfsdir=,
    #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

    sorry, major newb here. thanks!

  2. For the most part, this tutorial works great! Thanks for spending the time putting it together!

    I can’t get Step 6 (USB Auto Mount) to work. Perhaps it’s because I went out of order. I completed the steps in the following order:
    1,2,3,4,5,7,8,and now 6

    1. After reboot in Step 6, no sub-folder appeared in /media (I confirmed that the NTFS drive does have a volume label.

    2. When I run “mount”, I receive a screenfull of output, not “something like /dev/sdX1 on /media/…”

    3. hdparm is an unrecognized command

    4. ntfs-3g is also unrecognized

    5. udevil (devmon$root service loads at startup fine.

    I wonder if they are not present because the kernel update (Step 8) removed them? I’m totally lost!

    I’m a complete noob to Linux in general, so if you have some fairly specific adfvice to get me going, I’d be very thankful!

    Also, does the USB Auto Mount only apply to flash drives? I’ve tried two different USB HDD. Could that be another problem?

    uhoh

  3. Hey there — this is the second time I am following your excellent tutorial. This time, I ran into a little surprise. Specifically, I wanted to disable some logging, but the directory “/etc/syslog-ng/” doesn’t exist in my archlinux installation.

    Like I said, this is my second Pogoplug, and the first one that I set up a few months back does have that directory.

    What am I missing? Everything seems to run fine though.

  4. MiniDLNA –

    systemctl shows:
    minidlna.service loaded failed failed
    after boot.

    minidlna is having issues on boot/reboot but is functioning perfectly fine when manually started after boot. It appears after some research that it is common and it may be either the lack of internet at the time minidlna service boots or related to disk automounting(most likely the former).

    Would you mind helping me with a script that would boot up minidlna manually after a brief delay?
    I would execute systemctl disable minidlna and execute this script to start the service.

    Thanks again for your great blog and continued help!

    1. Have a look at my blinked script just do the same but replace the iostat… line with sleep 60; systemctl start minidlna

      This should start minidlna after 60 seconds delay

      1. Worked like a charm!

        This will help on cold boots as the minidlna service was failing before incorporating this delay.

        Delay of 60 worked (tried 10 but was still failing on boot)

        #!/bin/bash
        sleep 60
        systemctl start minidlna

        Thanks again Obihörnchen finished complete setup of my Pogoplug!

        Now just need to back it up 😉

  5. Hi Obi,

    Thank you for writing this detailed tutorial.

    I’m total newbie for Unix/Linux. I followed this http://blog.qnology.com/2013/03/tutorial-pogoplug-e02-with-arch-linux.html

    to mod my Pogoplug E02. Then I followed your step 6 to add support to NTFS since I only use Windows and that Blog referred to yours for NTFS support.

    Unfortunately, after I finished all the steps I couldn’t find my external hard drive in media. The only error I encountered during the process is when I use mkdir. The system told me I already had one.

    And to scare me most, now the external hard drive doesn’t even work on my win 7. The system said I need to format the drive. Could you save me from this please? How can I make it work with Pogoplug? Or as a minimum, fix the problem with Win 7 so that I won’t lose the files.

    Many thanks.

  6. Obihörnchen – Thank you for all the help you’ve provided here in your blogs and all over the internet/forums! Could not have done it without your help!

    Question :

    1) I have successfully setup Archlinux, Samba and udevil/ntfs-3g. When adding a hard drive(NTFS) it is successfully automounting to /media dir BUT it is adding a pre-fix to the folder.

    Ex: Added drive. Mounted and created folder in /media =
    /media/sda1-DRIVE NAME.

    Therefore if I add it in a different order it will create another folder=
    /media/sdb1-DRIVE NAME

    Is there a way to only make the dir mount as /media/DRIVE NAME

    2 ) During a power cycle or power failure udevil does not unmount, I believe, so old folders remain (which can be manually cleaned up by using the line: udevil clean).
    ex:
    /media/sda1-DRIVE NAME #actually not being used.
    /media/sdb1-DRIVE NAME

    Is there a way to automatically add this command(udevil clean) to boot after a delay?
    #This issue might be eliminated Q1 above is answered. If you have suggestion you’d recommend over adding this line to boot I’m all ears.

    Thanks!

    1. Nice to hear that thanks!

      1) hmm it should mount it like /media/DEVICE_LABEL
      Are you sure your all partitions have a proper label set?

      2) mhh I don’t have such a problem maybe it’s because of 1) with proper labels for all partitions this shouldn’t happen.

      Maybe try to reset the label with e2label or tune2fs -L

      1. Correct! Extra HD that I’ve been using for setup/testing did not have a LABEL setup as I do not use it frequently. Therefore when mounting udevil was assigning these folder names based on its partition label.
        ex: /media/sda1-wd-160-……….

        Upon designating LABEL for NTFS drive it correctly mounted to /media/Drive_Label folder.

        Thanks again!

  7. getting this character “â” instead of the nice arrows shown in your screenshot when I try to implement the colored bash shell.

    See paste below from putty window. Any ideas?

    , _ _ _
    /# __ _ _ __ ___| |__ | (_)_ __ _ ___ __
    /### / _` | ‘__/ __| ‘_ | | | ‘_ | | | / /
    /##### | (_| | | | (__| | | | | | | | | |_| |> pkgfile –update^C
    ââ[â]â[root@pogoplug]â[~]
    âââ>

  8. Is it possible to reverse the led light colors? So it’s orange all the time and green for activity?

    1. Yes.
      Just change the blinkled script to the following:

      #!/bin/bash
      echo default-on >/sys/class/leds/status:orange:fault/trigger
      /usr/bin/iostat -z -d 3 | /usr/bin/sed -u -e '1d' -e 's/Device.*/none/' -e 's/sd.*/heartbeat/' -e '/^$/d' > /sys/class/leds/status:green:health/trigger &

  9. I have followed the udevil instructions but i am only getting a write speed of about 10MB/s any idea??

  10. The install went well except minidlna does not show all of my videos in one specific sub folder. it is only showing 100 files out of 800ish. all the other folders show all of their files. and yes i increased the read size. Can someone help please??

  11. Need older ArchLinuxARM-armv5te-latest.tar.gz with version 3.2 kernel.

    Hello friends, does anyone happen to have an older ArchLinuxARM-armv5te-latest.tar.gz with version 3.2 kernel that they can upload to somewhere and share? If you have the file but don’t know the kernel version, anything you downloaded before this year is fine too.

    The reason being, I just re-do my pogo plug this week and ArchLinuxARM-armv5te-latest.tar.gz have kernel 3.9 that will crash on boot (see http://archlinuxarm.org/forum/viewtopic.php?f=20&t=5536&start=20). I have patched it with the temp release from the link and was able to install and run for short time, now it is crashing after install minidlna and dnsmasq as wifi ap.

    hope someone have a local copy of an old ArchLinuxARM-armv5te-latest.tar.gz thanks

  12. Excellent guide, thanks Obihörnchen!
    I may add a script for minidlna I found here[1]. It not just creates thumbnails per folder, but per file. I needed it for the different episodes of my favorite TV shows which reside in the same folder.

    -Jan

    [1]

    1. Oh forgot about that.
      Edited my script so it creates thumbs like this:

      moviexy.avi
      moviexy.jpg


      #!/bin/bash

      DIR=$1

      TYPES=( mov mp4 avi mkv m4v xvid divx wmv mpg mpeg )

      # Create a regex of the extensions for the find command
      TYPES_RE="\("${TYPES[1]}
      for t in "${TYPES[@]:1:${#TYPES[*]}}"; do
      TYPES_RE="${TYPES_RE}\|${t}"
      done
      TYPES_RE="${TYPES_RE}\)"

      find $DIR -regex ".*.${TYPES_RE}" -type f | while read FILEPATH
      do
      printf "%sn" "--- Start Thumbnailcreation for ---"
      printf "%sn" "$FILEPATH"
      FILEPATH_DIR=$(dirname "$FILEPATH")
      THUMBFILE="${FILEPATH_DIR}/${FILEPATH##*/}"
      THUMBFILE="${THUMBFILE%.*}.jpg"
      if [ -f "$THUMBFILE" ]
      then
      printf "e[1;33m%se[0mn" "Thumbnail exists"
      else
      printf "e[1;32m%se[0mn" "Generating thumbnail..."
      ffmpegthumbnailer -i "$FILEPATH" -o "$THUMBFILE" -s 160 -q 10
      fi
      printf "%sn" "--- End Thumbnailcreation ---"
      done

  13. Thanks for the guide.

    Have you seen programs that can do sound monitoring (like if a smoke alarm goes off in your house)?

    Looking for a way to monitor alarms in the house using USB audio and make it send me a gmail, maybe even with the audio clip.

  14. Looks like a recent system update I installed broke my samba:
    systemctl start smb nmb
    Job for smb.service failed. See ‘systemctl status smb.service’ and ‘journalctl -xn’ for details.
    Job for nmb.service failed. See ‘systemctl status nmb.service’ and ‘journalctl -xn’ for details.

    I didn’t change anything in the samba conf or did anything else that could explain it, other than running system upgrade.

    Anybody figured out how to fix that?

    1. Ok, looks like the smbclient4 is in conflcit with samba. Had to remove both smbclient4 and samba4, and then reinstall samba and smbclient (no 4). Also, looks like the deamon names have been changed from smb and nmb to smbd and nmbd.

      Can you update your tutorial please?

  15. Thank you so much for this write-up. Most of the other guides out there assume you are already familiar with CLI and Archlinux along with having formatting problems on code.

    I was wondering if you could also do a write up on setting up Aria2 which as far as I can tell is the best all-in-one download manager for Archlinux with a nice webclient.

    Thanks!

  16. This may be a ridiculous question, but in order to maintain an Arch Linux build on my pogo device do I need to have the USB stick with the boot-loader connected to the device even after I have completed the installation?

  17. Just an FYI (perhaps this is just temporary) but I am getting:
    error: failed retrieving file 'udevil-0.4.1-1-arm.pkg.tar.xz' from mirror.archlinuxarm.org : Resolving timed out after 10000 milliseconds
    when trying to install udevil

  18. Thanks for all this work you did here documenting everything. Works good, except you might want to add unix extensions = false to global section of smb.conf so samba works for android devices. Without it you get no connectivity other than seeing files in a browse list, but you can’t view, play, download or upload from android without this.

    Also batch file copies fail from windows systems unless you add “oplocks = No” to smb.conf

    Without oplocks = No if you try to drag and drop multiple large files it will either only copy the first file or only copy every other file and leave zero byte files for the other half of the files.

    Thanks again though, best directions on the net.

    1. Already added “unix extensions = false” some time ago.

      Just added “oplocks = no” thanks for pointing this out 🙂
      But will make write cache unusable 🙁

  19. Very nice tutorial! Best one i’ve encountered so far. I have 2 V2 pogos and one V3. The V3 is now serving as a remote backup machine and the 2 V2s will be used @home.

    I remember there is a problem when rebooting with additional drives attached (the USB drive or stick that is recognized first will be tried for booting). I posted a solution on the archlinux forum:

    http://archlinuxarm.org/forum/viewtopic.php?f=29&t=5034&p=28019#p28019

    Perhaps interesting for your tutorial.

  20. Obihoernchen,

    For the Automount of USB hard drive. If I wanted to add a second external NTFS hard drive and add it to udevil would I do this command?

    1. Plug in new NTFS hard drive into pogoplug

    2. mkdir /media2

    3. systemctl enable devmon@root

    This seems so much easier than when I had to do my ext3 drives. I had to reenable automount and I had to edit /etc/fstab and put enter my UUID of my drive and format and mount location.

    Why is this so much easier?

    If I want to add a ext3 hard drive can I just add that command also?

    I am setting up a second pogoplug and I wish I had this guide when I started. This explains so much more than the forums which seems to have the information scattered all over.
    Thanks!

  21. I was wondering for you USB automounting section. Did you install a NTFS package somewherem in your guide?

  22. Hmmm excellent guides so far!

    However updating the Kernel to 3.7, when I command “pacman -Sy linux-kirkwood linux-headers-kirkwood”

    I get quite a few 404’s back…

    Thoughts?

      1. Just went through fine. Thanks! So FYI, if you get 404’s, try again later.

        I assume it’s the reason why Samba is similarly failing.

        Would like to note, when installing the kernel, you are confirming the requests to replace “linux”.

  23. Thanks for this awesome tutorial. However, I have a problem where the pogo sometimes doesn’t reboot from USB stick. Initial boots (or from the pogo is) are usually done, but reboot from archlinux using /shin/reboot often results in a hang that requires a power cycle. Tried different USB sticks already, setting up fstab, setting usb_rootfstype to ext3, etc. All to no avail. Do you have an idea maybe what the issue could be?

      1. I think this here may be the reason it fails:

        Dec 31 19:01:54 pogo systemd[1]: Started Webmin.
        Dec 31 19:01:57 pogo dhcpcd[228]: eth0: offered 192.168.1.2 from 192.168.1.1
        Dec 31 19:01:57 pogo dhcpcd[228]: eth0: acknowledged 192.168.1.2 from 192.168.1.1
        Dec 31 19:01:57 pogo dhcpcd[228]: eth0: checking for 192.168.1.2
        Dec 31 19:01:57 pogo dhcpcd[228]: eth0: sending IPv6 Router Solicitation
        Dec 31 19:01:59 pogo netcfg-daemon[111]: :: wired-eth0 up DHCP IP lease attempt failed.
        Dec 31 19:01:59 pogo netcfg-daemon[111]: [fail]
        Dec 31 19:01:59 pogo systemd[1]: netcfg.service: main process exited, code=exited, status=1/FAILURE
        Dec 31 19:01:59 pogo systemd[1]: Unit netcfg.service entered failed state

          1. Tried that, I guess that wasn’t the main issue. Static IP seems to work fine now, but for some reason it still doesn’t boot successfully after a reboot. The log doesn’t help too much unfortunately:

            Mar 18 20:46:22 pogo systemd[1]: Startup finished in 12s 105ms 127us (kernel) + 1min 42s 867ms 892us (userspace) = 1min 54s 973ms 19us.
            Mar 18 20:46:44 pogo systemd[1]: Stopping Local File Systems (Pre).
            Mar 18 20:46:44 pogo systemd[1]: Stopped target Local File Systems (Pre).

            Looks like after it booted successfully, for som reason 22 secs later it stops the file system and just sits there dead.

          2. Actually, never mind. Looks like this was the shutdown where I called /sbin/reboot. So looks like during the subsequent attempt where if tails to boot, nothing gets logged at all.

          3. Actually, never mind. Looks like this was the shutdown where I called /sbin/reboot. So looks like during the subsequent attempt where if tails to boot, nothing gets logged at all.

            I found out something interesting though, it seems to have to do with my USB hard drive. When I disconnect the drive, even after it has been haning for a while, it starts booting from the USB stick. So it seems to fail to boot mostly when the USB drive is plugged in.

          4. Well, I figured it out. Had something to do with my USB NTFS hard drive. I reformatted my USB harddisk as logical volume with ext3, and now it boots without a problem. Thanks, please keep the content on the tutorial coming. Would love to learn more, e.g. how to enable swap on the hard drive.

  24. Any chance of adding a sabNZBD/SickBeard/CouchPotato guide? This has really been very helpful! Thanks for putting it together. Picked up a Pogo E02 for just $10 US.

  25. I performed steps 1-6 last night and everything worked exactly as you described.

    I skipped 7 and 8 as they were pogo v2 specific and I have a pogo v4 and was afraid I might brick it. Having the led blink mod
    would be nice if there is a way to do it for the pogo v4. Also the kernel update if it’s possible and recommended.

    I skipped 7-11 as I don’t plan to use them at this time.

    I also performed 12 and 13.

    I skipped 14 as my boot drive is an ssd, but I might try it later.

    The only thing I’m missing is nfs4 which it appears webmin supports (well the exports at least). I’ll backup my boot drive to another disk and then try to setup nfs on my own if you don’t have the time or desire to add it to your list.

    I Have spent hours upon hours in frustration trying to piece together different instructions via the Arch forums and other blog posts. Your tutorial took me about 20 minutes, was very current (i.e. systemctl calls vs older methods), and worked flawlessly…the first time without me having to go find missing or up-to-date steps somewhere else. Thank you so much. Your documentation rocks!

    1. Nice to hear something like that thanks! 🙂

      To 7 and 8)
      Just skip the whole arcNumber and matchid step and you’re fine.
      So do not do:
      pacman -Sy uboot-env
      fw_setenv arcNumber 3542
      fw_setenv machid dd6
      reboot

      Everything else as described and it should work.

      Blinkled should work as well.

      I have to see whether I have time to add NFS because I don’t need it.

  26. I would be interested on setting up an “own cloud” server on my pogo plug. Can you do this too? If so, would you mind adding it to your guide?

  27. If you get time, would you mind detailing how to add nfs to this setup? Thanks.

    (fwiw I have a pogov4, but I think most of this is the same)

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.