Hazard's stuff

Karcher RoboCleaner in da house :)

— Posted by hazard @ 08-08-17 16:44
At last I received my Karcher RC 3000 RoboCleaner. My carpet already looks more vibrant than ever :) The thing goes around the apartment collecting the dust, finds the base, dumps the dust into a bag in the base, and then starts again from the beginning... until you stop it. Perfect. As long as it can find the base ;)



MAD Video Music Awards 2008

— Posted by hazard @ 08-07-13 04:34
I caught a glimpse of MAD Video Music Awards 2008 and I must say I was impressed. Greeks managed to stage a world-class show, with a vivid scene setup and excellent camera work.

It was the first time I saw a live production of such quality from Greece. Eurovision 2006 doesn't count as it was supported by European Broadcasting Union.



HP F4180 printer/scanner/copier

— Posted by hazard @ 08-06-22 08:09
I recently purchased HP F4180 printer/scanner/copier for 50 EUR. It is amazing how inexpensive these things are nowadays.

As regards to Linux compatibility, I must say that it is very good and everything worked from the first attempt. Simply download HPLIP and all configuration is done automatically (at least on FC8). Printing works using CUPS, scanning using xsane. Thumbs up to HP!

New era in Cyprus telecoms

— Posted by hazard @ 08-04-18 11:39
PrimeTel is building its own submarine fiber cable landing station and will bring one of the biggest international submarine cable systems to Cyprus. If you think that your connection is slow compared to what people in rest of the Europe get, wait until 2009 :)

Reliance Globalcom to land undersea NGN on PrimeTel station

Knockin' On The Heavens Door

— Posted by hazard @ 08-04-06 12:05
If I'm asked about my favourite movie, my current answer would be "Knocking' On The Heaven's Door". Great script with excellent combination of drama, humour and action. Plus a soundtrack which perfectly fits the picture. 10/10.

Did you know ...

— Posted by hazard @ 08-04-01 04:14



IBM-Lenovo X61

— Posted by hazard @ 08-03-15 07:05
My colleague received an IBM-Lenovo X61 laptop, and we found that built-in Intel 4965 wireless is very slow when connected to 802.11b access point. Same problem persisted both with Fedora Core 8 and Ubuntu (iwlwifi driver).

Usual tweaking of ACPI and APIC parameters didn't help. Googling around showed a lot of people suffering from the same problem with Intel 4965 wireless cards. Eventually I resolved the problem by removing iwlwifi driver files from /lib/modules, and installing ndiswrapper (allows to use Windows network drivers) + Intel 4965 driver for Windows XP.

JulesVerne AutoTransfer Vehicle is in space

— Posted by hazard @ 08-03-10 10:19
Europe's space cargo carrier, ATV, after many years of work is finally in orbit. It has a problem with some of the engines, but that shouldn't stop it from reaching International Space Station.

One thing I don't like about Russian Space Agency press releases is that everything has "unique characteristics" and is "superior than western alternatives". Well, it seems European Space Agency suffers from the same problem as well. From ESA's article about successful ATV launch:

"The ATV is also the very first spacecraft in the world designed to conduct automated docking in full compliance with the very tight safety constraints imposed by human spaceflight operations. It features high accuracy navigation systems and a flight software far more complex than that used on Ariane 5."

Well, Russia has been flying Progress spacecraft in fully automatic mode since 1970s. And ESA perfectly knows that. They even have a video of Progress docking on their website. :)

The Vista Experience

— Posted by hazard @ 08-03-10 05:02
My old desktop machine had died, so I decided to buy a new laptop to replace it. Even though most of the time it will be sitting in the same place, laptops nowadays are cheap and mobility is a nice option to have.

So, I got an HP Compaq 6710b. Along the way I purchased upgrade to 2 GB RAM and 320 GB hard drive. The laptop by default comes with Vista, which I wanted to keep, just in case I need to run some Windows stuff which wouldn't work in Linux. At first I start the laptop with its factory 160 GB HDD: HP's Vista installer loads from a special partition and in less than two hours I have a running Vista (enough to install Fedora two times). Then I proceed to make recovery DVD, so that I can install Vista on the 320 GB disk. Vista needs only two DVDs and another hour to do that; excellent. I replaced the hard drive and started the whole Vista installation process again from the DVD.

Of course, HP's Vista installer takes over entire disk space without asking, I'm sure only to make the experience more user-friendly for the user (after all, these "Advanced" buttons are way too tricky). The thing is, I want to give only 50 GB to Vista. Anyway, Vista gets installed, and I'm logged in. I start the Disk Management tool - actually, I already got irritated at this point because Microsoft thought it is a good idea to break old ways of using Windows - and whoala, it tells me that I can shrink my disk to 160 GB. To those of you who don't know, actual space used by Vista files is less than 20 GB.

