Monday, December 23, 2013

PogoPlug E02 - configure LEDs

Make the following modifications to turn the front LED green when the boot process is completed and turn the LED off when it's save to unplug the PogoPlug.

1. Install a kernel with LED support onto the PogoPlug. 
Instructions here: Linux Kernel 3.12.0 Kirkwood package ...
I installed Kernel 3.12.0, which is the latest at the moment.

2. edit /etc/rc.local
add these lines:
echo none > sys/class/leds/status\:orange\:fault/trigger
echo default-on > sys/class/leds/status\:green\:health/trigger
* this will turn off the orange LED and turn on the green LED

2a. to show network traffic by blinking the orange LED:
#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/status\:orange\:fault/trigger
 
(Note: might have to install iptables with apt-get install iptables)

3. edit /etc/init.d/halt
add this line BEFORE "halt -d -f $netdown ...":
echo none > sys/class/leds/status\:green\:health/trigger

(Note: in the instructions here it says to add the line AFTER the "halt" line but that did not work for me. It seems execution stops at the "halt" line an dsubsequent code is not executed.)

(Note2: if you see an LED called "status:blue:health" in /sys/class/leds then your PogoPlug is not properly recognized and the machine is running as a SheevaPlug. You might need to set the environment:
fw_setenv machid dd6

details are here.


Saturday, December 21, 2013

PogoPlug E02 - move Debian to larger USB drive

USB drives are getting bigger and cheaper. Here are the steps I used ot move my Debian Wheezy installation from a 4GB USB drive to an 8GB USB drive.

1. partition the new drive the same way the existing one is partitioned
    * use fdisk for this step
    * this can be done on the PogoPlug or on another Linux computer
    * e.g. 3.5GB root partition (ext2) and 500MB swap partition
    * Note: this could have been done with GParted as well

2. on another Linux computer format the new USB drive partitions as ext2 and linux-swap respectively
    * I used GParted for this

3. on another Linux computer, copy the old drive to the new drive using rsync
    * plug in both drives into your Linux machine
    * mount both drives
    * as root in a terminal window:
       rsync -av /media/USBCurrent/ /media/USBNew/    
       (make sure to use the correct mount folders, careful to list the SOURCE first)
    * unmount both drives

4. check installation
   * plug new USB drive into PogoPlug
   * power on PogoPlug
   * wait for system to boot, should show up under the same name/IP as the old one

5. expand the root partition to the larger size
   * shut down PogoPlug
   * unplug new USB drive
   * plug new USB drive into Linux computer
   * with GParted move the swap partition to the end of the drive and resize the root partition as needed

6.Boot up PogoPlug
  * plug new USB drive back into the PogoPlug and power on PogoPlug


7. The UUID for the swap partition might have changed since using GParted to move/resize the swap partition.

If you issue the "top" command and under "KiB Swap" it shows 0, you have to fix this:

List the known UUIDs:
blkid -c /dev/null
Check fstab:
cat /etc/fstab

If the UUID in fstab for the line containing the swap partition does not match the UUID from the blkid output do this:
- edit fstab to change the swap partition line to the correct UUID, then save fstab
- swapon -a  to enable the swap partition

check if the change worked, issue the "top" command and check at the top under "KiB Swap".

Friday, December 20, 2013

PogoPlug E02 - Install Debian

I got myself another cheap PogoPlug E02 from Adorama . It is sold as a model P21, but I actually got the E02, which is nicer (better processor, more RAM).

Steps to install Debian Linux on the PogoPlug

0. start up the PogoPlug, no drives attached

1. SSH into the PogoPlug (default password: ceadmin)

2. Disable the PogoPlug Service
    killall hbwd

3. install newer UBOOT as per instructions here: http://projects.doozan.com/uboot/
    - select to disable the PogoPlug service
    - set the arcNumber to 3542 as per here: http://archlinuxarm.org/forum/viewtopic.php?t=2780
     /usr/sbin/fw_setenv arcNumber 3542

4. plug in USB drive

5. partition the USB drive with fdisk
  - if fdisk gives "command not found" execute directly from /usr/sbin (this might also be in /sbin)
    cd /usr/sbin
    ./fdisk /dev/sda

- fdisk usage
  • p to show your current partitions
  • d 1 to delete your first partition, and if necessary d 2, d 3, and so on
  • p again to make sure there are no partitions left
  • n for new partition, p for primary, 1 for partition 1, enter to accept the default starting point, and then +(size)M to size it. I used a 2 GB drive, so I put +1536M for 1.5 GB
  • n, p, 2, enter, enter to create a swap partition out of the rest. Ideally you won't need a swap partition at all (we're going to try to avoid it), but better safe than sorry.
  • t to change filesystem types, 2 for the second partition, and 82 for swap. 
  • a, 1 to set partition 1 as active/bootable
  • p one last time to make sure everything looks okay. Once again, fdisk hasn't done anything to the drive yet, so if you see a mistake, you can either start over or fix it if you know what needs to be done.
  • And finally, w to write the partition table to disk and exit.

