Upgrade of dd-wrt from build 14929 to build 21061 on an E3000

April 26th, 2013

A day off. What to do? Upgrade something ofcourse. This time it was my trustworthy E3000 router that I have had for one and a half year.

Things have been progressing in the dd-wrt camp, and they have switched from the e2k-e3k format to the new nv60 build format.

Essentially flashing the E3000 with a custom build goes something like this:

  • Flash a trailed build built especially for your device. Do not flash with a build, that does not have your device name it it!
  • Flash the system with an nv60 build

Then there are some cutover points. Roughly speaking build 18000 marks the beginning of the nv60 builds. So you can not flash a post 18000 nv60 build on a router running a pre 18000 e2k-e3k build, which was what I had. So first a trailed mini-build

dd-wrt.v24-21061_NEWD-2_K2.6_mini-e3000.bin

to let me come to 21061. And then an nv60 version of the same build (though with more features)

dd-wrt.v24-21061_NEWD-2_K2.6_std_usb_nas-nv60k.bin

Time used on figuring this out: 30 minutes.
Time used on flashing: 3 minutes.

Restoring a wordpress site by scraping/crawling google

January 13th, 2013

I love challenges, but once in a while the tend to be way tooo big! During my christmasholidays I accidently wiped my home server. I wanted to do some LVM stuff online, remotely, without console access, through the ESXi console. … and really thought that nothing could go wrong ;-) . First assumption being wrong.

To make a long history short. I shot myself in the foot and was without a server for a 3-4 days. When I got home again, I thought a simple reboot and some LVM magic would make everything all right. Second assumption being wrong.

So in the very end I had to reinstall my server from scratch. Luckily I backup my stuff using and so should you! It will save your butt some time!

It turned out that, for some bizaro reason, my database had not been dumped to csv files. So in the end I came to these conclusions:

  • I lost my database.
  • I thus lost my wordpress blog.

