Tuesday, 25 September 2007

FSG3, SMF, Visual Verification Headache

I am running the Simple Machines Forum software (php) on an Freecom FSG3 Network Storage Box, and have been banging my head on the table because I cannot get the visual verification function to work - all I see is the randomised dots, and no letters in the middle.

The server is Apache, so I checked that it could do graphics - I ran httpd -l to get a list of all of the included modules, and didn’t see the ‘gd’ module, which is needed for the graphics - I though that was it, and wasted a long time trying to cross-compile Apache (that’s a different story). Eventually I found that if you create a php file as follows:

And access if from your webserver, it tells you everything you need to know, including the fact that the gd modules are, after all, included.

Configure Command: ‘./configure’ ‘–prefix=’ ‘–target=arm-linux’ ‘–host=arm-linux’ ‘–build=i686-pc-linux-gnu’ ‘–with-mysql’ ‘–with-apxs=../apache_1.3.33/apxs’ ‘–with-config-file-path=/usr/local/apache/conf’ ‘–enable-mbstring’ ‘–with-gd’ ‘–with-png-dir=/lib’ ‘–with-jpeg-dir=/lib’ ‘–with-zlib’

Knowing that it was after all supported, I started to delve into the php code for the server, looking at each function in turn to check if it was supported. The only thing that was not supported was the true-type-font functions, but this didn’t matter as the code checked for it.

Eventually, I looked at the manpage for the imageloadfont, and saw the following:

“The font file format is currently binary and architecture dependent. This means you should generate the font files on the same type of CPU as the machine you are running PHP on.”

It all became clear. The FSG3 is a big-endian system, whereas (I presume) the SMF software was tested on a little-endian system.

The simple act of replacing the font files with big-endian versions enabled the visual verification system to work.

If you just see random dots and no text in the SMF visual verification image, and your system is big-endian, simply replace the gdf font files with big-endian versions.

Saturday, 15 September 2007

My Windows Vista Machine cannot access my NAS Shares

After falling over in the house, and pushing my crutches through the screen of my laptop, I’ve replaced it with another one - this is running Vista.

The very first problem I encountered was that I couldn’t see any of the network shares that I used to see on my old XP machine. After a lot of searching, it seems that Microsoft have beefed up the network file sharing security, and made Vista incompatible with old file sharing system security features by default.

There is a registry hack to re-enable this old mode (Using regedit to set the LMcompatibilityLevel to 1).

I have since found that my PC is very slow copying files on the network - to copy 400 files, totalling just 1Mb from a zipfile onto a network drive took 50 (yes Five Zero) minutes.

The real solution is to upgrade the server software at the other end to be compatible. I’m running samba on a Freecom Network Storage Box (FSG3), and upgrading to the latest firmware, which includes samba version 3, has allowed these shares to be seen again.

This may not be the end - at the moment, the machine seems to be running OK.

There is a hotfix available from Microsoft (Knowledge Base Article 931770 - The copy process may stop responding when you try to copy files from a server on a network to a Windows Vista-based computer), but I’ve not applied it at the moment….

Sunday, 9 September 2007

Running a DNS Server on an FSG3 Network Storage Box

I have a NAS box in the house, which is used to store my music and video. In the house, also, I have an internet radio / media player, and a networked satellite receiver, and of course, a webserver which recognises several different names (virtual hosts) to direct the access to different directories.

I want to be able to refer to these devices by name, rather than IP address, but I don’t want to go around hacking hosts files on every machine - the solution is to use a named server, and point all the machines in the house towards it. This has the advantage that I can override the internet recognised domain (e.g. trumpton.org.uk), to divert the address locally.

I have just upgraded my FSG3 to the latest kernel (2.6).

Firstly, I needed the name server (in a package called bind), and a dependant package (openssl). I downloaded bind_9.3.4-1_armeb.ipk and openssl_0.9.7m-2_armeb.ipk, and installed them on the FSG3 with the ipkg command.

Next, I created the name server files. Rather than storing them in the default /opt directory, I have decided to install them into /home/named - this means that the files will be retained following any firmware upgrade (on this particular device).

