Seagate FreeAgent DockStar Linux Debian Installation

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.

Please read the whole documentation first, before doing any installation. The successful installation depends very much on the actual state of the NAND flash content.

Debian wheezy, ver. 7

Prerequisites

/!\ Take care to have the right arcnumber, please see DockStarKernelBuild#Arc_number.

From the Linux in NAND flash or with USB-Stick Linux (package: u-boot-tools) you could do:

$ fw_printenv
...
arcNumber=2998
...

# if not set, type to set:
$ fw_setenv arcNumber 2998

Or with a serial cable, see DockStarSerialLink, or a netconsole (see Links) you could do:

# in uboot type to check:
u-boot>> printenv
arcNumber=2998
...

# if not set, type to set:
u-boot>> setenv arcnumber 2998
u-boot>> saveenv

In case wheezy does not boot, according to bodhi you might want to rerun the UBoot installation script, and reset the UBoot environment:

You are already running the latest uBoot.
Would you like to reset the uBoot environment? [N/y] y

Explanation: Basically, during UBoot installation, the UBoot envs reset question should be answered YES is if you're trying to recover from a previous incompleted UBoot-Debian installation. This question should be answered NO if you're only updating UBoot to a new version (because you might have modified some envs for you own setup).

/!\ You should install the rescue system 2.8.2 first, otherwise you can get an error kernel too old, see DockStarRescue :

W: Failure trying to run: chroot /tmp/debian mount -t proc proc /proc
W: See /tmp/debian/debootstrap/debootstrap.log for details
debootstrap failed.
See /tmp/debian/debootstrap/debootstrap.log for more information.

# The info from the logfie is:
FATAL: kernel too old