The tool also vaguely mentions that I can get rid of shadow copies and paging file in order to increase available space. Of course it is useless to use built-in Help to find how do I actually do that, but thanks to Microsoft's competitor Google, this information was retrieved and necessary actions were performed. Now, I can shrink my drive by 3-4 GBs more. Fantastic! Just what I dreamed of, to buy 320 GB HDD and leave 155 GB for Vista. Googling around shows that what I got is normal for Windows disk shrinking tool - it frees about 50% of space.

"Screw it!", I think to myself, and proceed to install Fedora 8. As a precaution, I left first partition empty at 60 GB, so that I can try to install Windows again later (of course, I was also understanding that doing standalone Vista/XP install would be painful because it would not have the HP drivers). Anyway, in one hour FC8 is up and running - "nohz=off" was needed to make the Fedora installer work.

However, built-in modem is NOT up and running, as it is one of the softmodems for which Agere has not released drivers. I find a few suggestions on the mailing lists that making a Frankenstein driver by copying .o files from one driver to another might work, but I only get a few OOPS'es as a result and NOT a working modem.

Now, I need the modem, because I have to connect to remote console servers over the phone for troubleshooting of network outages. So, I insert Vista rescue DVD again, hoping that I might have missed an option to install into a specific partition. Nope, not there. And it also overwrote my MBR without asking. How nice.

I look back at my 160 GB drive. What if I shrink that one and then transplant Vista to my 320 GB HDD? In a few minutes my 160 GB is back in the laptop, I run Windows shrinking tool, and whoala, it shrinked it down to a whopping 45 GB. A few minutes more, and 160 GB is in USB enclosure, 320 GB is back inside the laptop, and dd is happily copying first partition from 160 GB drive to 320 GB one. One hour passes; dd has finished, not as quickly as I expected - only 7 MB/s. Anyway, let's try to boot Vista... drums roll (in my head)... Vista's loading bar starts to run around the screen... KABOOM, "winload.exe is missing or corrupted".

Back to Linux, mount the Vista partition. winload.exe is there and MD5 is the same as the original one on the 160 GB HDD. Also I can't find boot.ini anywhere. Hmmm. Time for another visit to Microsoft's competitor Google. Aha - Microsoft is improving at friendly error messages: "winload.exe is missing or corrupted" actually means that disk ID has changed, and just to make it easier for the average Joe to use Vista, Microsoft has started checking that disk ID entered into the bootloader config matches the one on the actual drive. Otherwise it won't boot, even if everything else is in place.

Alright, let's see how we can fix that bootloader config. Another innovation! Finally Microsoft has managed to get rid of that prehistoric way of configuring bootloader using a text boot.ini file! Now we have a shiny new registry-like binary database somewhere else. To edit it, use BCDEDIT.EXE. Cool. My problem is that I don't have a working Vista to run it.

"If the mountain will not come to Mohammed, Mohammed must go to the mountain". Disk ID is written in the MBR. Armed with dd and mcedit in hex mode, I copy the Disk ID from the 160 GB HDD's MBR into 320 GB, then use fdisk to confirm that they match. Reboot, select "Other" in GRUB....

IT WORKS!!!

Looking back, I'm glad at how painless and inspiring my Vista experience was. Such experiences bring more users to Linux.

UPDATE: I later discovered existence of "ntfsresize" tool under Linux, which apparently does much better job at NTFS resizing than Vista's built-in one.

Linux tc multi-level massive hashing

— Posted by hazard @ 08-02-10 09:33
It is little known that Linux tc traffic-shaping framework supports multi-depth filter hashing, allowing to reduce CPU load for installations with a lot of filters. Here is how to configure it.

Say, we have an installation with several thousand hosts in 10.1.C.D and 10.2.C.D ranges. First, we create hash table for 10.1.0.0/16:

tc filter add dev eth3 parent 1:0 prio 1 handle 100: protocol ip u32 divisor 256

tc filter add dev eth3 protocol ip parent 1:0 prio 1 u32 ht 800:: match ip dst 10.1.0.0/16 hashkey mask 0x0000ff00 at 16 link 100:


This instructs the kernel to create hash table 100 (hex!) with 256 buckets. The next line assigns a filter which would make all traffic with destination IP in 10.1.0.0/16 range be looked up in this hash table ("link 100:") using the the third (C) IP address octet ("hashkey mask 0x0000ff00 at 16").

