Friday, September 28, 2007

Apache 2.2 PAM troubles

This time i had to configure an apache to use pam to connect through winbind to an Active Directory.

Basically i was trying to port an Apache 2.0 vhost to Apache 2.2 since we are switching servers.

It took me some time until we found a bugreport indicating why it is not working anymore..

AuthBasicAuthorative Off


http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=394097

Monday, September 24, 2007

SATA Problems Part II

Last weekend i got the replacement disk for my broken sata disk and reinstalled it. I found a manual quite quick but had some serious problems since i either got one of the two following errors while trying to rebuild the raid 1 array:
ata1: Timeout
ata1: DMA Timeout

Although i had some ideas what could be wrong my last solution was to change the SATA Cable and that was all it needed...


Rebuild Array

To rebuild an array with a clean disk i found this guide useful:
http://www200.pair.com/mecham/raid/raid1-degraded-etch.html

Although it was written for IDE Disks you can use it also for SATA..

Here the needed parts extracted:
We start by copying the partition structure from /dev/hda to /dev/hdc. We do this for what should now be an obvious reason: the secondary drive is empty, but it needs to have the same structure as the primary drive. If the disk was first cleaned, and is large enough, you should have no errors (but you may still have to --force it):

sfdisk -d /dev/hda | sfdisk /dev/hdc

We make sure the superblocks are zeroed out on the new drive (as always, be careful you do this to the correct drive). Edit as needed:

mdadm --zero-superblock /dev/hdc1
mdadm --zero-superblock /dev/hdc5
mdadm --zero-superblock /dev/hdc6


Now we add our three hdc partitions to the corresponding md's.
Understand what you are doing here before you do it, edit as needed:


mdadm --add /dev/md0 /dev/hdc1
mdadm --add /dev/md1 /dev/hdc5
mdadm --add /dev/md2 /dev/hdc6


Watch them sync:
watch -n 6 cat /proc/mdstat

Once the recovery is complete (and not until then), create a new boot records on both drives:
grub

From the grub> prompt (edit partition number if needed):
root (hd0,0)
setup (hd0)
root (hd1,0)
setup (hd1)
quit

PHP5 DomDocument schemaValidation problems

First i have to tell about a SOAP Connection to a webservice. I don't know if the developers ever thought about SOAP more than just a quick thought how can we transfer data, since from my end it looks as if they have absolute no idea what they were doing.

We have a Service that holds a bunch of personal data which we have to transfer to the webservice of an higher instance. Now you would think they provide a SOAP Connection where there are a lot of functions to send them the data for every person.. but no.. there are only two functions:
  • One which wants a XML String where all personal data has been collected together and
  • a second one which wants the same string as zip
So you see the whole point of the SOAP connection is just to send them the already prepared XML Files and then they work with the collected data somehow internal.

Fortunately they provided a xsd file so i was able to add additional validation to ensure the data is valid.

Now i created the XML Files using php5 DomDocument. The library makes it really easy to create Elements and it also holds a schemaValidation functionality.

I don't want to get into to much detail but when i said that they want all personal data of all people collected in one file you will notice that it would not be a good idea creating first all users in one file and then check if that file is ok... or perhaps i am just the only paranoid here, but i wanted to know exactly which person is making troubles.

So my code first creates the xml data for each person separately (although cached) and then i add the xml data to an prepared xml so i can validate against the schema.

The Problem
Now we get to the point. My Function first creates a Validation XML which helds all the markup and then adds the XML Data of the person using DomDocument->importNode and then appendChild at the correct position.

Unfortunately the schemaValidation finds errors where there are not really one, or so i thought. I got Error Messages which i was unable to see anything wrong. But i found a workaround.
Using DomDocument->loadXML(DomDocument->saveXML()) just before the validation i was able to sort of "normalize" the DomDocument and the schemaValidation worked.

I am not sure if the schemaValidation was just not designed for such a work or i did misjudge and used it completely wrong. But since there is not much documentation at php.net i had no other way.

Monday, September 10, 2007

SATA problems

I had some serious problems with my Server concerning some sata harddisks. Unfortunately not only my raid 0 system with a one year old Samsung SpinPoint was broken (i sent the disk to samsung) also another disk failed with serious failures and locked my system.

So i bought a new one and wanted to transfer the data from the broken one as good as possible to the new one before it completely fails. But i was stopped by my own ignorance.. the new 500GB disk was not working with the sata Controller onboard.. so when i went back to change it into a smaller disk (since i thought there are some size restriction in effect which stopps my controller to get it working with the disk) they just told me to jumper the disk to sata I and try again..

Not only is this jumper setting not explained in the small tiny manual which is normally shipped with the disks, i also called the support Hotline preview to this incident to confirm my theory (with the size) and was a little angry they have not told me this on the phone before.. Not that i have much to do, i am just a workaholic with a family and a little girl....

Never less i used the jumper setting they told me and tried again.. first the controller had troubles recognizing the disk but after another restart it was finally there.
Good, now all i have to do is partioning the disk and then create a filesystem.. but then the same errors appeared on the disk as on the old one.. NOT AGAIN...

Another mistake of me was to define the problem with the Controller... ok it's a via chipset and it has some troubles with maxtor 500GB disks and i am not very found of it and maybe it is also a reason for the problems. Either way i just bought a pci sata Controller and installed it.. and it found both sata disks (not my raid array, that is on another sata controller.... ok now that sounds more complicated than it really is.) and after booting linux i tried to mount both disks.

The new one did not have any problems, i was able to recreate the partition and installed a filesystem, but the old one still got some errors by mounting readonly:
sd 5:0:0:0: SCSI error: return code = 0x8000002
sdc: Current: sense key: Aborted Command
Additional sense: Scsi parity error
end_request: I/O error, dev sdc, sector 206307443
lost page write due to I/O error on sdc1
ATA: abnormal status 0xFF on port 0xFFFFC2000004439C
ata6: status=0xff { Busy }

Luckily i found a site which proposed to change the sata cable. Since i changed it to the one shipped with the controller the disk run as smooth as ever.

Now i could be pretty angry for searching this little fellow for about two weeks but i am just relieved that the data on the disk are ok. Naturally the first thing i did was to backup the complete disk to the new one before laying my hand into the fire ;-)

Thursday, September 06, 2007

vserver with different Architecture

My system is a little weird since i did a poor job installing linux: i installed a 32 bit system on a 64bit architecture and then just changed the kernel.

Now installing a new vserver with debootstrap it automatically uses the source system which in my case is 32bit and therefore i got the errors:
kernel: IA32 syscall 311 from ...

It finally annoyed me enough, so i asked a friend and with his help i finally managed to change the architecture when installing a new vserver:
newvserver --hostname name --domain domain --ip ip --dist testing --interface eth0 --arch amd64 --context context

Not only i got rid of the warnings, i experienced a slight boost in performance. But maybe this is because of the source of the error. Now i am installing all vservers again in 64bit and move forward.