Seagate FreeAgent DockStar Linux Debian Squeeze Installation + Application Programs

Warning: before you connect the DockStar to the internet look at page DockStarOverview.

A big Thank You goes to Jeff Doozan, who has done a great job to make this possible.

I have added to the Debian installation additional utilities for development work and my 1-wire temperature measurement.

Because the DockStar does not have a battery backed up Real-Time-Clock, ntp via internet is used to set the time.

It is assumed, that your DockStar will run in DHCP mode (factory default) and you found the IP address in the router information.

The following procedure will install Linux Debian Squeeze on a USB flash drive (>= 1 GB) connected to your Dockstar. If you want to compile a kernel on DockStar, use a 4 GB USB stick. Find your Pogoplug's IP address and connect via SSH (e.g. with PUTTY):

username: root
password: stxadmin (factory default)

Partition your flash drive:

-bash-3.2# /sbin/fdisk /dev/sda
# Configure partion 1 as Linux (type 83), I recommend making this at least 512Mb (The default bare-bones installation uses 280Mb).
# Configure partion 2 as Linux Swap (type 82), I used 128 MB, same as the RAM size. 
  In case you want to check the file system of a 500 GB hard disk you need 256 MB Swap space.
# The formatting of partition /dev/sda1 will be done later within the install script (ext2).

The next step downloads and run an installation script from Jeff Doozan to install Debian on the USB flash stick and overwrite the old boot loader on '/dev/mtd0'.

-bash-3.2# cd /tmp
-bash-3.2# wget http://jeff.doozan.com/debian/dockstar.debian-squeeze.sh
-bash-3.2# chmod +x dockstar.debian-squeeze.sh
-bash-3.2# export PATH=$PATH:/usr/sbin:/sbin
-bash-3.2# ./dockstar.debian-squeeze.sh

The script will take some time to download the debian images and extract them to your flash drive. The total install time will vary with the speed of your flash drive and your Internet connection. On my system, it takes about 20 minutes. Once it's finished, you have the option of rebooting into your new debian install. Even if it is the same MAC number, the DHCP server in the router gives a new IP number. Hence, you first have to figure out the new IP number (in Router table) of the DockStar before logging in.

A "$" sign at the begin of a line in my explanations means a root command line.

The default root password in Debian is 'root'. After you've logged in, I'd recommend changing the root password and eventually configuring /etc/apt/sources.list to point to something near you:

root@FADS90:~# uname -a   # have a look at the kernel version
Linux FADS90 2.6.32-dockstar #2 Mon Sep 6 15:43:50 EDT 2010 armv5tel GNU/Linux

$ passwd
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

$ vi /etc/apt/sources.list

Have a look how much of your USB stick (4 GB) is filled:
root@debian:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                 3624388    276848   3163424   9% /
none                     60500        32     60468   1% /dev
/dev/sda1              3624388    276848   3163424   9% /
tmpfs                    62864         0     62864   0% /lib/init/rw
tmpfs                    62864         0     62864   0% /dev/shm
tmpfs                    62864         0     62864   0% /tmp

Also have a look at:
root@FADS93:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/root      /               ext2    noatime,errors=remount-ro 0 1
/dev/sda2      none            swap    sw                0       0
tmpfs          /tmp            tmpfs   defaults          0       0

Take care, that /dev/root (/dev/sda1) is mounted with parameter "noatime",
in order to reduce wear of the USB stick. If it is not there, edit the file.

I installed additional utilities, for my development work. In order to edit files on the DockStar file system either use on Windows WinSCP, or on Linux (Ubuntu) Nautilus "connect to server via SSH":

$ apt-get install mc               # midnight commander, mc -a
$ apt-get install language-env     # language support
$ apt-get install libglib2.0-data
$ apt-get install shared-mime-info
$ apt-get install libpng12-0
$ apt-get install mime-support
Configure mc for using internal editor: click on Options/Setup "use internal editor" OK

In order to change the language (i18n) to e.g. German do:
  1. remove comment "#" sign in file /etc/locale.gen at line: de_DE.UTF-8 UTF-8
  2. $ locale-gen
     Generating locales (this might take a while)...
       de_DE.UTF-8... done
     Generation complete.

  3. $ locale -a  # show available i18n sets:
     C          # English
     POSIX
     de_DE.utf8 # German

  4. edit /etc/default/locale to: LANG=de_DE.utf-8
  5. logout - login as root
  6. $ locale  # should show now LANG=de_DE.utf-8
  7. $ mc      # should show now real line drawing and German text
  8. for any user the local file /home/user_name/.bashrc must be edit, insert at top:
     LANG=de_DE.UTF-8
     export LANG
     LC_MESSAGES=de_DE.UTF-8
     LC_CTYPE=de_DE.UTF-8
     export LC_MESSAGES LC_CTYPE
  9. logout - login as user
 10. $ locale  # should show now LANG=de_DE.utf-8

