Archive for January, 2010

RAID and external USB backup on NetBSD 5

2010/01/23 1 comment

I recently had to change my “storage policy”…

A failed drive in my RAID1 set of 2 disks, and brand new disks coming up forced me to πŸ˜‰ So here I am sharing two facts that have wasted my time recently. Hopefully it would help some to avoid these hassles, or at least plan more time for it.

First : I followed the NetBSD guide to setup my RAID back when I was on NetBSD3 probably. Things where a bit different from now that I have a 5 fully upgraded version, but anyway it still works. Problems is to be that I have the right same geometry for my disks in the RAID1, I did as they say on the official guide, which is copy the disklabel of disk 1 onto disk 2. and it works perfectly. Problem is : When you want to change the disk, both disklabels have same name and identifier, and if on top of that you have for some logistic reason to change the way the disks are plugged into the machine, it get much trickier to find out which drive you wanted to keep and which one you wanted to remove… So I had to “fix” my disklabels, and put different meaningful identifiers, so I could use them to properly identify which disks I wanted to pull out of my RAIDset.

Second : For my backup strategy, as my RAID set was previously “under-used”, meaning there was a lot more free space than I actually needed, I used to backup stuff inside the RAID itself. Even if it is discouraged for obvious reason, a RAID1 mirroring was enough to ensure my data, so I just wanted to be able to go dig up old configuration files and revert some setup, so just keeping the files, even in the same disk, made some sense.
Now that my disk usage is getting higher, and hard drive prices are getting lower, it s becoming worth it to get an external USB drive. I naively thought that just plugin it, and pointing my rsnapshot config to the appropriate mount point would be enough. Error.
RSnapshot uses hardlinks in order to minimize the duplicates of files into the different backups, and therefore cannot work on the preconfigured FAT partition on that drive. I expected that, so I plug that USB dirve in my ubuntu laptop, uses gparted to make a big ext2fs partition, and unplug it. From there I expected i would work. Well it didnt. As stated in the mailing list, at the time I am writing this, ext2fs has problem being mounted on the netbsd-5-0 branch, although this has been fixed in netbsd-5. I really wanted to use ext2fs for my external backup just because it would make it so easier to retrieve data on another “non-BSD” computer, I now have to upgrade to a netbsd-5 branch, rebuild everything, install the newly built OS, and reboot. Extremely easy to do since I document and script all these tasks. Just time consuming…

Categories: Linux, NetBSD Tags: , , ,

Temporal paradox, an interesting DejaVu

Since I have been playing multiplayer video games over the network when I was young, I have been interested in distributed algorithm, and parallel computing. That s also probably why I am working in that area now πŸ˜‰Β  And when you start to be deeply immersed into a distributed environment, the more you realize that the concept of time as we usually know it, is not that obvious. Maybe it s also because I did a little bit too much quantum physics back when I was in Uni…

I wont go into details here, but for example in a video game, there is no way for a player to know what another player did, until this information is delivered to him via the network. Therefore, from the point of view of one player, or one machine, what it is seeing as “his” own time-line, and the time-line of another computer he is connected to, might be very different. It s a bit the same while you’re looking at a star : your seeing the past of that star, and that star may not even exist while you re watching it, and the light on the way might have trouble to come to you…

All these phenomenons got me thinking about the very nature of time for a while and, of course, I got interested in science fiction books and movies, and tried to extract from those, theories and paradox, back when I was in University studying all sorts of interesting things. Now that I am more into computers, I can realize how the usual time line that we can perceive everyday truly influence the way we do things. From complex mathematic algorithm to cooking recipes, everythig that can be assimilated to a “process” is based on a time line… And in computer, that start with imperative computing. Imperative computing is based on the fact that one instruction is executed *after* another, and yet you got experts wondering why we cannot adapt usual imperative language to program in parallel intuitively. Thinking in parallel is not intuitive. For the big majority of us, we think in sequential everyday, all day long. And it make me sad when I see so many things in distributed computing and in parallel architecture that could be really great, if only people would just stop thinking by their own time-line…

