Archive for the ‘fun-projects’ Category

Using an Linksys E3000 AP as a general linux server

Wednesday, September 21st, 2011

Recently I said farwell and thanks for all the fish to my old Linksys WRT54G router(s). They served me well for many years, but end the end they lacked IEEE 802.11n and 1000BASE-T. After looking around I decided to buy the Linksys E3000 AP. It stayed within my budget, had almost all features I desired and could also run community based firmware.

I tried to run with the built in firmware. And I did. For a month or so. And then I gave in and installed dd-wrt on the thing. The built-in firmware works and is stable. But boy it lacks features!

Getting dd-wrt onto my AP was easy due to this tutorial. After I got dd-wrt onto the AP I had myself a full blown linux distribution. Comparing the E3000 with its 240MHz MIPS cpu and 64MB memory to my first PC with its 66MHz intel 80486 with 4MB memory made me smile ;-)

root@dd-wrt:~# cat /proc/cpuinfo
system type             : Broadcom BCM4716 chip rev 1
processor               : 0
cpu model               : MIPS 74K V4.0
BogoMIPS                : 239.20
wait instruction        : no
microsecond timers      : yes
tlb_entries             : 64
extra interrupt vector  : no
hardware watchpoint     : yes
ASEs implemented        : mips16 dsp
shadow register sets    : 1
VCED exceptions         : not available
VCEI exceptions         : not available

Having such a small nifty general purpose platform at my disposal ofcourse made me think what I should use it for (besides moving bytes around in my house). I found these things I want to and/or have implemented on it:

  • Local DNS server. I have many many projects brewing all the time and have vast amount of hardware. I utilize a DNS server to keep track of my ip assignments, either static or through DHCP. Running a DNS server on the router is a must.
  • PXEBOOT server.
  • TFTP server.
  • NFS server
  • DansGuardian filter

Small perl mechanize script to send sms from danish telco provider Bibob

Thursday, July 28th, 2011

It can be handy to send sms’es from scripts. In old time you could do that in Telia by sending a mail to <mobile number> But that service was closed. Now that I am leaving Telia in favor of Bibob I saw that they had a websms service.

And so I combined their fine web service with my perl scripting skillz. The script can be downloaded here

Do not forget the agreement between you and bibob. You are only allowed to use the websms service (and thus this script) for personal use. I am not to blame if bibob closes your bibob account because you spam-smsed a lot of people.

The code is also included here:


#!/usr/bin/perl -w

# File:
# Type:         bot
# Description:  Send an SMS using bibob websms and perl mechanize
# Language:     Perl
# Version:      1.0
# License:      BeerWare – Thomas S. Iversen wrote this file.
#               As long as you retain this notice you can
#               do whatever you want with this stuff.
#               If we meet some day, and you think this stuff is
#               worth it, you can buy me a beer in return. Thomas
# History:
#               1.0 – 2011.07.28 – Intial version
# (C) 2011 Thomas S. Iversen (

use strict;
use WWW::Mechanize;
use File::Basename;

# Variables controlling bot behaviour

my $sms_url=‘’;
my $login_url=‘’;