Note that in these files, a semicolon indicates the start of a comment, not the end of a line. If there are no comments, no semicolons are needed.

The first file is named.conf:

options {
pid-file “/home/named/named.pid”;
directory “/home/named”;
port 53;
};

// Internet Root Servers
zone “.” {
type hint;
file “root.zone”;
};

// Local Host Loopback
zone “0.0.127.in-addr.arpa” {
type master;
file “db.local”;
};

// Local network Addresses
zone “local” {
type master;
file “local.network”;
};

// Local netork Reverse Addresses
zone “14.168.192.in-addr.arpa” {
type master;
file “rev.local.network”;
};

// trumpton.org.uk
zone “trumpton.org.uk” {
type master;
file “trumpton.org.uk”;
};

The file contains pointers to all of the named configuration files - the options section identifies where files reside, the zone sections identify the forward (i.e. loking up www.trumpton.org.uk) and the reverse (i.e. looking up 192.168.14.1) files. The special zone file ‘.’ has pointers to other servers on the internet for the various naming authorities (RIPE, ARIN etc..).

The ’local’network’ file contains the names for the local (internal) network:

@ IN SOA webserver.local. junkmail.trumpton.org.uk. (
2006012103; serial
28800; refresh, seconds
7200; retry, seconds
604800; expire, seconds
86400 ); minimum, seconds;
NS web.local.;
;
MX 10 web.local.;
;
local. A 192.168.14.1
internet A 192.168.14.1
cam 192.168.14.100
desktop A 192.168.14.101
satbox A 192.168.14.102
nasmedia A 192.168.14.103
netradio A 192.168.14.104

web A 192.168.14.105

The part at the top of the file is used to put a timestamp on the file, and tell other servers on a network how often they should be updated. The list following, gives the names of all of the machines, and their corresponding IP addresses.

Of course, if you have an IP address, and want to know the machine name, you need reverse lookups - that is what the rev.local.network is for:

@ IN SOA webserver.local. junkmail.trumpton.org.uk. (
2006012103; serial
28800; refresh, seconds
7200; retry, seconds
604800; expire, seconds
86400 ); minimum, seconds;
NS web.local.;
;

1 PTR internet.local.
100 PTR cam.local.
101 PTR desktop.local.
102 PTR satbox.local.
103 PTR nasmedia.local.
104 PTR netradio.local.
105 PTR web.local.

The file ‘trumpton.org.uk’ contains the name lookups. Note, however, the MX entries here - these point to my service provider’s mail exchange, as in my case, all mail goes through their servers, and I do not run my own mail server. If I did, these would simply point to ‘trumpton.org.uk’. Note the ‘.’ at the end of a name - if the dot exists, it indicates that this is the end of the name, and if it is missing, the domain specified in the named.conf file for this particular file is appended.

@ IN SOA webserver.local. junkmail.trumpton.org.uk. (
2006012103 ; serial
28800 ; refresh, seconds
7200 ; retry, seconds
604800 ; expire, seconds
86400 ; minimum, seconds
) ;

NS web.local.;
;
MX 10 easymx2.easily.co.uk.;
MX 10 rhea.easily.co.uk.;
;
trumpton.org.uk. A 192.168.14.105
www A 192.168.14.105

Once the files are in place, it’s just a matter of editing the S09named script that was installed in the ipkg to refer to the correct directories, copying it to the /etc/rc directory, and starting it with /etc/rc/S09named start.

Im my case, the ‘pidof’ program was missing. Rather than installin the bundle that includes pidof, I created /bin/pidof

PSLIST=”`ps -ef | grep $1 | grep -v pidof | grep -v grep | cut -c1-5`”
echo “$PSLIST”

Now, the computers on the network need to be pointed at this DNS, rather than the firewall’s one. Usually, it is possible to add at least two entries, mine are:

nameserver 192.168.14.1
nameserver 192.168.14.5

Saturday, 8 September 2007

Paragliding - What Not to do !

I’ve recently been on holiday to Spain, for a week’s paragliding.

My first day was excellent, with a nice 3 hours flight, getting to a height of 2.5km above ground level. A great triangular flight, covering 35km, and getting back to the top of the mountain.