:-(

But loving challenges I refused to let that be the end. I thought about using archive.org, but they did not really have a new crawl of my site.

I decided to crawl google! Not as easy as it might sound for a couple of reasons:

  • Google does not like being crawled …. at all. If googles infinite number of computers discover that you are crawling them, then your IP will be blocked from seeing their cached content.
  • When you enter keywords into google you normally get thousans of links to follow. I needed one. The correct one! The one that was a cached version of my site.

So I fired up my editor and utilized the great WWW::Mechanize. I ended up with this script, which do all the hard work of scraping google. It will take some time to complete — hours and days even! It will get there though. If you try to speed things up it will take longer as you will be blocked by google when they detect you are scraping them. Be warned. Been there. Tried that. Got blocked.

Having retrieved all of my old site through google I had to parse these pages and import them into wordpress. So again I fired up my editor and wrote this little script. For this to work, you have to have

    • a clean wordpress installation with a hello world post
    • XMLRPC writing enabled in WordPress, as the script uses WordPress::XMLRPC.
    • the following in wp-config.php
      define( ‘AUTOSAVE_INTERVAL’,    3600 );     // autosave 1x per hour
      define( ‘WP_POST_REVISIONS’,    false );    // no revisions
      define( ‘DISABLE_WP_CRON’,      true );
      define( ‘EMPTY_TRASH_DAYS’,     7 );        // one week

So in the end what did I loose and what did I learn? I lost my comments on my site. Or more preciesely: I have them,but I will postpone putting them back in until I get the time to fool around with coding again. And I learnt a lot about tripplechecking my backup for all their pieces before doing storage related work remotely without a proper console!

LUNZ and HP-UX 11.31

November 28th, 2012

LUNZ is a placeholder. It is as simple as that. In HP-UX 11.31, ioscan runs without human intervention. Thus you can end up in a situation where your server can see the storage cabinet, but no luns are presented to the server … yet. And thus you get LUNZ. The same applies for 11.23 and below, but it is unlikely that you scan for devices before your storage admin comes along.

So back on track. You then end up with

disk 3 0/0/0/5/0/0/0.101.140.255.0.0.0 sdisk NO_HW DEVICE DGC LUNZ
/dev/dsk/c26t0d0 /dev/rdsk/c26t0d0
disk 4 0/0/0/5/0/0/0.101.156.255.0.0.0 sdisk NO_HW DEVICE DGC LUNZ
/dev/dsk/c27t0d0 /dev/rdsk/c27t0d0

And no matter how many times you do ioscan -fn, you get no devices. Before you go yelling at your storage admin, then try this

sudo ioscan -fnkC disk | grep LUNZ
disk 3 0/0/0/5/0/0/0.101.140.255.0.0.0 sdisk NO_HW DEVICE DGC LUNZ
disk 4 0/0/0/5/0/0/0.101.156.255.0.0.0 sdisk NO_HW DEVICE DGC LUNZ
disk 7 0/0/0/5/0/0/1.201.140.255.0.0.0 sdisk NO_HW DEVICE DGC LUNZ

sudo rmsf -H 0/0/0/5/0/0/0.101.140.255.0.0.0
sudo rmsf -H 0/0/0/5/0/0/0.101.156.255.0.0.0
sudo rmsf -H 0/0/0/5/0/0/1.201.140.255.0.0.0
sudo rmsf -H 0/0/0/5/0/0/1.201.156.255.0.0.0

Check

sudo ioscan -fnkC disk | grep LUNZ | wc -l
0

Try to get them onboard

sudo ioscan -fn
sudo insf
sudo ioscan -fnkC disk

Check

sudo ioscan -fnkC disk | grep DGC | wc
0 0 0

Still not there?! Odd? Not really. On HP-UX 11.31, you also have the new agile device. This is blocking the access.

sudo ioscan -fnNkC disk |grep LUNZ
disk 5 64000/0xfa00/0×5 esdisk NO_HW DEVICE DGC LUNZ

Run

sudo rmsf -H 64000/0xfa00/0×5

Now run

sudo ioscan -fnC disk
sudo insf

Check. Lo and behold. They are there now.

sudo ioscan -fnkC disk | grep DGC | wc
24 204 2244

Installing OS-X on ESXi 5.0.0, 469512 running on an AMD Fusion APU

August 13th, 2012

I wanted to run OS-X at home, preferrably on my AMD Fusion based ESXi 5.0.0, 469512 host. If you search the net for that combination you will find a lot of posts about people having issues and not many about people having a great success. Digging into this it turned out to be relatively simple to do.

  1. Obtain OS-X Snow leopard ISO image
  2. Obtain Donks OS-X unlocker for vmware. I used unlock-all-v110.zip
  3. Backup you ESXi host and VMs before doing anything! I am not liable in any way for any issues you encounter! It worked for me. Your millage may vary and that is actually your problem ;-)
  4. Patch ESXi with Donks unlocker by unzipping the zip file on the ESXi host and running esxi/install.sh. Make sure to read the readme file beforehand and make sure that all the prereqs are in place before you start!
  5. Reboot your ESXi host and hope for the best.
  6. After a successful reboot of ESXi with Donks patches, create a new OS-X based VM. 64-bit, 4GB memory, 1 processor (and one processor only, otherwise you will get panics during installation), LSI Logic Parallel SCSI, E1000 network
  7. Do NOT power up the VM.
  8. Enter the ESXi cli.
  9. Browse to the location of the VM on the ESXi datastore
  10. type vi *.vmx <enter>
  11. remove all references to CPUID
  12. insert the following CPUID information (this will make ESXi present the VM as a core2duo based machine to the guest allowing OS-X to boot on the hardware)
    hostCPUID.0 = "0000000668747541444d416369746e65"
    hostCPUID.1 = "00500f100002080000802209178bfbff"
    hostCPUID.80000001 = "00500f1000001242000035ff2fd3fbff"
    guestCPUID.0 = "00000006756e65476c65746e49656e69"
    guestCPUID.1 = "000006f10000080080802209078bfbff"
    guestCPUID.80000001 = "00500f1000001242000003e92bd3fbff"
    userCPUID.0 = "0000000668747541444d416369746e65"
    userCPUID.1 = "00500f100002080080802209078bfbff"
    userCPUID.80000001 = "00500f1000001242000003e92bd3fbff"
    cpuid.0.ebx="0111:0101:0110:1110:0110:0101:0100:0111"
    cpuid.0.edx="0100:1001:0110:0101:0110:1110:0110:1001"
    cpuid.0.ecx="0110:1100:0110:0101:0111:0100:0110:1110"
    cpuid.1.eax="0000:0000:0000:0000:0000:0110:1111:0001"
  13. Save the vmx file
  14. Attach the Snow Leopard ISO to the VM and boot it.
  15. Perform a normal OS-X installation.

