Archive for the 'Linux' Category

Apr 29 2008

XmasB quotes and BOFH fortunes for Wordpress

This is one of those posts that I know will have a very limited audience. To the left, you see a block with random BOFH quotes, which I find rather amusing. I’ve always found them entertaining, and thought that they would make a nice addition to my blog as sheer entertainment for you guys. A while back, I found this great little plugin called XmasB quotes, that adds a widget to WordPress where it displays random quotes. The actual quotes are stored in the same MySQL database as Wordpress. But then comes the issue that I faced. There are well over 400 of those quotes, and manually copy and pasting all those quotes into the admin interface of XmasB was not an option that seemed tempting. Not one bit. Now how could I solve that?

Continue Reading »

One response so far

Dec 03 2007

I love the open source community

As many of you know, I’m a true Debian fanatic. Some even say I’m a Debian nut head, borderline evangelist. And mark my words, to call me an evangelist is something truly unique, seeing how my feelings are towards true evangelists. But it has to be said, that I without a shadow of a doubt love and cherish the open source community. Many of us have heard the term open source, both in the media and in our travels across the world wide web. But what is open source, and even more importantly the open source community?

Continue Reading »

One response so far

Sep 01 2007

Debian Etch IPv6 howto

So you want to set up IPv6 on your Debian box? Sick and tired of the fact that you can’t test the new stage of Internet addressing because your ISP simply just doesn’t offer IPv6 connectivity yet? Well, fear not, because here is your solution. Getting IPv6 up and running might sound rather daunting, involving quite a few steps and rather complicated configurations? Well, let me be the first to tell you that this just isn’t the case. You will actually find it rather surprising just how easy it is to set up, and how little time you’ll be spending doing it. Once you’re done, you’ll be wondering why you didn’t do it sooner.

Continue Reading »

2 responses so far

Apr 15 2007

Writing udev rules

Using udev can ease your life with using external units, such as memory sticks or removable storage devices which many of us use these days. On a personal note, I have a few memory sticks that I use quite often, as well as Western Digital USB HDD I use for backup purposes. Having to manually mount these every time I plug them in, is rather tedious task so I thought about a method to get this done automatically. And here comes our friend udev in for play. The purpose of udev is to manage your /dev entries, so that it becomes more manageable. To quote kernel.org on udev;

udev allows Linux users to have a dynamic /dev directory and it provides the ability to have persistent device names.

First things first, we need to find some information about the unit in question. In this case I want to get information about my USB HDD, which I know is has the dev entry of /dev/sdc.

luna:/dev# udevinfo -q path -n /dev/sdc
/block/sdc

Reading this, we now know that the information is found under /sys/block/sdc. Let’s move on.

luna:/dev# udevinfo -q all -p /sys/block/sdc
P: /block/sdc
N: sdc
S: mybook
S: disk/by-id/usb-WD_2500JB_External_57442D5743414E4B38343139353830
S: disk/by-path/pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:0
E: ID_VENDOR=WD
E: ID_MODEL=2500JB_External
E: ID_REVISION=0108
E: ID_SERIAL=WD_2500JB_External_57442D5743414E4B38343139353830
E: ID_TYPE=disk
E: ID_BUS=usb
E: ID_PATH=pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:0

As we can read from this, we see that there’s an attribute that uniquely identifies this hard drive. The attribute is called «ID_SERIAL». This attribute is what we will use in our udev rule. Let us now proceed to make the actual udev rule.

vim /etc/udev/rules.d/local.rules

I take caution into making a new rules file called «local.rules» to make things more manageable for both myself, but more importantly so that apt doesn’t touch my rule sets when udev might be upgraded in the future.

BUS=="usb", KERNEL=="sd*", ENV{ID_SERIAL}="WD_2500JB_External_57442D5743414E4B38343139353830", NAME="%k", SYMLINK="mybook%n"

An explanation of the above rule

BUS==”usb”
# The unit in question is plugged into the USB bus.
KERNEL==”sd*”
# The system mounts the unit to /dev/sdc as mentioned above.
ENV{ID_SERIAL}
# This is the serial number we got from using «udevinfo» earlier on.
NAME=”%k”
# I have to admit that I’m a bit uncertain what this bit does, but I know that it has to be there.
SYMLINK=”mybook%n”
# This is the name of the symlink we want created when the unit is plugged in.

And that’s all there is to it. Hope this guide was understandable and helpful. And good luck!

Update
As it turns out, udev has certain problems with the above rule set when you attach more than one USB unit that uses the usb-storage sub system. The reason is that udev doesn’t see «ENV{ID_SERIAL} for some obscure reason. Why this is the case eludes me, but I’ve found a workaround.

udevinfo -a -p `udevinfo -q path -n /dev/sdc` | grep serial

Which will yield the following:

ATTRS{serial}=="57442D5743414E4B38343139353830"

On some system, ATTRS are reported as SYSFS, but pay no attention to that. In udev rule sets, SYSFS must be used at all times, as ATTRS isn’t a recognizable parameter in udev. The new and updated rule set would then be as follows:

BUS=="usb", KERNEL=="sd*", SYSFS{serial}=="57442D5743414E4B38343139353830", NAME="%k", SYMLINK="mybook%n"

One response so far

Aug 11 2004

SpamAssassin rocks!

Published by Jostein Elvaker Haande under Computers, Linux

I just gotta tell you, SpamAssassin rocks! For those of you that don’t know what SpamAssassin is I will give you a short explaination. It’s a program that goes through all the mail you get, and checks if the mail is a spam mail or not. The way it does this, is to do a series of test on the mail. These tests range from looking at what the subject is, to what is actually written in the mail, and to do checks to see if the mail comes from a source known to send spam mail.

Why do I love it so much? Well, when you’re like me and been on the net for quite a while your e-mail address(es) kinda gets around, and before you know it your inbox gets filled up with all these do you want cheap viagra? and do you want free porn?. This is stuff that might be interesting to an impotent old fart, but that’s just not me. I get around 200 to 300 spam mails daily, and since SpamAssassin filters all these mails away I don’t waste time. SpamAssassin also uses an artificial intelligence, which over time trains itself to become better. The result for me? It catches almost everything, I now see an average of 2 spam mails per week. It’s perfect, it’s bliss. So where’s the link? Well, there’s a lot of humour surrounding the topic spam, and here is a lot of examples why. Everything you didn’t want to have to know about spam.

No responses yet

Aug 10 2004

Server problems

Published by Jostein Elvaker Haande under Computers, Linux

Sometimes you get stuck with some problem that you just can’t figure out. Your server is up and should work perfectly, but does it? Hell no, there is some odd error that you just can’t figure out. In my case, it was a problem with my mail server. I could send mails, but no way in hell was I able to get any mails. At first, I thought the problem was my spam filter that stopped them, but looked through the logs and couldn’t find anything. But then I got to think of something. The domain my private server is on, does not use a real host. It uses what is defined as a CNAME, which means it points to another domain name. So what happened was that whenever someone tried to mail me, the mail got to my server but was rejected as being to the wrong domain since most e-mail clients translates the domain name into it’s real name. So all I had to do to get it working, was to enable my mail server to accept mails for that domain and everything worked like a charm.

No responses yet