The next day, however, things weren’t quite so great. We used a take-off site I had never visited before - I am always apprehesive on take-off, and a new site only increases the stress. I set up on the hill, at which time there was nill wind. The logical thing to do was to wait for a thermal to come through.

Well, the thermal came through, and I picked up my paraglider - it was slightly off to one side, so I corrected with the brake lines and turned round to face the direction I’d be running. The paraglider then dipped off slightly to the right, so I adjusted with the brake as I began to run. At this point, I’m not exactly sure what happened - either I stumbled, or I was picked up and dumped by the back end of the thermal - it is likely that as this happened, I put on a lot of left brake, as I flew to the left across take-off, crashing left-foot first into the mountain.

I rolled over onto my back, and my left foot wasn’t quite pointing the direction it should have been. Now I was surprised that this did not hurt as much as I thought it would (I had actually broken my ankle and fibula, and it seemed to hurt less than when I broke my toe a few years ago).

After about 20 minutes, the ambulance, police and local doctor appeared on the side of the hill. Fortunately, I’ve been learning Spanish at my local college, and could manage some rudimentary communication. The doctor gave me the once over, worried that I had damaged my spine - I explained that the crash was relatively slow speed, and that my paraglider harness had protected my back.

It took 6 people to carry me down the 20 yards to the ambulance. After another check by the doctor, I was bundled off to the hospital (1 hour away in Ávila).

Now I had it in the back of my mind that there was a maximum amount of morphine you could take, and I thought that I’d need everything that I could have to get me through the night. As the pain was not excruciating, I refused painkillers. The time I really wished I had had some morphine was when they took my tight boot off (this hurt quite a bit) - anyway, at least my foot was pointing in the right direction afterwards.

The surgeon explained that I’d need an operation to fix the bones in the ankle. We had a conversation of risks of travelling, waiting and DVT, and I chose to have the operation in Spain, rather than wait until I got home. 5 hours later, I was in surgery.

They gave me an epidural, which was an interesting experience, as you were completely with it, and could hear everything that was going on (they didn’t let you watch). The incision felt strange - it felt like someone drawing on your foot with a biro - that was the only sensation I had. I heard some drilling, and the staple gun (used to close the wound), and the 20 minute operation was over, and I went on to spend a couple of hours under observation, until the anasthetic wore off.

I then spent a couple of days on the ward - and by this, I mean in room with one other patient. Spain is very different from the UK in the way hospitals work - firstly, they seem to work ! - and secondly, it is normal for the family to look after the patient in the hospital, washing, feeding, fetching water etc… There is no ‘visiting time’ as such, in fact, it is the opposite “Families must vacate for 1 hour a day, when the doctors are doing their rounds”. It is not uncommon for a family to stay with the patient throughout the night.

My room-mate had a head injury, after a light aircraft accident, and was suffering from double vision. His wife never left the room (unless the doctors came round, or I needed a pee).

I guess one of the worst things was the heparin injections that were given in my stomach fat (thank heavens I have quite a bit of that!). After 2 nights, I was discharged, went back to Steve and Puri’s, and spent the rest of the week chilling. The local nurse cleaned and re-dressed the operation wound, and taught me how to do my own injections.

My insurance company made arrangements to fly me back business class, and then taxi me to my door. The following Monday, I went to the local hospital, where the surgeon was pissed off that I had the audacity to have my operation done in Spain. I had the half-cast replaced with a full-cast, and ambled home by taxi for 5 weeks of lying with my foot elevated.

After three weeks, the cast had become so loose, the leg was supporting the cast, rather than the cast supporting the leg. I returned to the hospital, where it was replaced. I’ve just over a week to go before the cast comes off, and it is getting loose again …..

It’s now a week or so later, and I’ve got rid of the cast. My left calf muscle is almost non-existant (wasted to less than half its original size in the 6 weeks of rest).

I’ve got some excercises to do, and a visit to the phisiotherapist, but within a couple of weeks, I should be able to get rid of the crutches, walk and drive again.

For now, I’ve to keep the weight off it and gently excercise it, but it will be a while before I am flying again.