Nothing much actually. The final solution

And seen from vnc

 

 

Quite simple …. as promised :-)

Renault Megane III hatchback

August 8th, 2012

For the summer vacation I rented anin(formerly københavns delebiler). It is a 6 speed manual transmission car. It is nothing out of the ordinary. It has the features that you would expect from a car of this type, but nothing more. The 1.5 Diesel Engine is sufficient for the danish speedlimits, which is just another way of saying that it is actually quite boring to drive. I’ll give it 3 out of 5 stars.

Renault Megane III

Music by Mikael Fyrek

August 2nd, 2012

As of late I have been listening quite a lot to Mikael Fyreks music. Reminds me a lot of the time when I was a kid doing demoscene productions. He is a musical master in the same class as all my musical heroes from back then. Do yourself a favor and listen to a true musical master; you will not regret it!

Version 2 of small perl mechanize script to send sms from danish telco provider Bibob

July 26th, 2012

A year ago I wrote a small perl Mechanize script to send sms from the command line (very useful for scripts) utilizing the web-sms service you get as a Bibob customer.

Now a year later I actually found some use for it, but it didn’t work anymore due to the fact that Bibob had changed their website since then. And not just the graphics and layout, but the whole shebang.

I have made some very small changes to the perl script to make it work again and I appriciate the versatility of perl and that the Bibob webmasters obviously thought a great deal about the upgrade.

The new code can be downloaded here, hbut is also included verbatim in this post

#!/usr/bin/perl -w

##############################################################################
#
# File:         bibob_sms.pl
# Type:         bot
# Description:  Send an SMS using bibob websms and perl mechanize
# Language:     Perl
# Version:      2.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:
#               2.0 – 2011.07.26 – New version due to total bibob.dk relayout
#               1.0 – 2011.07.28 – Intial version
#
# (C) 2011,2012 Thomas S. Iversen (zensonic@zensonic.dk)
#
##############################################################################

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

# Variables controlling bot behaviour

my $sms_url=‘https://www.bibob.dk/min-konto/web-sms’;
my $login_url=‘https://www.bibob.dk/’;

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->get($login_url);
$mech->success or die "Can’t get the login page";

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

# Get sms page
$mech->get($sms_url);
$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;

Setting up an TP-Link TD-8616 ADSL modem with TDC

July 8th, 2012

I got tired of my zyxel P660R-D1 due to it rebooting once in while. I went looking for an replacement ADSL to ethernet box. The Zyxel is a full blown router, but why use that when I already have an Linksys E3000? Looking around I found the P-Link TD-8616 ADSL modem, which sells for around $25.

To set it up was very very very easy:

  • Plug it in.
  • Configure my laptop with at static ip of 192.168.1.2.
  • Connecting the laptop and the TD-8616 back to back.
  • Browsing to 192.168.1.1
  • Altering the VCI/VPI to 0/101 to match TDC
  • Browsing the web interface of my E3000
  • Using the mac address clone feature, giving the E3000 the mac of the old zyxel router
  • Renew the lease of the E3000.
  • All done.

I’ll reserve my final judgement until I have seen the stability, but the setup was easy enough and until know it performs quite nicely with 40% of the power that the zyxel needed.

 

A trip to Häckeberga Castle in Sweden