/!\ The original installation script requires an updated debootstrap configurations. If your system already has debootstrap installed in /usr/sbin/debootstrap (from an earlier Squeeze install, or if you're running the rescue system) you'll need to uninstall that first with the following commands:
/!\ The improved installation script does not need that.

# make Flash-ROM Linux (Rescue) writeable
$ mount -o remount,rw /
$ rm /usr/sbin/debootstrap
$ rm -rf /usr/share/debootstrap

# Disable perl
$ chmod 666 /usr/bin/microperl 

$ mount -o remount,ro /

Update to kernel 3.9.5

Please check the Prerequisites first!

shyd was so friendly and compiled the Linux kernel version 3.9.5 for the Dockstar, including I2C support. You can also download there:

In order to install the kernel properly, you need to have initramfs-tools installed. Otherwise your device won't be able to boot! If they are not already installed do:

# update the Debian repository
$ sudo apt-get update

$ sudo apt-get install initramfs-tools

Then install the kernel:

$ cd /tmp
$ wget http://dev.shyd.de/dockstar/linux-image-3.9.5-dockstar-goflex-shyd_1.1_armel.deb

# That takes a few minutes!
$ sudo dpkg -i linux-image-3.9.5-dockstar-goflex-shyd_1.1_armel.deb

If you are encountering problems with flash-kernel, the kernel will be installed though. But rerun it, to finish the process:

$ sudo apt-get -f install

Create the boot files:

$ cd /boot

# Rename old files first, add the old version number, e.g. 3.2
$ sudo mv uImage uImage-3.2
$ sudo mv uInitrd uInitrd-3.2

$ sudo /usr/bin/mkimage -A arm -O linux -T kernel  -C none -a 0x00008000 -e 0x00008000 -n Linux-3.9.5 -d /boot/vmlinuz-3.9.5-dockstar-goflex-shyd /boot/uImage
         
$ sudo /usr/bin/mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs -d /boot/initrd.img-3.9.5-dockstar-goflex-shyd /boot/uInitrd

In order to have a good signaling with the one multi color LED:

# Edit file /etc/rc.local with root rights
# append 2 lines before exit 0
echo default-on > /sys/class/leds/dockstar\:green\:health/trigger
echo none       > /sys/class/leds/dockstar\:orange\:misc/trigger

# Edit file /etc/init.d/halt with root rights
# Find line: halt -d -f $netdown $poweroff $hddown
# add after (switch LED off)
echo none > /sys/class/leds/dockstar\:green\:health/trigger

Reboot the Dockstar and check the kernel version:

$ sudo reboot

$ uname -a

Check the I2C interface:

$ sudo apt-get install i2ctools

# look for the device
$ ls -ls /dev/i2*
0 crw-rw---T 1 root i2c 89, 0 Jan  1  1970 /dev/i2c-0

# look for I2C slaves
$ sudo i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- 04 -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- 64 -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- 
# The 04 is an ATtiny85 listening to I2C 

Installation 2013-01-29

/!\ The boot loader u-boot will be replaced at first (version 2011.12) by the script. If you do not need that, please comment that out, by editing the just downloaded installation script:

#echo "Installing Bootloader"
#/tmp/install_uboot_mtd0.sh --noprompt

In the forum there is an improved version of the debian installation script available, from iSKUNK! (Daniel Richard G.). I have tested this script and it works without flaw. Unfortunately it not yet available from Jeff's server. So, in the meantime, I like to provide this improved script on my server. Downloading the script and starting it, will work with the following commands:

/tmp# wget http://www.rudiswiki.de/debian/kirkwood.debian-wheezy.new.sh
# make it executable
/tmp# chmod +x kirkwood.debian-wheezy.new.sh

# Check for complete PATH environment
/tmp# env
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
# If /usr/sbin:/sbin is NOT included, type to add:
/tmp# export PATH=$PATH:/usr/sbin:/sbin

# Start debian 7 installation script
/tmp# ./kirkwood.debian-wheezy.sh

The rest of the installation is as follows.

Installation 2013-01-10

/!\ The boot loader u-boot will be replaced at first (version 2011.12) by the script. If you do not need that, please comment that out, by editing the just downloaded installation script:

#echo "Installing Bootloader"
#/tmp/install_uboot_mtd0.sh --noprompt

The following procedure will install Linux Debian wheezy 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 Dockstar's IP address and connect via SSH (e.g. with PUTTY):

# for example
$ ssh root@192.168.17.183
password: root (rescue Linux)

# For reference original dockstar
username: root
password: stxadmin (factory default)

Partition your flash drive, easiest under Ubuntu with gparted:

-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).

Download and run an installation script from Jeff Doozan to install Debian on the USB flash stick and overwrite the old boot loader (original Seagate firmware) on '/dev/mtd0'.

rescue:/tmp# cd /tmp
rescue:/tmp# wget http://projects.doozan.com/debian/kirkwood.debian-wheezy.sh
# make it executable
rescue:/tmp# chmod +x kirkwood.debian-wheezy.sh

# Edit script: correct KERNEL_VERSION from 3.2.0-3 to 3.2.0-4, e.g.:
rescue:/tmp# vi kirkwood.debian-wheezy.sh
# move with the cursor to line KERNEL_VERSION=3.2.0-3-kirkwood
# move with cursor to the last "3"
i
4
DEL
ESC
:wq

# Check for complete PATH environment
rescue:/tmp# env
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
# If /usr/sbin:/sbin is NOT included, type to add:
rescue:/tmp# export PATH=$PATH:/usr/sbin:/sbin

# Start debian 7 installation script
rescue:/tmp# ./kirkwood.debian-wheezy.sh

# last question from the script:
You can now reboot your device into Debian.
If your device does not start Debian after rebooting,
you may need to restart the device by disconnecting the power.

The new root password is 'root'  Please change it immediately after
logging in.

Reboot now? [Y/n] 
Y

# The DHCP server will probably give a new IP address
$ From a terminal emulation type:
$ ssh root@192.169.17.186

root@debian:~# uname -a
Linux debian 3.2.0-4-kirkwood #1 Debian 3.2.35-2 armv5tel GNU/Linux

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 15 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.