The next command does the same, but for 10.2.0.0/16:

tc filter add dev eth3 parent 1:0 prio 1 handle 101: protocol ip u32 divisor 256

tc filter add dev eth3 protocol ip parent 1:0 prio 1 u32 ht 800:: match ip dst 10.2.0.0/16 hashkey mask 0x0000ff00 at 16 link 101:


Now, we create a hash table for every /24 subnet used inside these /16 ranges. Say, for 10.1.1.0/24:

tc filter add dev eth3 parent 1:0 prio 1 handle 201: protocol ip u32 divisor 256

tc filter add dev eth3 protocol ip parent 1:0 prio 1 u32 ht 100:1: match ip dst 10.1.1.0/24 hashkey mask 0x000000ff at 16 link 201:


First line creates a hash table 201 with 256 buckets. The second line is more complex: "ht 100:1:" means that this filter is to be placed into hash table 100, bucket 1 (hex). So, considering the filter for hash table 100, that means this rule will be evaluate when the third (C) octet of the IP address matches 1, e.g. 10.1.1.X, and then do a further lookup in the hash table 201 ("link 201:"). "hashkey mask 0x000000ff at 16" means that lookup will happen in table 201 using the fourth (D) octet of the IP address, e.g. 10.1.1.1 goes into table 201 bucket 1, 10.1.1.2 into bucket 2, 10.1.1.3 into bucket 3 etc.

We go on with similar configuration for 10.1.2.0/24, 10.2.1.0/24, 10.2.2.0/24, assigning a unique hash table number for each subnet:

# 10.1.2.0/24
tc filter add dev eth3 parent 1:0 prio 1 handle 202: protocol ip u32 divisor 256

tc filter add dev eth3 protocol ip parent 1:0 prio 1 u32 ht 100:2: match ip dst 10.1.2.0/24 hashkey mask 0x000000ff at 16 link 200:
# 10.2.1.0/24
tc filter add dev eth3 parent 1:0 prio 1 handle 203: protocol ip u32 divisor 256

tc filter add dev eth3 protocol ip parent 1:0 prio 1 u32 ht 100:1: match ip dst 10.2.1.0/24 hashkey mask 0x000000ff at 16 link 203:
# 10.2.2.0/24
tc filter add dev eth3 parent 1:0 prio 1 handle 204: protocol ip u32 divisor 256

tc filter add dev eth3 protocol ip parent 1:0 prio 1 u32 ht 100:2: match ip dst 10.2.1.0/24 hashkey mask 0x000000ff at 16 link 204:


Note that ht values for 10.2.1.0 and 10.1.1.0 are the same ("ht 100:1:"). This is because the third octet is the same, so rules go into the same bucket. For the same reason ht for both 10.2.2.0 and 10.1.2.0 is (100:2:).

The last step is to populate hash tables for the fourth (D) octet, e.g. for 10.1.1.D:

tc filter add dev eth3 parent 1:0 protocol ip prio 1 u32 ht 201:1: match ip dst 10.1.1.1/32 flowid 1:10

tc filter add dev eth3 parent 1:0 protocol ip prio 1 u32 ht 201:2: match ip dst 10.1.1.2/32 flowid 1:20

tc filter add dev eth3 parent 1:0 protocol ip prio 1 u32 ht 201:3: match ip dst 10.1.1.3/32 flowid 1:10

tc filter add dev eth3 parent 1:0 protocol ip prio 1 u32 ht 201:a: match ip dst 10.1.1.10/32 flowid 1:10



For example, fourth octet of 10.1.1.1 is 1, so the kernel will look for a rule in hash table 201, bucket 1. That's why the first line contains "ht 201:1:". Similarly, for 10.1.1.2 we use "ht 201:2:". Remember, all ht values are in hex. That's why 10.1.1.10 has "ht 201:a:". "flowid 1:10" indicates which class this filter belongs to - probably you are using HTB for shaping and this would be one of its classes (say, gold or bronze).

Apply the same approach to hosts in other subnets:

# Hosts in 10.1.2.0/24
tc filter add dev eth3 parent 1:0 protocol ip prio 1 u32 ht 202:1: match ip dst 10.1.2.1/32 flowid 1:20

tc filter add dev eth3 parent 1:0 protocol ip prio 1 u32 ht 202:2: match ip dst 10.1.2.2/32 flowid 1:10

tc filter add dev eth3 parent 1:0 protocol ip prio 1 u32 ht 202:3: match ip dst 10.1.2.3/32 flowid 1:20
# Hosts in 10.2.1.0/24
tc filter add dev eth3 parent 1:0 protocol ip prio 1 u32 ht 203:1: match ip dst 10.2.1.1/32 flowid 1:20