Among the different ways to conceptualize time that have been used here and there, and paradoxes that have been exploited in different scenarios, I want here to talk about one movie that I saw one more time recently, where the concept of time is used very “liberally” yet in an interesting way. I want to talk about DejaVu, where the main plot is an investigation on an explosion of a ferry, with a main suspect we ll call “terrorist”, and the hero taking interest in a special victim and even trying to save her by going into the past to change the events that happened. Basic bad guy / good guy setup so far…

I will try here to review the scenario and its “timeline” if possible. I am not bothering about the introduction where the hero learns that he actually can see the past, and even interacts with it. Neither am I taking interest in the love story, or whatever romantic stuff is behind it. Lets focus on dates, facts and consequences. Once the possibility of communicating with the past ( seeing it, or even being able to act on it) is introduced in the movie, it open possibilities for the hero to save the victim. However everything has consequences. But the hero must tryΒ  to see if he can change the past or not…

– First pass : changing time ?

From the beginning, the hero’s colleague is missing, supposedly went on holidays but his car is found on the ferry. We then assume he was killed in the ferry explosion. But when the hero send a note back in time, his colleague finds it and that trigger events that lead to his death, in the property of the terrorist.

The hero assumes then (very lightly I must say ) that time can be changed and then he s willing to try to go himself back in time to save the victim. Being myself, the spectator, I was quite skeptical. I used to think that no matter what you do when you go back in the past, events triggered in chain will maintain the timeline where it always is, the only way for it to be stable despite having some “actor” traveling back in time, and triggering consequences from his experience of something that didnt happen yet… Looks like it s called the Harmony Theory… But more on that later.

– Second pass : saving the dead ? “Is she dead or alive !?!”

The hero now thinks he can change the past so he is willing to travel himself back in time, and try to save the, so charming, victim… Before we talk about that lets review ( a part of, because I m not going to list all events ) what the hero has already experienced :

1) the property of the terrorist is destroyed, an ambulance car still there.
2) the appartment of the victim, after the ferry exploded, has a message on the fridge, is full of blood and full of the hero fingerprints.
3) the hero has seen the terrorist, in jail. The terrorist is talking just as if he knows what has always happened and what will always happen… almost like a mystic…

The hero then goes back in time, wakes up in an hospital, and is reanimated by the staff there. He then steals an ambulance car, and goes to the terrorist place. He knows the location fromΒ  his own past and use this information to change it… Yet, in the fight with the terrorist, the property is blown up, and the ambulance is in place, all causes are there for 1). Terrorist ran away, with the car of the victim.

He then saves the girl and they decide to drive to her apartment where he clean his clothes and his wounds, puts blood everywhere, write stuff on the fridge, etc. Everything is in place for 2). However this time the hero realizes that what he is doing now, is actually already in his own past, in his own experience… From now on he will try everything to change the past he knows and tries to force events in another way. Apparently unsuccessfully for a while.

Then they drive to the ferry before he starts, in order to meet the terrorist and confront him. They are in the car of the hero’s colleague, and stop at the parking to get on the ferry. Where the car has been found in the hero experience -> this is a hint, meaning that his colleague death, might not have been on the ferry, before he sent back the note in the past or after. Rather it would mean that the hero experienced the same, and went back in time to put things in place, just like he has experienced them. Just as if there was a destiny, or only one timeline, and that a loop in time rectifies itself.

Then happens the fight between the hero, the victim, and the terrorist. But, despite all the previous “hints” of ” time cannot change” or ” what has always happen will remain so” , the victim managed to kill the terrorist. The hero said to teh terrorist what the terrorist told him, when they meet in prison. Or maybe it was hte otherway around, and the terrorist told him what he heard from him in his own experience ? Anyway, the hero managed to get the car out of the ferry, and dies in it, when the bomb explodes, under the water. And NOT on the ferry ! That ferry is now saved, and so are all the people on board.

Now here are two questions :

– when exactly does the timeline start to “change course” and means the ferry can be saved ? ( Special mention of : ” It should nt have happen like this”Β  from the Terrorist just before dying… )