Change hostname: Edit /etc/hostname to e.g FADS93 (FreeAgent DockStar IP xxx.xxx.xxx.93)
Attention: Do NOT use comments "#" in the file.

$ apt-get install joe    # Wordstar like editor, in case of serial access
$ apt-get install htop   # semi-GUI top
$ apt-get install dialog # semi GUI
$ apt-get install nmap   # show used TCP/IP ports
$ apt-get install usbutils # e.g. lsusb
$ apt-get install less   # more comfortable than "more"
$ apt-get install man    # manual pages utility
As a default "man" uses the utility "more" for displaying the man pages, 
the utility "less" is more comfortable, to change it:
Edit /etc/manpath.config "pager pager -s" to "pager less -s"

# In case you will access the DockStar from Internet, for security reasons you will need a user with non root privileges.
$ adduser rudi           # add user with non root rights for better security
$ apt-get install sudo   # to get temporary root rights for a user
$ visudo                 # edit /etc/sudoers, add line: rudi    ALL=(ALL) ALL
$ dpkg-reconfigure tzdata # set time zone, select country, city e.g. Europe, Berlin - OK
Current default time zone: 'Europe/Berlin'
Local time is now:      Wed Sep 29 19:37:28 CEST 2010.
Universal Time is now:  Wed Sep 29 17:37:28 UTC 2010.

Now we have used 411 MB of the USB stick.

In case you are searching for a utility and do not know the package name, do:
$ apt-cache search utility-name

Test for usability compared with the NSLU2 box:

+ Winscp does work

Static TCP/IPV4 Address

In order to use the DockStar as a server it is preferable to use a static IP address:

The new content for /etc/network/interfaces:
auto lo eth0
iface lo inet loopback
#iface eth0 inet dhcp
iface eth0 inet static
        address 192.168.17.xxx
        netmask 255.255.255.0
        network 192.168.17.0
        broadcast 192.168.17.255
        gateway 192.168.17.1

$ reboot  # with the new IP address

DockStar kernel 2.6.32 with LED support

Jeff Doozan was so friendly to build a DockStar kernel with LED support in a .deb archiv. The installation procedure is the following, see also the Forum entry:

dpkg -i linux-image-2.6.32-dockstar_1.1_armel.deb
cd /boot
# Create the images for uBoot
/usr/bin/mkimage -A arm -O linux -T kernel  -C none -a 0x00008000 -e 0x00008000 -n Linux-2.6.32-5 -d /boot/vmlinuz-2.6.32-dockstar /boot/uImage

/usr/bin/mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs -d /boot/initrd.img-2.6.32-dockstar /boot/uInitrd

# Configure rc.local to turn off the orange LED and turn on the green LED
sed -i 's|^exit 0|echo none > /sys/class/leds/dockstar\:orange\:health/trigger\necho default-on > /sys/class/leds/dockstar\:green\:health/trigger\nexit 0|' /etc/rc.local

$ reboot

After you reboot, the LED on the front of your dockstar should blink green as long as the boot loader works, then turn orange after the kernel is loaded and then turn green after the system has fully booted. See herefor details on triggering the LEDs. If you're happy with the new kernel, you can free up some space by removing the old kernel and others:

apt-get remove linux-image-2.6-kirkwood # has  4 MB
/lib/modules/2.6.32-5-kirkwood          # has 48 MB
/usr/share/locale # has 62 MB, delete all, except en* and your language (de)

Without the not needed locales the 1 GB USB-stick is used with 573 MB (70%) + swap 128 MB,
the following application programs are already included.

DockStar kernel 2.6.35.4 with LED support

A newer kernel >2.6.32 must be either build from a "vanilla" kernel source with the DockStar patches, or downloaded already compiled (uImage, .config and modules in a xxx.deb archive) from a helpful source. The build process can be done native (2.5 h duration on a 4 GB USB stick) or cross-build on a host (e.g. i386). This will be described soon.

I use a kernel build with LED support from gorgone. You can download it from here:

Be aware that the kernel version can change!
$ wget 193.16.217.9/files/dockstarheavy.deb

Save the old kernel before doing so:
$ cd /boot
$ cp uImage uImage.kw32   # KirkWood kernel 2.6.32
$ cp uInitrd uInitrd.kw32

Install new kernel /boot/uImage, /boot/uInitrd 
and new kernel modules in /lib/modules/2.6.35.4-dockstar
$ cd /root
$ dpkg -i --force-overwrite dockstarheavy.deb