tc filter add dev eth3 parent 1:0 protocol ip prio 1 u32 ht 203:2: match ip dst 10.2.1.2/32 flowid 1:10

tc filter add dev eth3 parent 1:0 protocol ip prio 1 u32 ht 203:3: match ip dst 10.2.1.3/32 flowid 1:20
# Hosts in 10.2.2.0/24
tc filter add dev eth3 parent 1:0 protocol ip prio 1 u32 ht 204:1: match ip dst 10.2.2.1/32 flowid 1:10

tc filter add dev eth3 parent 1:0 protocol ip prio 1 u32 ht 204:2: match ip dst 10.2.2.2/32 flowid 1:20

tc filter add dev eth3 parent 1:0 protocol ip prio 1 u32 ht 204:3: match ip dst 10.2.2.3/32 flowid 1:10


Done!


change of paper size in GNOME Evolution aod other GNOME applications

— Posted by hazard @ 08-02-02 10:51
GNOME applications, such as Evolution and Evince, use locale to figure out the paper size you want. So, to change paper type, you need to export LC_PAPER environment variable containing locale which uses the paper size you are looking for. E.g., for A4 paper:
export LC_PAPER="POSIX"
For Letter paper size:
export LC_PAPER="en_US"
My system locale is en_US and it seems that GNOME is hardcoded to use Letter paper size for this locale, which is wrong for the place I live in - the standard paper size here is A4.

It took me quite a few walks to the office printer to figure out this one...


parprouted 0.7

— Posted by hazard @ 08-01-27 16:11
I have just released parprouted-0.7. The major new improvement is support for hosts moving accross interfaces, credit for most of that work goes to Norbert Unterberg and Christian Knecht. Another improvement is support for ARM arch, submitted by Zhouzhi'.

Small movie update

— Posted by hazard @ 08-01-26 14:52
Some movies I recently enjoyed:

Æon Flux: 6.5/10, stylish
Aliens vs Predator - Requiem: 7/10, aliens smashing each other
Five Fingers: 7/10, non-trivial story
Mr. Brooks: 9/10, interesting, non-trivial story, well thought out



Replacing failed hard drive in Linux Software RAID

— Posted by hazard @ 07-12-28 14:33
Initially I thought it would be a quick midnight maintenance, not taking more than 10 minutes... Oh boy, I was wrong.

Googling around showed absence of any real-life scenarios for Linux software RAID disk replacement. All articles were of the "and now we simulate a disk failure..." category, and on top of that, most of them were outdated. No article seemed to cover the scenario where disk has REALLY failed and system was rebooted after a failure.

Even more surprisingly, it seems that CentOS5/Red Hat Enterprise 5 rescue disks are NOT designed to handle software arrays with any kind of problem. They just refuse to detect problematic arrays and mdadm will not show anything.

To cut a long story short, here is a REAL-LIFE procedure on how to replace a failed disk in Linux software RAID array:
  • Insert the new hard drive (probably your server needs to be turned off when doing that).
  • Boot from a rescue CD.
  • Create a partition table on the new drive so that all partitions are in the same order and sizes as partitions on the working drive.
  • Set RAID partition type as Linux (83), not Linux raid auto (fd). THIS IS VERY IMPORTANT AND IS OPPOSITE OF INSTRUCTIONS YOU CAN FIND ELSEWHERE. Otherwise your Linux system won't boot.
  • Now boot system Linux from the working hard drive (I hope you had bootloader installed on it, otherwise install it).
  • Add the new hard drive into the array:
    mdadm [MD-device] -a [new-HDD-device]
    For example,
    mdadm /dev/md0 -a /dev/sdb1
  • Check that hard disk was successfully added using
    mdadm -Q --detail [MD-device]
    Among other things it should say something like "reconstructing 0%".
  • Now, run fdisk, and change RAID partition type to Linux raid auto (fd).
  • If everything went fine until here, consider yourself lucky. :)


Cyprus Stop & Fly

— Posted by hazard @ 07-10-07 13:05
My flight for holidays to Crete was during night hours, and it was inconvenient to ask friends and expensive to go with a taxi. Therefore I have decided to try Cyprus Stop & Fly - a private airport parking service. They wait for you at the airport, then drive your car to their guarded car parking (close to the Neo Chorio roundabout), and when you come back, they meet you at the airport and pass the car back to you.

Indeed, everything went without a hitch and I'm happy with their service.


Hazard's stuff is maintained by Vladimir Ivashchenko <hazard -at- hazardous-area.org>
This blog is powered by pLog