Debian in 3.1 Watts

Measuring power savings

Since my Linksys EtherFast EZXS88W switch was always running 24/7, I wondered what its power draw is. It's tempting to rely on the datasheet that implies 1 Watt, but that doesn't take into account the AC adaptor. I measured the total draw, on a power meter, as 4.3 to 4.4 Watts.

Picture of Linksys switch and its power draw

My old PepLink Manga Plus contains an Arm processor running Linux, with a dedicated fast ethernet port eth0 labelled WAN, a built-in four port switch eth1 labelled LAN and a high speed capable USB 2.0 port. The meter reports that it draws 3.1 Watts when all four switch ports are in use.

Picture of Peplink switch and its power draw

I save more than one Watt of 24/7 power by replacing the dedicated switch with the Manga. That's about one kilo-Watt-hour per month (kWh/month) just for moving some cables.

The Linksys switch doesn't have a built in Linux system that can be used as an always-on server. A power thrifty laptop draws about 20 Watts so the combination would be at least 24 Watts. Update: An Apple Mac Mini is about 12 Watts.

Server and Ethernet Switch Watts, Monthly Power Usage
Peplink Manga (integrated) 3.1 2.3 kWh /month
x86 laptop plus Linksys switch 24.3 ~ 17.8 kWh /month
Debian Mac Mini plus Manga switch 15.2 11.1 kWh /month

Maybe you chatted with Phillip at one of the many events Peplink exhibited at. They offered a Software Development Kit (SDK) and encourage their customers to innovate. That's what originally got me interested in the Manga unit, since that's very different to some other Linux vendors.

However, I didn't really want to take on the extra effort of using special configuration tools and build chains just to reduce the power consumption of an existing system. I mentioned that to Phillip. He told me that he'd been routinely using various storage devices over USB and hadn't had any trouble. So, I decided the obvious solution was to install my normal distribution onto the Manga. That way, I administer it just like the box it replaces.

Debian

Why Debian? Because that's what I normally use. The Manga should work with most other distributions. Send me a link to your page when you've got it working...

Installing Debian on a Manga

  1. Locate at least 256 MB, preferably 512 MB, of USB compatible storage to be the root filesystem. I'm using a 1 GB flash drive for completely silent operation.

  2. Download and unpack the tarball of the root filesystem contents into your USB storage.
    # mkdir usbstorage
    # mkfs -t ext3 /dev/sda1
    # mount -t ext3 /dev/sda1 usbstorage
    # pushd usbstorage
    # tar -xzf ../manga-usbstorage.tar.gz
    # popd
    # umount usbstorage
    # rmdir usbstorage

  3. Follow the instructions that accompanied the unit on getting the Manga ready to receive a new flash image.
    # apt-get install minicom
    # minicom -s

  4. If on a Debian host, add one softlink needed by the flash loader.
    # ln -s /usr/sbin/arp /sbin/arp

  5. Download and write the kernel image to the Manga's boot flash chip.
    # ethloader 192.168.1.2 00:11:22:33:44:55 -k=manga-pivot-linux.zImage

  6. Download and write the linux ramdisk bootstrap to the Manga's boot flash chip.
    # ethloader 192.168.1.2 00:11:22:33:44:55 -r=manga-pivot-initrd.gz

  7. Power the Manga off, wait a few seconds, then turn it on. Wait for the bootup sequence to complete then login normally. The initial root password is manga and should be changed.
    # ssh root@192.168.1.2
    # passwd

  8. Install whatever software you want, consider adding an authorized key to the root account, change the ssh host key, add your personal user account, and generally have fun ...
    # apt-get install kernel-package nmap
    # ssh user@workstation cat .ssh/i*.pub > /root/.ssh/authorized_keys
    # ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa1
    # ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
    # adduser manga
    # nmap -O -sT 127.0.0.0/8

  9. The screenshots below were sent to me by Phillip and show his Windows XP desktop after following his instructions on setting up a graphical desktop. On the left, he is using four putty sessions to the Manga; you can see the corresponding sshd processes in the upper right top display. Python 2.3, sitting at its prompt in the lower left display, is only using 12% of the real system memory. On the right, he is using VNC Viewer to operate his native X display on the Manga; the same four programs are running. The Manga is effectively a thin client server.
    Windows XP screenshot Native X VNC screenshot

  10. This dangerous script can easily leave your Manga permanently unbootable. It should install a new image into one of the boot flash partitions; it has worked for me so far, but it's not particularly robust. Keep in mind that the kernel and the initrd (which has the kernel's modules in it) need to stay in step. This script allows kernel upgrades on a Debian Manga without needing to unplug the power cable. Which is hard to do, remotely.
    # ./manga-flash write kernel pivot-linux.zImage
    # ./manga-flash write initrd pivot-initrd.gz

  11. If you'd like the Manga to build its own kernel image, install the Debian development tools and compile this kernel with this config file.
    # apt-get install kernel-package
    # tar -xzf manga-linux-2.4.24-rmk2-manga0.tar.gz
    # ln -s linux-2.4.24-rmk2-manga0 pivot-linux
    # cp manga-pivot-linux.config pivot-linux/.config
    # pushd pivot-linux
    # make oldconfig
    # make zImage modules
    # popd
    # ln -s pivot-linux/arch/arm/boot/zImage pivot-linux.zImage

  12. If you'd like the Manga to build its own initial ramdisk, run this script to combine the kernel modules with this filesystem tarball.
    # modprobe loop
    # ./manga-pivot-initrd.sh

  13. Its busybox binary is not the Debian packaged one because we need the pivot_root and chroot commands. To build the needed version, compile busybox with this configuration.
    # tar -xzf busybox-1.00-rc2.tar.gz
    # cp manga-busybox-config busybox-1.00-rc2/.config
    # pushd busybox-1.00-rc2
    # make
    # popd

  14. To verify file integrity, here are some signed MD5 sums.

Future opportunities

You might wonder why I haven't bothered to integrate the kernel build management with the kernel-package automation that's native to Debian. There's a related project on SourceForge to migrate the Manga products from 2.4 kernels to 2.6 with JFFS2 support. When that's done, this ramdisk boot sequence can be replaced.

Meanwhile, it's not like I reboot my Debian machines very often.

(c) 2007 Alexander Perry < alex.perry@ieee.org >