Tuesday, October 30, 2007

Trip to St. Blasien

Having grown up in an area doesn't necessarily make you have seen it all. After spending the first 20 years of my life in the southern region of the Black Forest I moved to Stuttgart and just happened to have come back today to visit my parents. More out of necessity but out of interest we drove to a remote town in the black forest, called St. Blasien which I regret not having seen earlier.
St. Blaise's Abbey

The St. Blaise's Abbey is, of course, absolutely worth seeing (which doesn't mean that the rest of the town should be left out). It's a pity though that I couldn't hear the organ playing, the acoustics must be awesome. Perhaps another time.

Monday, October 22, 2007

dh_fixperms headaches

If you ever wondered why lines such as

install/mypackage:
chmod 4511 debian/tmp/usr/bin/my_setuid_binary

in your debian/rules file seem to be magically ignored in the resulting package, then look no further. It took me some time to figure it out, after trying all kind of combinations of post-install, pre-finalize and pre-install routines. In the end it was quite obvious.
By including the standard debhelper rules (/usr/share/cdbs/1/rules/debhelper.mk) there're a whole bunch of scripts being unleashed on your package and one of them is dh_fixperms(1) which "removes the setuid and setgid bits from all files in the package".
That's fine, but we want to override this with a statement in debian/rules

DEB_FIXPERMS_EXCLUDE := regex

where the regex excludes each file which matches. Good to know.

Sunday, October 21, 2007

Software RAID on Gentoo and Debian

Up until now I backed up my hard drive with important files with unison. I did that by regularly plugging in a similar second hard drive into one of my empty drive bays, running unison, waiting for it to finish and finally pulling the new hard drive out again to store it on my shelf. This obviously spares at least one drive from running all the time but is a very tedious task, especially if it's IDE drives which aren't hot-swappable.

So I've recently gone through the very unpleasant course of loosing the data on one of my old IDE hard drives, of course the one which I don't back up with unison but located in the same file server. Rescuing data wasn't possible, even forensic tools like foremost and scalpel couldn't retrieve all the files, e.g. mp3 files were all either 7.2MB or 42MB in size and contained everything but a valid music stream. foremost didn't even finish and segfaulted after carving about 30% of the disk.

To make life easier and to possibly prevent such tragedies from happening in the future, I ordered two identical Seagate SATA hard drives, each 500GB. While Seagate doesn't precisely build silent drives but grants five years of warranty, these seemed to be perfect for the file server which is running in the cellar. But while planning on using RAID1 for the Seagate drives, I decided to do the same with my workstation - but this time not for reasons of redudancy but for the sake of access speed - and bought two Western Digital HDDs of the same size which promised to be less loud and also had 16MB of cache (instead of 8MB on the Seagate disks).

Once they arrived I added a spare PCI SATA RAID controller with a SiliconImage chipset into the file server and defined a RAID1 array in the card's BIOS setup tool. The stock Debian kernel contained all needed modules and after installing the dmraid with apt, I could view the setup

# dmraid -r
/dev/sda: sil, "sil_ahbgafcdfhah", mirror, ok, 976771120 sectors, data@ 0
/dev/sdb: sil, "sil_ahbgafcdfhah", mirror, ok, 976771120 sectors, data@ 0

# dmraid -s sil_ahbgafcdfhah
*** Active Set
name : sil_ahbgafcdfhah
size : 976771120
stride : 0
type : mirror
status : ok
subsets: 0
devs : 2
spares : 0

Mounting worked the usual way but instead of using the raw device node, you'd need to mount the respective mapped device, in my case /dev/mapper/sil_ahbgafcdfhah .

My workstation also has a (fake/software) RAID controller (onboard ICH7) but it wasn't as easy to set up because the RAID1 array acts as the boot drive and the kernel needs to be booted accordingly. Also, grub doesn't recognize RAID setups and thus I needed to create a separate small primary partition at the beginning of the RAID drive which is accessible, no matter if access it as a RAID drive or as its underlying disks. On this partition I store the kernel and its ramdisk, as well as grub's stage files. I did that by booting the Gentoo install CD, setting up dmraid as I did on the Debian box, formatting the RAID drive and copying the old drive's partitions with