Configuration

A "$" sign at the begin of a line in my explanations usually 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 debian 3.2.0-4-kirkwood #1 Debian 3.2.35-2 armv5tel GNU/Linux

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

$ cat /etc/apt/sources.list # show the Debian repository source address
deb http://cdn.debian.net/debian wheezy main

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           3603280 373352   3046888  11% /
udev               10240      0     10240   0% /dev
tmpfs              12532     52     12480   1% /run
/dev/sda1        3603280 373352   3046888  11% /
tmpfs               5120      0      5120   0% /run/lock
tmpfs              78060      0     78060   0% /run/shm
tmpfs              62644      0     62644   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
# in /etc/defaults/tmpfs set just RAMTMP=yes
tmpfs          /tmp            tmpfs   defaults          0       0
tmpfs          /var/volatile   tmpfs   defaults,size=10%,mode=755 0       0
# for backintime
/dev/sdb1      /media/SAVE     ext4    rw,relatime,user_xattr,barrier=1,data=ordered


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 update
$ apt-get install apt-utils
$ apt-get install dialog
$ apt-get install mc               # midnight commander
$ apt-get install libglib2.0-data
$ apt-get install shared-mime-info
$ apt-get install libpng12-0
$ apt-get install mime-support
$ apt-get install locales          # language support
$ apt-get install ntp              # keep local time accurate
or quicker
$ apt-get install apt-utils dialog mc libglib2.0-data shared-mime-info libpng12-0 mime-support locales ntp

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:
per dialog:
$ dpkg-reconfigure locales -plow
# move cursor down to "de_DE.UTF-8 UTF-8" and set a mark with key SPACE
# tab to OK and ENTER
# Default locale: de_DE.UTF-8 UTF-8
# tab to OK and ENTER
# proceed with point 5.

or manually
  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 cron   # start programs at certain times
$ apt-get install htop   # semi-GUI top
$ 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
or quicker
$ apt-get install cron htop nmap usbutils less man

If backward scrolling in man is not supported, you can get it with:
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 user           # add user with non root rights for better security
$ apt-get install sudo   # to get temporary root rights for a user

# add the user to the groups (/etc/group) dialout, www-data, sudo
$ usermod -a -G dialout user
$ usermod -a -G www-data user
$ usermod -a -G sudo user

# check for groups
$ id user

$ dpkg-reconfigure tzdata # set time zone, select country, city e.g. Europe, Berlin - OK
Current default time zone: 'Europe/Berlin'
Local time is now:      Sat Jan 19 23:12:42 CET 2013.
Universal Time is now:  Sat Jan 19 22:12:42 UTC 2013.

Now we have used 456 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

Further tweaking

Have also a look at a few other things, which were setup for Debian squeezy:

# Install mail-transport-agent - postfix
$ sudo apt-get install postfix

# Install mail program (used in Ubuntu 12.04)
$ sudo apt-get install heirloom-mailx

The usage is described in short in TempMess#Cron_System_Mail.

# In case you need to change your postfix setup later:
$ sudo dpkg-reconfigure postfix  

You will get a menu selection:
   Internet-Site 
   Internet mit Smarthost 
   Satellitensystem 
   Nur lokal  

For me "Internet mit smarthost" looks most suited, if you have an email account at your provider.

Question: System-E-mail-Name : FADS11.peterswiki.de  <OK>
Question: SMTP-Relay-Server  : mail.arcor.de  <OK>
Question: Empfänger von E-Mails an Root und Postmaster: peter  <OK>
Question: Weitere Rechner, für die E-Mail akzeptiert werden soll : FADS11.peterswiki.de,  localhost  <OK>
Question: Synchrone Aktualisierungen der E-Mail-Warteschlange erzwingen?  <Nein>
Question: Lokale Netze: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128  <OK>
Question: Maximale Postfach-Größe (Bytes): 5000000  (5 MB) <OK>
Question: Zeichen für lokale Adress-Erweiterung: +  <OK>
Question: IP all, IPv4, IPv6: all <OK>
Question: Zu verwendende Internet-Protokolle: alle  <OK>