Make a backup copy, so you know what you have:
$ cd /boot
$ cp uImage uImage.ds35.4
$ cp uInitrd uInitrd.ds35.4

Activate the new kernel:
$ reboot

LED action:
green flashing   - Boot loader, loading uImage and uInitrd
no LED           - Starting kernel
orange heartbeat - Booting kernel
green solid      - System ready

Show the name of the new kernel:
root@(none):~# uname -a
Linux (none) 2.6.35.4-dockstar #5 PREEMPT Mon Sep 27 04:43:05 CEST 2010 armv5tel GNU/Linux

Create dependencies of all kernel modules:
$ depmod

LED software control

Good explanation of the LED software here

State keys:
  none       - LED off
  nand-disk  - LED nand activity
  timer      - time controled LED
  heartbeat  - LED blinks like the heartbeat
  default-on - LED allways on 

To disables heartbeat and sets the green LED on, add this 2 lines to rc.local
$ echo none       > /sys/class/leds/dockstar\:orange\:misc/trigger
$ echo default-on > /sys/class/leds/dockstar\:green\:health/trigger

To shows you when it is safe to remove disks and power cable on init 0 or halt command 
add an "echo ..." line in /etc/init.d/halt under
  log_action_msg "Will now halt"
  halt -d -f $netdown $poweroff $hddown
  echo none > /sys/class/leds/dockstar\:green\:health/trigger

Help to show network traffic with the LED and more

To get the orange LED to blink on TCP/IP access, edit /etc/rc.local and add the following:

#Set up orange LED to blink on incoming TCP traffic
iptables -A INPUT -p tcp -j LED --led-trigger-id tcpin --led-delay 100
echo netfilter-tcpin > /sys/class/leds/dockstar\:orange\:misc/trigger

Adding syslog support

The Debian Squeeze minimal installation does not come with a syslog daemon, it has just a dmesg utility with time relative to the system start (boot messages). The actual version for syslog used in a desktop version is rsyslogd. For my opinion, for a DockStar that is too verbose and complex, and not good suited for a USB-Stick installation. While it is good to have the boot messages on the USB-Stick for hardware troubleshooting, the syslog messages could be kept in RAM.

I got a hint from ecc to the Debian Squeeze package busybox-syslogd, which I already know from my NSLU2 box (CPU 266 MHz, 32 MB RAM). I installed it and it works fine. It writes all syslog messages to a RAM buffer of 128KB size (defined in /etc/default/busybox-syslogd).

To read the messages call logread.

Now you can use also the utility logger in a shell script.

$ apt-get install busybox-syslogd

Shell script use of logger:
  echo test | logger
or using "2>&1" =  Sends the error output to the same place as the standard output
  PATH=$PATH:/opt/bin
  echo "PATH " $PATH 2>&1 | logger

Debian Squeeze upgrade

In order to take advantage of improved program versions, you can do an upgrade:

If you have installed kernel 2.6.35-4, you need no longer the kirkwood kernel:
$ apt-get remove linux-image-2.6.32-5-kirkwood

Update packages information:
$ apt-get update

Upgrade all packages 2010-12-08:
root@FADS93:~# apt-get upgrade
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut       
Statusinformationen werden eingelesen... Fertig
Die folgenden Pakete werden aktualisiert (Upgrade):
  adduser apt base-files bsdutils busybox busybox-syslogd cpp cpp-4.4 dash debconf
  debconf-i18n findutils g++ g++-4.4 gcc gcc-4.4 gcc-4.4-base git git-core initramfs-tools
  initscripts iputils-ping joe kernel-wedge libacl1 libblkid1 libc-bin libc-dev-bin libc6
  libc6-dev libffi5 libgcc1 libgomp1 libgssapi-krb5-2 libk5crypto3 libkrb5-3
  libkrb5support0 libldap-2.4-2 liblzma2 libncurses5 libncurses5-dev libncursesw5 libnl1
  libpam-modules libpam-runtime libpam0g libsqlite3-0 libssl0.9.8 libstdc++6
  libstdc++6-4.4-dev libudev0 libuuid1 libxml2 linux-base linux-libc-dev locales man-db mc
  mount ncurses-base ncurses-bin netbase ntpdate openssh-client openssh-server openssl perl
  perl-base perl-modules po-debconf python python-minimal python2.6 python2.6-minimal
  shared-mime-info sysv-rc sysvinit sysvinit-utils tar tzdata udev util-linux uvccapture
  xz-utils
84 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
Es müssen 62,8MB an Archiven heruntergeladen werden.
Nach dieser Operation werden 5.849kB Plattenplatz freigegeben.

Programs for my temperature measurements