May 6th, 2012

Just returned from a trip to Häckeberga Castle in Sweden with my wife I just have to write that this is one of the best weekends in a long time. The castle is beautifully located on one of the 7 islands in the Häckebergalake.The castle nicely presents itself

Häckebergas castle

What sets the experience apart from your normal swedish castle is these things:

  • The nature surrounding the castle is simply astonishing. Almost no man made sound can be heard and it is very easy to take a tour into one of the forrests around the castle without hearing or meeting anybody but yourself and your spouse.
  • The food served at the castle is of gourmet class. It is not your average continental steak or ala carte menu. You get a 4-dish gourmet menu with 2-3 appetizers in between. It is complemented with a 4 glass wine menu that enhances the experience believe it or not.
  • The staff is professional yet very relaxed and friendly
  • There is only room for very few guests due to the limited amount of rooms, so it never gets crowded (the downside being that you have to book months in advance ;-)

I had a splendid weekend there. Real quality time with my beautiful wife. Will not be the last time we visit that place!

Changing boot order in BIOS on IBM xSeries servers without RSAII (using ASU)

April 25th, 2012

Today I faced challenge where I had to reinstall some IBM xSeries servers in a datacenter far far away using PXE boot. These servers did not have an RSA/RSAII card, but that is really not a problem using PXE. I prepared the kickstart on the first of the servers and did some reinstalls to get it right. And then I issued an ipmi command to reboot the rest of the servers. … and then nothing happened. Well the rest of the servers rebooted back into the old OS instance. It was ofcourse an issue with the boot order in the BIOS on the servers.

Now what? Either drive to the DC or call someone there to get it fixed. …. or use the IBM ASU tool to change the BIOS settings from within an OS instance. It is quite a useful tool

Without further ado

[root@biomd1 ~]# /opt/ibm/toolscenter/asu/asu show | grep Boot
CMOS_AlternateBootDevice4=Hard Disk 0
CMOS_AlternateBootDevice3=CD ROM
CMOS_AlternateBootDevice2=Diskette Drive 0
CMOS_AlternateBootDevice1=Network
CMOS_PrimaryBootDevice4=Network
CMOS_PrimaryBootDevice3=Hard Disk 0
CMOS_PrimaryBootDevice2=Diskette Drive 0
CMOS_PrimaryBootDevice1=CD ROM
CMOS_PostBootFailRequired=Enabled
CMOS_PCIBootPriority=Planar SAS
CMOS_RemoteConsoleBootEnable=Disabled

[root@biomd1 ~]# /opt/ibm/toolscenter/asu/asu set CMOS_PrimaryBootDevice4 “Hard Disk 0″
IBM Advanced Settings Utility version 3.60.69K
Licensed Materials – Property of IBM
(C) Copyright IBM Corp. 2007-2010 All Rights Reserved
CMOS_PrimaryBootDevice4=Hard Disk 0
[root@biomd1 ~]# /opt/ibm/toolscenter/asu/asu set CMOS_PrimaryBootDevice3 “Network”
IBM Advanced Settings Utility version 3.60.69K
Licensed Materials – Property of IBM
(C) Copyright IBM Corp. 2007-2010 All Rights Reserved
CMOS_PrimaryBootDevice3=Network

[root@biomd1 ~]# /opt/ibm/toolscenter/asu/asu show | grep Boot
CMOS_AlternateBootDevice4=Hard Disk 0
CMOS_AlternateBootDevice3=CD ROM
CMOS_AlternateBootDevice2=Diskette Drive 0
CMOS_AlternateBootDevice1=Network
CMOS_PrimaryBootDevice4=Hard Disk 0
CMOS_PrimaryBootDevice3=Network
CMOS_PrimaryBootDevice2=Diskette Drive 0
CMOS_PrimaryBootDevice1=CD ROM
CMOS_PostBootFailRequired=Enabled
CMOS_PCIBootPriority=Planar SAS
CMOS_RemoteConsoleBootEnable=Disabled

Nifty, right?