Messages, if all is OK:
 * Stopping Postfix Mail Transport Agent postfix                            [ OK ] 
setting synchronous mail queue updates: false
mailname is not a fully qualified domain name.  Not changing /etc/mailname.
  # means, no E-mail reception possible - OK
setting destinations: rudiswiki.de, localhost.localdomain, localhost
setting relayhost: mail.arcor.de
setting mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
setting mailbox_size_limit: 5000000
setting recipient_delimiter: +
setting inet_interfaces: all
setting inet_protocols: all

Postfix is now set up with the changes above.  If you need to make changes, edit
/etc/postfix/main.cf (and others) as needed.  To view Postfix configuration
values, see postconf(1).

After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.

Running newaliases
 * Stopping Postfix Mail Transport Agent postfix                       [ OK ] 
 * Starting Postfix Mail Transport Agent postfix                       [ OK ] 

name server for DNS

The name server for DNS queries is defined in:

$ cat /etc/resolv.conf
search fritz.box
nameserver 192.168.178.1
nameserver 192.168.17.1
# because the computer should work in 2 different networks, both routers must be listed,
# otherwise the time server client "ntpd" can not find the time and date.

$ sudo route -n
Kernel-IP-Routentabelle
Ziel            Router          Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.17.1    0.0.0.0         UG    0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
192.168.17.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0

Set ttyUSB group

In order to keep security but allow a user to use the serial USB port the device descriptor must be adopted:

# check owner and rights
$ ls -la /dev/ttyU*
crw------- 1 root root 188, 0 Jan  1  1970 /dev/ttyUSB0
crw------- 1 root root 188, 1 Jan  1  1970 /dev/ttyUSB1

# set group to "dialout"
$ sudo chown root:dialout /dev/ttyU*

# set group rights
$ sudo chmod g+rw /dev/ttyU*

# set actual date
$ sudo touch /dev/ttyUSB*

# check
$ ls -la /dev/ttyU*
crw-rw---- 1 root dialout 188, 0 Mär  7 06:10 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 1 Mär  7 06:10 /dev/ttyUSB1

U-boot parameter read and write

Both utilities are installed with the installation script, or with package u-boot-tools.

# If fw_printenv is not found:
$ apt-get install u-boot-tools
# List all files of package
$ dpkg -L u-boot-tools

# Read out u-boot environment parameters
$ fw_printenv
...
ethaddr=00:10:75:1A:CF:0B
arcNumber=2998
rescue_installed=1

# set a number:
$ fw_setenv arcNumber 2998
or
# set a text:
$ fw_setenv bootcmd_pogo 'run bootcmd_rescue'

Debian squeezy, ver. 6

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.

Configuration and Extensions

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
Linux debian 2.6.32-5-kirkwood #1 Sun Sep 23 22:53:30 UTC 2012 armv5tel GNU/Linux

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

$ cat /etc/apt/sources.list # show the Debian repository source address

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 apt-utils
$ apt-get install mc               # midnight commander, mc -a
$ apt-get install locales          # 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 cron   # start programs at certain times
$ 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 user           # add user with non root rights for better security
$ apt-get install sudo   # to get temporary root rights for a user

# add the user to the groups (/etc/group) dialout, www-data, sudo
$ usermod -a -G dialout user
$ usermod -a -G www-data user
$ usermod -a -G sudo user

# check for groups
$ id user

$ 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 

Depending on the rescue system what you have in the flash ROM you could do:
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 
shut off the LED.
Edit file led_off.sh
$ cd /etc/init.d
$ sudo vi led_off.sh
or
$ sudo touch led_off.sh
$ sudo mc
#! /bin/sh
# switch LED OFF at halt to show user when to cut power
echo none > /sys/class/leds/dockstar\:green\:health/trigger
exit 0

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"
  echo none > /sys/class/leds/dockstar\:green\:health/trigger
  halt -d -f $netdown $poweroff $hddown