# find . | cpio -pdum /mnt/target

The second problem was building a working kernel and its ramdisk. Custom built kernels didn't work because they're unable to initialize the mapping with dmraid. Luckily Gentoo's genkernel package saved my day.

# genkernel --dmraid all --menuconfig

After compiling the kernel in my chrooted target system, I copied the resulting files to my boot partition mentioned above and add the following entry to grub's config file:

title=Gentoo Linux 2.6.23 genkernel
root (hd0,3)
kernel /kernel-genkernel-x86_64-2.6.23-gentoo root=/dev/ram0 init=/linuxrc \
real_root=/dev/mapper/isw_bcaheaacjd_NewSystem2 dodmraid vga=792 ramdisk=8192
initrd (hd0,3)/initramfs-genkernel-x86_64-2.6.23-gentoo

Note that the fact that the root partition is the partition with number four has nothing to do with it being situated at the very beginning of the disk.

Saturday, October 20, 2007

Our dorm's pool

Who could ever claim that Stuttgart's student dormitories aren't luxurious? Not only has the Pfaffenhof dorm on the campus Vaihingen a sauna, it also has a swimming pool for the warmer seasons. Well, it wouldn't be big enough if you actually tried to swim in there, but it's a pool after all. Naturally it attracts huge quantities of water which in turn gets distributed all over the corridors downstairs by its users and thus might not be all that fancy if it starts raining in front of your apartment one day.
I guess it's a privilege as only our house got one and it's not as publicly available as other people might want it to be. If only I could overcome myself and use it one day...

Update: Google maps' image data got refreshed. Now that it's winter there's no pool visible.

Persona 2 in pSX

I'm a huge fan of the megami tensei (女神転生) series by ATLUS (and formerly Namco), not only because of its exceptionally eerie atmosphere but also because of the great soundtrack and unmatched NPC interaction. With interaction I don't mean a simple four-way dialogs as you find it in the Elder Scroll based on a like-dislike-meter. In Persona, for example, you'll have to find out the personality which can be one of cheerful, timid, gloomy, bluff, temperant, arrogant, wise and fool or a combination of up to three. Depending on the (mix of) personalities, the demons react differently to interaction with either fear, anger, happiness or interest or a logical mix of two. To make things more complicated there are countless (well, in fact only 57) ways to interact with a demon which depends on which character or combination of characters of your party you use. Interactions thus range from reading horoscopes and giving advices to interrogations and passionate gazes. I didn't yet mention that talking is not always an option, especially if a previous action made the demon hate or fear you. Anyway, successfully negotiating with demons is important because they might present you items or join your cause.

Unfortunately, the current shin megami tensei titles such as Nocturne and Digital Devil Saga don't feature such complex interactions, but therefore other great ideas.

Well, as I lost my saves of Persona and bought an import copy of Persona 2 I decided to give it a spin. My PS2 is quite loud though and I'm obviously too lazy to clean its fans so I decided to make ePSXe run my gentoo system. Portage told me that epsxe was masked so I looked around a bit more and finally found pSX, though not in portage. After manually adding some missing ia32 libraries it was all set up - no need to download and configure plugins for each and every vital part of a PSX emulator as in ePSXe. It just workd out of the box, even with real optical drives. OK, I prefer using an image after all:

# cdrdao read-cd --read-raw --datafile persona2.bin --device 3,0,0 --driver generic-mmc-raw persona2.toc

Using a normal (read cheap, without support for dual-shock) PS2-controller to USB adapter works fine after:

# modprobe joydev

See for yourself:



Wednesday, October 10, 2007

fah top 1000

I never thought it was possible to reach the top 1000 Folding@home teams with our little dorm group - but here we are: http://fah-web.stanford.edu/teamstats/team70659.html
This proves that buying a PS3 isn't necessary for now - a quadcore CPU and a G80 GPU should satisfy my needs until I need a bluray player.

Monday, October 8, 2007

Blogger engine

Woot! Now I can use blogger.com's engine on my site without the need to modify XSM internals until they suit my needs.
Let's see whether I'll find some time to post something useful.