For my temperature measurement system I need digitemp (with USB-serial adapter pl2303) and webcam support (Logitech E3500). It can be installed with:

$ apt-get install digitemp    # 1-wire sensor readout
$ cd /usr/bin
root@debian:/usr/bin# ln -s digitemp_DS9097 digitemp # select interface type
$ apt-get install minicom     # for serial link
$ apt-get install uvccapture  # USB UVC Video Class snapshot program
$ apt-get install imagemagick # graphic tools library
$ apt-get install gnuplot     # plot program
$ apt-get install python      # 2.6.5-13
http://packages.debian.org/squeeze/python-serial
$ apt-get install python-serial # interface for serial link (RS232)
$ apt-get install usbutils    # lsusb
$ apt-get install libv4l-0    # video for Linux
$ apt-get install ttf-bitstream-vera # simple sans font for gnuplot

Tests:
$ uvccapture -x352 -y288      # gives shot.jpg from the webcam
$ digitemp -s /dev/ttyUSB0 -i # initialize resource file .digitemprc
$ digitemp -a                 # show temperature from sensor DS18S20

Clone USB stick

To setup a Linux system can take quite a while. If you want to setup an other DockStar it can save time to clone an USB stick. I use the standard tools dd and gparted for that task, on a desktop system. Doing so on the DockStar need more command line effort, with the risk of mistyping.

Unfortunately there are many possibilities how to do so:

See a sample procedure:

Prerequisites:
First USB stick: 4 GB, device /dev/sdb, system on /dev/sdb1, swap 256 MB on /dev/sdb2
Second USB stick: 4 GB, file system as bought: FAT32
Desktop Linux (e.g. Ubuntu)

Preparing second USB stick, device /dev/sdc:
With "gparted" delete original FAT32 file system
Setup a "primary partition" with "ext2" file system of 4 GB - 256 MB for swap.

Copying by using a terminal window:
$ dd if=/dev/sdb1 of=/dev/sdc1 bs=1M
If you do not set "bs" (Block Size), the default will be 512 bytes.
The transfer rate in my case with an USB stick with a write speed 3 MB/s was about 600 KB/s.
Therefore it is advised to use a larger block size, power of 2, e.g, 1M.
Then the transfer rate went up to 2.9 MB/s, which is close to the maximum of that USB stick.

If you are curious what is the status, open a second terminal window
$ ps -A | grep dd         # find out the process number
5263 pts/0    00:00:19 dd
$ sudo kill -USR1 5263    # send signal to show status
To interrupt "dd" you can type CTRL C

Last step is to create a primary partition "linux-swap" /dev/sdb2 with "gparted" at the rest of capacity.
The do a check of the file system:
$ sudo e2fsck -f /dev/sdb1  # -f= force, even if it looks clean

Take care about the MAC address of "eth0" and "wlan0":
In file /etc/udev/rules.d/70-persistent-net.rules e.g. you have for wlan0
  # USB device 0x:0x (rt73usb)
  SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="94:0c:6d:e3:43:30", ATTR{dev_id}=="0x0", 
    ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"
So, correct your MAC (ATTR) address that it fits your actual DockStar,
otherwise new addresses "eth1" and "wlan1" will be generated.

A problem arises from an Intenso USB stick which is labled with 4.0 GB but has 3.8 GB only. If the system partition of the second USB stick is smaller than of the first one, after copying the system partition with dd, an error will be reported from e2fsck, e.g superblock size differs from partition size. This can not be fixed with gparted. The only solution is to resize the file system size of the second USB stick to an amount which fits the partition table size and then use gparted to bring it to the fitting size. Example:

First USB stick size: 4.0 GB, second USB stick size: 3.8 GB (Intenso) 
Partitions: /dev/sda1 ext2, /dev/sda2 swap = 256 MB

Copying the system partition with dd:
$ sudo dd if=/dev/sdb1 of=/dev/sdc1
at the end an error message is shown, that the target is too small.

File system check:
$ sudo e2fsck /dev/sdc1
  error message: superblock size differs from partition size

Resize file system size to a smaller value:
$ sudo resize2fs /dev/sdc1 3400M

File system check:
$ sudo e2fsck /dev/sdc1
 - OK

Use Gparted to resize /dev/sdc1 to a fitting size, the gap to the swap partition should be zero.

Help from the Forum

For any questions and discussion of Debian on the Dockstar, please visit the forum.

A very good source for kernel compiling is on http://www.howtoforge.com/kernel_compilation_debian_etch.

List of pages in this category:

-- RudolfReuter 2010-09-07 18:06:27


Go back to CategoryDockStar or FrontPage ; KontaktEmail (ContactEmail)

DockStarDebian (last edited 2012-08-29 07:57:03 by dslb-084-058-181-164)