# Halt the system
$ sudo shutdown -h now
or
$ sudo halt

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). An alternative is to write the log into tmpfs, see busybox-syslogd.

# edit in /etc/default/busybox-syslogd:

# log to RAM
SYSLOG_OPTS="-C128"
# read out with command "logread"

# log to tmpfs
SYSLOG_OPTS="-O /var/volatile/messages"

# in case of a change do afterwards:
$ sudo service busybox-syslogd restart

To read the messages from RAM disk (option -C128) 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

# read out the log, last 10 lines
$ logread | tail

In order to save the logfile to the USB Flash on a daily base it would be nice, to have an automatic log file rotation. Unfortunately in the Debian wheezy distribution in the busybox package version 1.20.2 (Debian 1:1.20.0-7) the options for log rotation in the command busybox-syslogd are removed. Hence, you have to use the normal package logrotate. See the following setup for /var/volatile/messages:

# create RAM-disk if necessary
$ sudo mkdir /var/volatile
$ sudo chmod 755 /var/volatile
$ sudo mount -t tmpfs -o size=10% none /var/volatile
# append to /etc/fstab
tmpfs          /var/volatile   tmpfs   defaults,size=10%,mode=755 0       0

# install logrotate package
$ sudo apt-get install logrotate

# create file "messages" in /etc/logrotate.d/
$ cat /etc/logrotate.d/messages
/var/volatile/messages {
        daily
        rotate 1
        copytruncate
        missingok
        sharedscripts
        postrotate
            day=$(date +%Y-%m-%d)
            # Path "~" will give "/root" instead of "/home/rudi"!
            mv /var/volatile/messages.1 /home/rudi/log/messages-$day.log
        endscript

}


# show the backup log file
$ ls ~/log
messages-20130527.log

The option -d with the command logrotate was very helpful to debug the setup. It shows, what logrotate would do, if it is called, normally at 06:25 every day with the cron job (/etc/cron.daily/logrotate).

Use of fail2ban

The program fail2ban periodically scans log files in order to find with regular expressions attacks on the server. Then the specified action is executed. Usually the IP-number of the attacker is banned via the programm iptables. This can reduce the load of the server. There are three programs within this application:

Unfortunately fail2ban can not readout from the RAM disk with logread from busybox-syslogd. In this case you have to use a normal log file in a RAM disk, e.g. /var/volatile/messages and rotate it with the program logrotate. This setup is shown in the previous chapter.

In order to catch forbidden SSH logins, the filter filter.d/sshd.conf must be extended with the regex:

# because of the "busybox-syslogd" syntax, compared to "syslogd-ng"
Failed [-/\w]+ for .* from <HOST>

After a change of a filter file, the quickest way to bring it online is:

$ sudo fail2ban-client reload

In order to find out, how many IP numbers are blocked, use the command:

$ sudo iptables -L -n | wc -l
[sudo] password for <user>:
30   # for example

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.

Debian Squeeze upgrade 2.6.37.7

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