– How many times did the hero went back in time, before being able to make it “change course” ?? ( careful there is a trap… )

I am sure it would be interesting to read the book to see how much the movie changed the scenario. And to see all the little details that havent been used, intentionnally or not, in the movie. But anyway, I tried here to illustrate, word after word, sentence after sentence, how our perceptions and conceptions are almost all based on a timeline we perceive or imagine, and much more than we actually realize. Thats why it s incredibly hard to think differently, and to come up with theories about time, parallelism that are intuitive and efficient alltogether.

But when you want to do parallelism and distributed computing efficiently, we need to get out of our old conceptions, and realize that we cannot build efficient parallel system inside a restricted sequential conception. A sequence is after all just a special ordering of events. Each event is the consequence of one other, and only one, and each event has one and only one cause. The same way that a clock is a just a special case of time flow. Each second of that clocks happen one after the other. Yet at the same time other clocks are ticking other seconds without direct relations to the first one… Take two clocks put them in different places, in different conditions, when you reunite them they might not mark the same date anymore. “Universal Time” is just something we use because it is convenient, not because it actually *is* so.

Here is my conception of it : time doesnt exist. What exists are causal relationships. Even the tiniest, and from them we build time in our minds, because it is convenient. We build time based on our own memories, especially the most recent ones. and since we perceive one thing after another, time for us is linear. We think of time as a line, the same way we usually think that light travel in a straight way… or the same way we now think that earth has always the same round shape… Because it s simpler to think about it like that.

And then, the next question would be : Can an event have a consequence that would trigger is own cause ? Or said in a more compact way : Can an event justify his occurrence by itself ? Well, … I think not. For now… because it is just simpler for me to think like that.
But then, I have to admit that it s possible that an event has no causes at all.
Just because it looks like something started, once upon a time, in a great “Bang”…

Trac, mod_python and sqlite annoying problems…

I have been stuck for days, when trying to update my Trac from 0.11.5 to 0.11.6 because of strange errors…

I love Trac as a free collaborative development platform, and I would definitely advise it to others, but I must admit the update has been already painful a number of times. Maybe my setup is not the simplest I could do, but anyway…

My previous Trac installation was working fine on mod_python after following the documentation, and when I did the update, maybe because of a new version of sqlite3, maybe because of a new version of apache, or maybe because of a new version of mod_python ( more likely ) things started to go wrong…

Symptoms : blank page when trying to look at the list of the projects in my Trac environment, or when trying to view a page of any project. Seems to be that the children of my apache 2.2 webserver were dying every single time. In my /var/log/messages :

[notice] child pid 6986 exit signal Segmentation fault (11)

After a lot of rebuilding and reinstalling I managed finally to get a proper mpinfo instead of a blank page every time I was trying to call mod_python. That was better, but still wasnt enough for trac which failed then on every page with an odd error from :

File "usr/pkg/lib/python2.5/site-packages/trac/db/", line 189, in get_connection
return SQLiteConnection(path, log, params)
File "usr/pkg/lib/python2.5/site-packages/trac/db/", line 255, in __init__
SystemError: NULL result without error in PyObject_Call

After trying for hours ( days ? ) to fix that error by trying different version of everything, trying to get some error logged here and there, I finally gave up and decided, as others I believe did before me, to switch to CGI. From what I heard it seems to be a more stable way to run Trac and we do not need to bother about mod_python problems, even if it is a tiny bit slower. I just changed my apache configuration, and now everything run smoothly πŸ™‚

My apache configuration file httpd.conf now looks like :

#For Trac CGI
ScriptAlias /trac /home/www/main/ssl/trac/trac.cgi
<Location /trac>
#to run with CGI
SetEnv TRAC_ENV_PARENT_DIR "/home/www/main/ssl/trac"
Options +ExecCGI
AddHandler cgi-script .cgi
DirectoryIndex trac.cgi

#to run with mod_python
#SetHandler mod_python
#PythonHandler trac.web.modpython_frontend
#PythonOption TracEnvParentDir /home/www/main/ssl/trac
#PythonOption TracUriRoot /trac
#SetEnv PYTHON_EGG_CACHE /home/www/main/.python-eggs