6. DOES NOT WORK: Install Debian Wheezy (7.0)

- Follow instructions from Jeff Doozan's site: http://projects.doozan.com/debian/ use Debian 7.0 (Wheezy)

  cd /tmp
  wget http://projects.doozan.com/debian/kirkwood.debian-wheezy.sh
  chmod +x kirkwood.debian-wheezy.sh
  export PATH=$PATH:/usr/sbin:/sbin
  ./kirkwood.debian-wheezy.sh

wait ...... (this may take some time)

Major Complications: I ran into the following error:
FATAL: Kernel too old in debootstrap

- tried to install rescue system, but you cannot install that from the device itself, needs to be booted from USB
- created USB boot drive with rescue system 3.0 (http://forum.doozan.com/read.php?4,8277) .. BUT from there you CANNOT seem to install the rescue system V2 into NAND - it says uBoot is outdated even though it's the latest version


After a lot of unsuccessful attempts went the following route:

1. install Debian Squeeze
Follow the instructions here: https://sites.google.com/site/leiqincwru/pogoplus/install-debian-squeeze-on-pogoplug-e02
(The regular instructions are here, but the above link has additional commands to be executed for the PogoPlug).


This is important for PogoPlug:
./mkimage -A arm -O linux -T kernel  -C none -a 0x00008000 -e 0x00008000 -n Linux-2.6.32-5-kirkwood -d ../../boot/vmlinuz-2.6.32-5-kirkwood ../../boot/uImage

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


2. install rescue system 2.8.2
  * link: http://forum.doozan.com/read.php?4,7915
  * copied files to the debian system installed under #1
  * install mtd-utils if flash_eraseall is not found (apt-get install mtd-utils)
  * manual install
flash_eraseall /dev/mtd1
nandwrite /dev/mtd1 uImage-mtd1.img


flash_eraseall /dev/mtd2
ubiformat /dev/mtd2 -s 512 -f rootfs-mtd2.img -y


fw_setenv set_bootargs_rescue 'setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts'
fw_setenv bootcmd_rescue 'run set_bootargs_rescue; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000'
fw_setenv bootcmd_pogo 'run bootcmd_rescue'
fw_setenv rescue_installed 1

3. upgrade from Squeeze to Wheezy - described here (http://blog.vinnymac.org/?p=11)

Finally. Success.

4. Optional:
  * update to a newer 3.x kernel from the following link: http://forum.doozan.com/read.php?2,12096
 


Note: apt-get upgrade might complain about half-installed packages because we manually installed the new kernel. In that case manually edit /var/lib/dpkg/status file and change "half-configured" to "installed". See here: http://ubuntuforums.org/showthread.php?t=1547998

Note2: after that there was still an error message about a "Configured-Version for package with inappropriate Status" - there was a line in the status file called "Config-Version". After it deleted that line the error went away.

5. Change the sources to the proper wheezy sources

vim /etc/apt/sources.list

add these lines, comment the others:

deb http://http.debian.net/debian wheezy main contrib non-free
deb http://http.debian.net/debian wheezy-updates main contrib non-free


6. Update your system
  apt-get update
  apt-get upgrade

7. Configure timezone

dpkg-reconfigure tzdata