my $script=basename($0);
die "$script <bibob mobile number> <bibob password> <recipeient number> <message>" if(!($#ARGV+1 == 4));

my $username=$ARGV[0];
my $password=$ARGV[1];
my $recipients=$ARGV[2];
my $message=$ARGV[3];

# You should not need to alter anything below this line

# Main code.

# Create mechanize instance
my $mech = WWW::Mechanize->new( autocheck => 1 ); #Create new browser object
$mech->agent_alias( ‘Windows IE 6′ ); #Create fake headers just in case
$mech->add_header( ‘Accept’ => ‘text/xml,application/xml,application/xhtml\+xml,text/html,text/plain,image/png’ );
$mech->add_header( ‘Accept-Language’ => ‘en-us,en’ );
$mech->add_header( ‘Accept-Charset’ => ‘ISO-8859-1,utf-8′ );
$mech->add_header( ‘Accept-Language’ => ‘en-us,en’ );
$mech->add_header( ‘Keep-Alive’ => ’300′ );
$mech->add_header( ‘Connection’ => ‘keep-alive’ );

# Get login page
$mech->success or die "Can’t get the login page";

# Submit the login form with username (mobilnumber) and password
$mech->submit_form(with_fields => { ‘loginmsisdn’ => $username, ‘login-password’ => $password });
$mech->success or die "Could not login";

# Get sms page
$mech->success or die "Could not get sms page";

# Send sms by submitting sms form
$mech->submit_form(with_fields => { ‘recipients’ => $recipients, ‘message’ => $message });
$mech->success or die "Could not send sms";

# Figure out status
my $html = $mech->content();
die "Form submitted, but message does not appear to be sent" if(!$html=~/Beskeden blev afsendt/ig);

exit 0;

Upgrading OBP and ALOM on a SunFire v210/v240

Sunday, July 24th, 2011

Recently I got my hands on a piece of oldish SUN equipment (SunFire V210/V240). It was in an ok condition. Not perfect, but still usable and I will be able to fix the smaller issues.

One of the issues was the really really old OBP and ALOM installed. In this post I will show how to upgrade OBP and ALOM. The key thing to remember is to

  1. Read ALL the attached readmes and whats not.
  2. Make sure ALL dependencies are met
  3. Upgrade the OBP before you upgrade the ALOM

And as usual. If you break your stuff following this post, then sorry but I can and will not be held responsible for anything you do. It worked for me. If it works for you, great. If it doesn’t, then tuff luck.

With that out of the way lets get started. First we need to obtain the ALOM and OPB patch. As a private person you might have a hard time getting hold of these files without an active support contract with oracle. I know I had. Mail  me if you run out of luck. You will need

  • – OBP 4.30.0
  • ALOM_1.6.10_fw_hw0.tar.gz – ALOM 1.6.10

Below is the raw output of the upgrade so you can see how it is done. OBP first

**** While in the OS download and unpack the OBP firmware

# wget http://someserver/

# unzip

# cd 142700-02

# cp flash-update*  /

# chmod 755 /flash-update*

# halt

**** From the OBP prompt issue

ok boot disk /flash-update-SunFire240

Firmware Release(s)                Firmware Release(s)
Currently Existing in the System      Available for Installation  /  Install?
———————————- ——————————————-
OBP 4.11.4 2003/07/23 08:04        OBP 4.30.0 2010/01/06 14:48          YES
POST 4.30.4 2010/01/06 15:10         YES

Type sa if you wish to select all available firmware releases for
installation.  Type h for help, quit to exit, or cont to continue: cont

The Flash programming process is about to begin.
Type h for help, q to quit, Return or Enter to continue:

Erasing the top half of the Flash PROM.
Programming OBP into the top half of the Flash PROM.
Verifying OBP in the top half of the Flash PROM.

Erasing the top half of the Flash PROM.
Programming POST into the top half of Flash PROM.
Verifying POST in the top half of the Flash PROM.
Programming was successful.

SC Alert: Host System has Reset
SC Alert: Host System has read and cleared bootmode.

Configuring system memory & CPU(s)
Probing system devices
Probing memory
NOTICE: Initializing security keystore
Probing I/O buses

Sun Fire V210, No Keyboard
Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
OpenBoot 4.30.4.a, 4096 MB memory installed, Serial #57866961.
Ethernet address 0:3:ba:72:fa:d1, Host ID: 8372fad1.

NOTICE: Updating OpenBoot NVRAM diagnostic configuration variables..
diag-script =  normal
diag-trigger =          error-reset power-on-reset
diag-level =            max
verbosity =             normal
service-mode? =         false
auto-boot-on-error? =   true
error-reset-recovery =  sync

Your OBP is now updated. Now to the ALOM. From the OS

# firmware

# /usr/platform/`uname -i`/sbin/scadm version

SC Version v1.3
SC Bootmon Version:  v1.3.0
SC Firmware Version:  v1.3.0

# /usr/platform/`uname -i`/sbin/scadm download boot alombootfw
……………….. (100%)
Download completed successfully

Please wait for verification


# sleep 60
#  /usr/platform/`uname -i`/sbin/scadm version

SC Version v1.3
SC Bootmon Version:  v1.6.10
SC Firmware Version:  v1.3.0

# sleep 120
#  /usr/platform/`uname -i`/sbin/scadm version

SC Version v1.6
SC Bootmon Version:  v1.6.10
SC Firmware Version:  v1.6.10

You ALOM is now updated. Nothing fancy really.

Replacing a fuse on an Vaillant Ecotec gasburner

Monday, July 4th, 2011

Last night a big thunderstorm hit my home.

Ligtning hitting Sealand Denmark

During the storm a lightning actually hit the house/so close to the house that it went into the electrical system. Luckily the legislation about electricity in danish households requires that electricians installs HPFI and thermo fuses, so after the a white spark out of a wall plug, the HPFI and thermo fuses kicked in and took down the whole system.

…. or so I thought. The lightning had actually been fast enough to hit the control unit of my Gas Boiler – It would not turn on this morning to heat water for the day.

This post will show how to open a vaillant ecotec gasboiler and exchange the fuse(s).


Turn off your boiler before doing anything. Disconnect it from the wall plug. Use original fuses. If in doubt – STOP! Do not tamper with the Gas part of the heater! If the fuse blows again, do NOT substitute with something that can not blow! Do call an qualified repair man if that happens!

And finally: if you blow up yourself and/or your house/friends/families/dogs/whatever I can not be held responsible! Do not trust a stranger on the internet just because you are trying to save a few bucks!

Safety before anything else!


With the disclaimer out of the way, lets get going. First locate the front of your boiler. It will look like this.


The front of the boiler is held in place by one screw on the bottom:


Remove the screw with a screwdriver


Remove the front by pulling outwards after you have ‘unclipped’ it (there are two clips to secure it besides the screw)


You should now be able to look inside the boiler. If you are unsecure, stop. Remember the disclaimer!


Grab the to white, apply pressure and pull down the control unit like this:


Now we are going to open up the control unit.


Locate the fuses:


Exchange the fuses. On the vaillant you have two spare fuses on the inside of the control unit:

Assemble the whole lot back and turn on the boiler again. Hopefully it will come back to life. If it doesn’t something is seriously wrong – call an vaillant approved repair man.

And …. do not forget to order a new fuse right away!

Fixing B155B071 errors on power systems

Sunday, June 26th, 2011

I recently got my hands on a couple of Power5 servers. IBM 9110-510 and 9110-51a to be precise. When powered up, one of them gave an unrecoverable error – B155B071 and halted. You can then power on the server again and it will continue.

Being new to all this power stuff, it took me a couple of hours to figure out what was wrong and how to fix the problem. Amongst IBMs many good pages about the power tech, you will find on titled “(B1xx) Service processor firmware reference code descriptions“. On that page you can read that B155B071 means “Invalid/Un-Programmed Serial Number in Enclosure”.

To fix that, connect to you power system using the ASMI and then

  • Power down you power server.
  • Expand the system configuration list
  • Expand the program Vital Product Data list
  • Click on “System Enclosure”
  • Put in a serial number for the system enclosure. A serial number that is different from the serial number of the server!
  • The service processor will reboot

You should now be able to boot your power server without any B155B071 standing in your way.

Installing ESXi 4.1 on an AMD Brazos platform

Saturday, April 23rd, 2011

One of my projects this easter was to give my home server an overhaul. The harddrives was running very low on kapacity and the Ubuntu server installation was beginning to be a nightmare to maintain. I choose to upgrade the hardware as well and then thrown in ESXi into the equation as well.

The hardware

The hardware centers around an  ASUS E35M1-M mainboard with an AMD Zarcate APU and a AMD Hudson M1 FCH. The APU has two cores, a TDP of mere 18W and has the AMD-V extensions.

I bought 2 x 4GB of memory for the setup, which is maximum for the board.  Lastly I bought a couple of Samsung F4EG HD204ui drives (low power, low cost, high capacity, resonable performance)

Planning it

Planning the installation revealed that

  • ESXi 4.1 does not support the board; the onboard NIC is not supported.
  • The Samsung drives has a serious firmware bug.
  • The E35M1-1 doesn’t have raid functionality, if you care about (some of) your data.
  • The E35M1-1 board has an EATX 24pin power connector and my oldish antec cabinet/psu only has an ATX 20pin.

All items can either be fixed or worked around, not to worry.

Getting the hardware running.

I put the hardware together in my oldish Antec cabinet. I then used a standard $10 multimeter to verify that the 4 extra pins on the EATX connector on the mainboard (compared to a normal 20 pin ATX connector),  was in fact hardwired/bridged to other pins on the mainboard. This bascially means, that a 20 pin ATX PSU will suffice for this board.

Hardware assembled. Using an normal ATX 20 pins PSU

After that, I obtained the firmware fix for the Samsung drives. It turned out, that I did not need it as drives manufactured later than December 2010 already contains the fix according to this post.

Installing ESXi 4.1 on the E35M1-M

You can download ESXi 4.1 for free. I did that. I burned the .iso file and booted from the CD. It booted the hypervisor, but complained/failed when I pressed F11 for installation. As guessed, it is due to the fact that the NIC, an RealTek 8111E is not supported.

The fix is to include the realtek 8111E driver in the iso file, in two places: One place, used to include support in the installer. An one inside the ddimage, that the installer deploys onto the hardware. It is fairly simple if you know your way around linux. Instructions on how to build ESXi modules is on the net. For the lazy, you can pretty much get it served to you: an oem.tgz (local copy here) and a script called mkesxiaio (local copy here) that combines the oem.tgz and the ESXi installation iso.

Download iso and oem.tgz and script. Run script and burn resulting iso file. Boot that iso and install ESXi 4.1 onto the system. For me it worked flawlessly.

Booting the ESXi 4.1 hypervisor on the ASUS E35M1-M mainboard

The Software side

After that I installed the ESX license key, provisioned an vm, installed debian 6.0 and migrated all my files to the new server.

In the past I used to have a raid setup. The Hudson H1 FCH does not have raid support and neither does ESXi, except on selected raid controllers. Now what?

The trick is to do it in software on the VM side. You provision two VM disks, one from each datastore, and combine them into a mirror/raid device inside the vm. You basically have two options:

  1. md driver
  2. lvm mirror

If you care about performance and the integrity of your data, you should go for the md driver as it respects write barriers.  for my setup I thus ended up with 5 vmdisks

  • One for the OS
  • two combined into an md device for the crucial stuff and that in turn was used in a vg called vgsafe
  • two spanned across that datastores for the the non crucial stuff.  Those disks were just added to a vg called vgspan
edison% mount | egrep -i ‘(mapper|boot)’
/dev/mapper/edison-root on / type ext3 (rw,errors=remount-ro)
/dev/sda1 on /boot type ext2 (rw)
/dev/mapper/edison-tmp on /tmp type ext3 (rw)
/dev/mapper/edison-usr on /usr type ext3 (rw)
/dev/mapper/edison-var on /var type ext3 (rw)
/dev/mapper/vgsafe-lvhome on /home type ext4 (rw)
/dev/mapper/vgspan-software on /home/software type ext4 (rw)
/dev/mapper/vgspan-media on /home/media type xfs (rw)

Setting up 2 Linksys wrt54g(l) in a WDS with the tomato firmware.

Saturday, September 25th, 2010

Since 2004 I have been using a Linksys wrt54g as my access point at home. Having tried a lot of different firmwares (original linksys, sveasoft,DD-WRT, OpenWRT) over the years, I eventually settled for the nice and easy tomato firmware in 2008.

Here in 2010 I got my hand on yet another wrt54g linux based access point. This time it was an wrt54gl. Ofcourse I then had to join those two into a wireless distribution system (WDS). One of the reason that I like the tomato firmware is that things like that become fairly easy. Growing older also means that you value your sparetime much higher than you did while you were younger ;-)

A little bit of planning before we embark. The original AP (AP1) has ip address, runs a dhcp server and has a WAN connection on the “outside”. The new AP (AP2) are going to get ip address, not run a dhcp server and have no WAN connection.

With that in place, here is how I did it.

  1. Get access to AP2. I connected the the AP back to back with a PC powered on the AP, held the reset button in for 30 seconds and then released it. That resets all settings in the AP making it possible to log in as the default admin/admin user if it is the original linksys firmware. It was in my case.
  2. Flashing AP2 with a new firmware.  I downloaded tomato firmware 1.27 from polarcloud. After unpacking the firmware I simply upgraded/reflashed the AP using the inbuilt webserver. No fancy trickery there.
  3. After that, I went into AP1 and got hold of the following information:
    • the channel (Channel 8 )
    • the SSID (
    • the encryption standard (WPA2, AES)
    • the encryption key (not telling you)
    • the ip address of the AP (
    • and he mac address of the AP (00:0F:66:51:CA:EF)
  4. I then connected my Laptop to AP2, with a crossover cable and browsed the built in tomato webserver. I configured AP2 in this way:
    • Under basic/identification, set router name to tomato2, set hostname to tomato2, set domain name to
    • Under basic/network, disable wan, check use wan port for lan, set router ip address to, set default gateway to (ip address of AP1), set the Wireless mode to Access Point + WDS.
    • Under basic/network, set the SSID, the channel and encryption as AP1.
    • Under WDS, update the “Link with” list, with 00:0F:66:51:CA:F0, which is the mac address of AP1.

    Settings of AP2

  5. Furthermore I reconfigured AP1
    • under the basic/network tab, change Wireless mode from Access point to Access Point + WDS
    • Under WDS, update the “Link with” list, with 00:25:9C:CF:F1:4E, which is the mac address of AP2

    Settings of AP1

And that was it.

Revitalizing an aging Nokia E66 mobile phone

Tuesday, July 27th, 2010

I had decided to give my wife my E66, but my E66 was pretty much worn out. The case had started to fall apart and there was dust beneath the glass protecting the TFT screen.

What was wrong with the E66? (broken fascia)

What was wrong with the E66? (wear and tear)

It is possible to buy spareparts for mobile phones though. Buying them from a local dealer in your country will surely set you back many many dollars. Luckily Ebay came to the rescue. I bought a new fascia housing for my Nokia E66. Only  set me back around $10.

The seller states:

NOT supplied fitting manual
Replacing your phone with this new fascia, the preference to phone shop engineering maintainers or alternatively change it by yourself with any of corresponding tools.

So this blogpost constitutes a walkthrough on how to replacing the fascia, in case somebody else decides to revitalizing his or hers aging Nokia E66.

What was in the package from the seller?

Old phone and new package

Unpacking the new stuff (fascia and 3 screwdrivers)

Unpacking (taking the new fascia apart)

I then started to take the old phone apart. Gently, noting where everything went. This is not the time where you want to have leftovers afterwards!

Taking the E66 apart (remove battery and SIM)

Next up, remove the screws. Notice carefully what screws belongs to what hole. There are 3 different screws on the back.

Taking the E66 apart (reming the 6 screws from the back)

Next seperate the front and the back from the actual phone mainboard. Do this very very carefully. Do not get angry! And do not use excessive force. Everything in the phone are hold together using plastic tabs at this point.

Detaching the phone mainboard from the back and front

The two connectors from the front and back PCB to the main PCB needs to be detached gently. They will come off without force if you do it right.

The front and back cover seperated from the mainboard

Working on the back, you need to detach the PCB where all the buttons are located. Gently use a thin screwdriver for this. You also need to detach the power connector. That is most easily done by putting a screwdriver into the powerconnector, tipping the screwdriver downwards. That will make the connector pop out of its plastic tabs.

The button PCB of the back being detached

The button PCB hanging in midair

The button PCB and power connector removed

Assembling the back is just the reverse process. Keywords are: patience, low force, patience

Attaching power and button PCB onto new back fascia

Back part done

Working on the front part. Unscrew the two screws holding the PCB onto the slider. Do not fall for the urge to do anything about the spring system!! If you do, you will not get a working phone afterwards!

After unscrewing the two screws, you can pull the PCB out of the fascia. I then cleaned the TFT and put the PCB into the new fascia.

Seperating the front and cleaning it

Putting the front PCB into the new fascia

Front and back fascia was now done.

Front and back are exchanged

Assembly of the parts again. Just reverse the steps you did when taking the phone apart.

Only battery and SIM missing

And then

All done

And it is still alive, who should have thought that ;-)

It is alive

How to use a broken IBM Thinkpad T43 for something useful using puppy linux.

Wednesday, July 21st, 2010

I recently got my hands on a IBM Thinkpad T43. Unfortunately it was broken. More specifically the connector between the mainboard and the harddrive had problems.

IBM T43 connector (broken)

I googled a bit and discovered, that this was a known problem. The laptop worked fine, if I put pressure on the right spot on the case of the Thinkpad. Otherwise it would not detect and/or spin up the harddrive. I tried to fix it by re-soldering the connector and using some two-component glue to fixate the connector. I did not succeed :-/

So then what? Throw out the laptop? Or? … I decided to make a project out of it.

A laptop without storage is useless. Due to the broken connector, I could not use a harddrive. I did not want to use a cdrom as it is a slow medium. That left me with a USB flash drive as the only option. It would be a clumsy solution just to plug a USB flash drive into the laptop and be done with it, so I chose to solder a USB flash directly onto the mainboard.

First I stripped a standard 1GB USB Flash from its case and detached the PCB from the USB connector using a soldering iron

Stripped USB flash

After that I soldered 5 wires onto the PCB of the laptop and used one of the holes in the PCB used for assembly as a pass through hole. I initially used 4 wires as the USB connector only had 4 pins, but that was not enough. More on that later.

Wires soldered onto mainboard

Having soldered the wires onto to the mainboard, I now needed to solder the other ends onto to the PCB of the USB flash. That went fairly smoothly

Wires soldered onto flash

Before powering on anything, I used a multimeter to check for bad solderjoins and shorts. I found neither.

Checking for shorts using digital multimeter

Luckily I had a Linux based rescue distribution installed on the USB flash drive, so I just booted that to see if the operation on the T43 was a success. As can be seen below it worked just fine. Well, sort of fine, but more on that in a moment.

Testbooting the flashdrive

Almost done now. I just needed to assemble the laptop again, leaving the USB Flash inside.

Ready to wrap up

Closing the lid on the laptop, securing all the screws I had myself a working IBM Thinkpad T43. Or so I thought. When I tested the laptop thoroughly I discovered that the kernel ring buffer was filled with

hub 2-0:1.0: over-current change on port 1
hub 2-0:1.0: over-current change on port 2

That cryptic message just states that the USB device is drawing more power than it is allowed to by the USB specification. Or more precisely that the port on the USB hub inside the laptop is delivering more power than it was supposed to. It first that puzzled me. Then I read about the USB connector and realized my fail. The 4 wires of the USB connector consists of  VCC, GND, Data+ and Data –. Given both VCC and GND was part of the 4 pins I only soldered 4 pins. After seeing the problems above, I investigated the matter and found a reference to OverCurrent (OC) protection on the header itself. I thus soldered the 5th pin and the problem went away.

I now had a working IBM Thinkpad T43 with 1GB of flash storage. What should I use it for? I decided to use it for puppy linux. Primarily for two reasons.

  1. It appeared to be tailor made for small harddrives
  2. I had never tried it before

I downloaded the 106MB large iso file and burned it onto a CDrom. Now I faced the problem of installing puppy linux onto my flash without using a cdrom drive (as I found the laptop without one). Puppy linux made it quite easy. Using another computer I booted the cdrom. Installed puppy onto a spare flash drive. Booted that flash drive in my IBM Thinkpad T43 and pressed “install” once more, installing it onto the “internal” flash drive.

Booted into puppy linux

All done. Actually it takes quite some time to boot the machine, but that is primarily due to the bios insisting on searching for a harddrive. Unfortunately the IBM BIOS lacks the option to stop it from doing that. After the system is loaded however, it is lightning fast. Way faster than my IBM Thinkpad T400. This is due to the fact that puppy linux loads everything into a ramdisk, so starting program does not require any moving parts to be ready. Programs starts instantaneously. The whole experience just proves (once more), that the computers of today is severely I/O limited, but hopefully SSD will change that real soon now(tm)