Hopefully this will avoid those with the same problem to waste too much time fighting against mod_python… These things are pretty annoying to debug.
Finally after a long struggle my development environment is up and running again πŸ™‚

Categories: BSD, NetBSD Tags:

NetBSD 4 -> 5 upgrade

Yesterday, as I was having trouble running apache with mod_python ( lots of errors to do with pthreads ), and after a long day looking for solutions regarding mod_python without success, I decided to upgrade my old NetBSD4 to a NetBSD 5.0.1, who should have an improved thread support.

Although I was used in the past to upgrade my home server using home made scripts and docs that I keep at , I havent done that in a long time… I updated my NetBSD source tree, and tried to build the new version while running the previous one. I failed, and after a few unsuccessful tries, I decided that doing a blank new upgrade using the installer that comes with a fresh ISO… I have been away from the mailing list probably a bit too long.

Unfortunately my server doesnt have any CD reader… so I made myself a USBdisk following the wiki. I did the upgrade on my couple of raid disks following the wiki again. But when trying to boot, it told me /boot was not present on my drive (heh ?)… It took me a while to remember that I was using FFSv2 and not v1, so I had to install the appropriate boot file : bootxx_ffsv2.

Then I rebooted, and everything was working fine. My old settings were kept, which I must admit I was a bit relieved about πŸ™‚ My apache doesnt fails on pthreads anymore, but instead returns me an error from trac python code, which is always nicer than a plain blank page… still have to fix that…

Next step is going to completely finish the update of my system, from source and make sure all my scripts are going to work again on NetBSD 5, and that the doc is still accurate… ha lots of work, but it s always a good idea to keep track of how you install and configure your machines.

Still love NetBSD, even though I wish more people ( including myself ) had more time and resources to help them rounding the edges…

Thanks to all the people who made the release 5 possible !

Categories: NetBSD Tags: ,

WkCMake and building differences on different platforms

I recently had a lot of troubles with compilation, linking and other related stuff, even more difficult on cross platform environments (Β  reminder, we are talking C++ here…)

Those who know me know that I like CMake a lot because it an generate build environment for many different kinds of platform. However I ended up writing my own wrapper of CMake, just to make things even easier, and probably more adapted to the way I write code and architecture software…

This Project is hosted on GNA, with a BSD license and called WkCMake. Its purpose is basically to automate as much build steps as possible, even between different projects, and that on different platforms. A bit like source-based package managers are doing on Unix based platforms, using autotools as build framework… Everyone interested in this field will know how much Windows can be different, but since I am interested in Video Games and Windows is a very widely used platform for this type of applications, I have to make that build framework work painlessly even on Windows…

Read more…

Categories: CMake, WkCMake Tags: , , , ,

First Post, and Saving backup remotely

2010/01/08 1 comment

Hi everyone,

I used to blog on my home server, and talk mostly about travels, posting pictures and so on… it was fun πŸ˜‰

But recently I lost my passport, and lots of things went wrong, including a RAID failure on my home server that I visit once every 2 years, so I decided it wouldn’t hurt to blog somewhere else, and talk about all the geek stuff that I am used to do on my free time, such as fixing my RAID, and re-organise my backup strategy for example ;). Hopefully it will help others with similar troubles…

So here you go, I recently found that I can use a combination of cpio and ssh, to export my rsnapshot backup directory ( with hardlinks ) from a BSD machine to a Linux one !

On my NetBSD 4.0 box :
# find /home/.snapshots/ -depth -print | cpio -c -o -H ustar -v | ssh user@remotehostname "cat > snapshots.cpio"

And then on my Ubuntu box 09.10 :
$ mkdir snaps && cd snaps && cpio -imdv -H ustar -I ../snapshots.cpio

Worked like a charm πŸ™‚

Happy me, my old server will be saved, and all backups restored as soon as I can hold a couple of new disks πŸ™‚

Categories: Linux, NetBSD Tags: , , ,