If you have installed kernel 2.6.35.7, 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 2012-08-29:
root@FADS92:~# apt-get upgrade
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut
Statusinformationen werden eingelesen... Fertig
Die folgenden Pakete werden aktualisiert (Upgrade):
  adduser apt apt-utils atop base-files binutils bsdutils busybox-static busybox-syslogd bzip2
  cpp cpp-4.3 cpp-4.4 cron dash dbus debconf debconf-i18n dpkg dpkg-dev e2fslibs e2fsprogs
  file findutils firmware-ralink fuse-utils g++ g++-4.4 gcc gcc-4.3 gcc-4.3-base gcc-4.4
  gcc-4.4-base gnuplot gnuplot-nox gnuplot-x11 hdparm imagemagick initramfs-tools initscripts
  iputils-ping iso-codes joe klibc-utils libacl1 libasound2 libaudio2 libavahi-client3
  libavahi-common-data libavahi-common3 libavcodec52 libavformat52 libavutil49 libblkid1
  libbz2-1.0 libc-bin libc-dev-bin libc6 libc6-dev libcomerr2 libcups2 libdbus-1-3
  libdbus-glib-1-2 libdpkg-perl libdrm2 libedit2 libfaad2 libffi5 libfreetype6 libfuse2
  libgcc1 libgd2-noxpm libgl1-mesa-glx libglu1-mesa libgnutls26 libgomp1 libgssapi-krb5-2
  libgtk2.0-0 libgtk2.0-common libgudev-1.0-0 libice6 libjasper1 libk5crypto3 libklibc
  libkrb5-3 libkrb5support0 libldap-2.4-2 liblzma2 libmagic1 libmagickcore3 libmagickwand3
  libmodplug1 libmtp8 libncurses5 libncurses5-dev libncursesw5 libnl1 liborc-0.4-0
  libpam-modules libpam-runtime libpam0g libpango1.0-0 libpango1.0-common libpcap0.8 libpci3
  libpcsclite1 libpng12-0 libpostproc51 libproxy0 libqtcore4 libqtgui4 libsasl2-2
  libsdl1.2debian libsdl1.2debian-alsa libsmbclient libsqlite3-0 libss2 libssl0.9.8 libstdc++6
  libstdc++6-4.4-dev libswscale0 libsysfs2 libtasn1-3 libtiff4 libudev0 libuuid1 libvlc5
  libvlccore4 libvorbis0a libvorbisenc2 libwbclient0 libx11-6 libx11-data libx11-xcb1 libxi6
  libxml2 linux-base linux-headers-2.6.32-5-common linux-headers-2.6.32-5-kirkwood
  linux-libc-dev locales login lsb-base man-db mc module-init-tools mount ncurses-base
  ncurses-bin netbase ntpdate openssh-client openssh-server passwd pciutils perl perl-base
  perl-modules pkg-config procps python python-central python-minimal python-support
  python-wicd python2.6 python2.6-minimal samba samba-common samba-common-bin shared-mime-info
  smbclient sudo sysv-rc sysvinit sysvinit-utils tar tzdata udev update-inetd usbutils
  util-linux uvccapture vlc vlc-data vlc-nox wicd-curses wicd-daemon wpasupplicant x11-common
  xz-utils
191 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
Es müssen 163M B an Archiven heruntergeladen werden.
Nach dieser Operation werden 4.615k B Plattenplatz freigegeben.
Möchten Sie fortfahren [J/n]? j
...
Hole:191 http://ftp.us.debian.org/debian/ squeeze/main vlc-nox armel 1.1.3-1squeeze6 [3.251kB]
Es wurden 163M B in 16 min 8 s geholt (168k B/s)
Extrahiere Vorlagen aus Paketen: 100%
Vorkonfiguration der Pakete ...

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 ddrescue and gparted for that task, on a desktop system. Doing so on the DockStar need more command line effort, with the risk of mistyping. See also at Clone USB-stick.

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.
or better
# Install the program ddrescue, which shows the data rate immediately.
$ sudo apt-get install gddrescue

# The target media should have a partition size with similar size of the source partition.
# Example (ddrescue shows the progress and data rate):
$ sudo ddrescue -b 1M -f /dev/sda1 /dev/sdb1 ddrescue.log
# ddrescue will report at the end of copying an error of partition size mismatch.

If you are curious what is the status of dd, 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.

This procedure was developed with the help of several Internet sources, e.g.

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.

Help for a kernel update and LED support, kernel 3.3.

List of pages in this category:

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


Go back to CategoryDockStar or FrontPage ; KontaktEmail (ContactEmail)

rudiswiki9: DockStarDebian (last edited 2015-05-18 10:22:30 by RudolfReuter)