I just installed mpd on an OpenWRT router. It works great and I can recommend using MPoD for controlling it. The whole thing looks like this then:
Category: Linux
Conditionally rewriting mail subjects using exim4
Since MobileMe sadly does not support filtering using RegExps, and I get a lot of heterogenous system mails from our computer systems here, I implemented a workaround. I added some text like [System] to the subject, which can be filtered fine by MobileMe.
All of our machines here send their mail to a central smarthost running exim4. All the system mails are directed to “root” at some of our machines. What I did was first adding a file /etc/exim4/exim.filter containing this:
# Exim filter
if "$h_to:" matches Nroot@.*.your.domain.deN then
headers add "New-Subject: [System] $h_subject:"
headers remove subject
headers add "Subject: $h_new-subject:"
headers remove new-subject
endif
system_filter = /etc/exim4/exim.filter
After that I had to run update-exim4.conf and /etc/init.d/exim4 reload. Then I was all set up.
Migrating from GMX IMAP to MobileMe IMAP
I am currently migrating my >4GiB of mail data from GMX to MobileMe. I have been using offlineimap regularly to backup my mail data. So first step was to update the backup. Now the next step is to run imapsync, which can migrate whole IMAP accounts. The full command I am using for this is:
imapsync –sep1 ‘/’ –prefix1 ” –ssl1 –ssl2 –authmech1 PLAIN –authmech2 PLAIN –host1 imap.gmx.net –user1 “yourname@gmx.de” –host2 mail.me.com –user2 “yourname@me.com”
I will report back once the sync has finished, this might take a while.
Update: Yup, it worked. My mail is now hosted on MobileMe. More disk space. What is missing at MobileMe is that it does not support automatically expiring mail folders. I.e. for mailing lists, I sort the mails into subfolders for each list. The lists are often high volume traffic, and not very important. So I’d like the mails to expire after, say, 30 days. With GMX this was not a problem, but MobileMe does not yet have such a feature. However, I found a nice tool called imapfilter. It allows you to do all kinds of stuff, besides other things it allows you to filter mails according to date and to delete them. This is what I will do. I’ll write another post, when I found out how to do that exactly.
Linux and the UUID
Even after more than 15 years of Linux experience, I sometimes learn new stuff. Today, I figured out why my KDE goes haywire sometimes. It turns out, that my swap file was mounted as /dev/sda1. Which is fine, most of the time. Except when an external USB drive is plugged in. Then that one becomes sda, and the internal drives goes to sdb or even sdc, when two external drives are plugged in. So the swap won’t work, and the USB drive cannot be mounted via dBus / HAL, since it is suddenly listed in the /etc/fstab. Also, KDE will have some strange troubles during this time, and will not restore my session. But I am not 100% sure this is related. Time will tell… Anyway, what was strange was, that everything else worked. That was because the root filesystem was mounted using a UUID, which identifies a partition or volume uniquely. So, why did the swap not have this? Seems, this was forgotten by Ubuntu upon the upgrade to Maverick. But the Ubuntu Wiki helps. So what I did was:
# swapoff /dev/sda1
# MYUUID=$(uuidgen)
# mkswap -U $MYUUID
# sed “s//dev/sda1/UUID=$MYUUID/”
# swapon /dev/sda1
You can also just edit fstab with the editor of your choice…
Frogatto and Friends
An absolutely cute 2D, very classic jump and run game is Frogatto and Friends. It is for free, comes even with source code. Only the iPhone version does cost a bit. But I guess that is a nice way to support the developers. The game is crossplatform, running on Linux, OS X, Windows and, as mentioned, iOS devices. I assume, if you take the source, you can make it run on several other platforms as well. The music is nice, the characters lovable, and the levels have a great amount of detail. Controls are simple: cursor keys, plus A and S is all you need. What surprised me was that the music is stored as .ogg files, although it sounds like tracker songs. Thus it makes up 90 MiB of the game data, the whole game being slightly over 100 MB in size. Anyway, download it and have fun!
Emacs in Ubuntu…
…it’s buggy. I tried the snapshot, but that behaves strange as well. My workaround so far is to go fullscreen. Still, customize is broken: the customization buffer shows up in the wrong buffer. I haven’t found a bug description for that yet. Also, the git interface does not work. I will install magit next, to see if that helps. Anyway: Emacs on (K) Ubuntu is in bad shape…
Update: I fixed the first two problems. Turns out, emacs-snapshot does work, I just forgot to de-install emacs23-gtk and install emacs-snapshot-gtk. Thus I still fired up the old version. Customize works as well now, after uninstalling cedet and ecb, and instead using the latest ecb and cedet from Sourceforge. The versions shipping with Kubuntu are slightly out of date and were causing the buffer problem.
Truecrypt + ext2/3 + Linux AND OS X
Ok, so the combination of Truecrypt and ext2/3 is not optimal for sharing data between Linux and OS X. Truecrypt and fuse-ext2 on OS X cannot mount an ext2/3 partition read-write. So I will now go back to the lowest common denominator for all OSes: NTFS…
Update: Yes, it seems NTFS is a good alternative. With both OSes using NTFS-3G, I can use the Truecrypt file on both Linux and OS X — and even Windows, if I had one… Creation of a 200GB Truecrypt file takes time, though. And copying all the data to it, even more.
Akonadi Hell
Which sick, twisted mind designed Akonadi? Everytime I run Kontact for the first time, it will fire up a dialog, presenting me with strange errors that happen upon running Akonadi. The second time around, it works fine. This is, by the way, on a fresh KUbuntu 10.04 installation. Sometimes, a little bit more Q/A on complex FOSS projects would be really, really nice.
Update: Plus the display of Google contacts using Akonadi (in the KDE address book) is totally borked. Well, good thing I only change my contacts through MobileMe or the iPhone, and push those changes on to Google…
Backup of running VirtualBox machines
If you are using VirtualBox for running servers, you might have stumbled across the question: How do I backup a running virtual machine? The problem is, that the machine state, consisting of the hardware state and especially the virtual harddisk, might change during the backup. This means that you will most probably end up with an inconsistent machine state, from which you might not be able to recover, after restoring the machine from your backup.
So I thought up a little script that creates a static machine state that can be backed up, while the vbox continues to run on a current, changing machine state.
Requirements: two states named current and previous (you have to add them manually first), where “current” is the current vbox snapshot, which the machine is running on. The script will move the current state to the name “previous”, and delete the old “previous” state. It will then take a new “current” snapshot.
The previous snapshot (.vmdk and .sav) together with the main .vmdk or .vdi can then be used for backup purposes.
So it’s a good idea to run this script before your daily backup run. The snapshots take only some seconds. Deleting the old snapshot might take a bit longer, because the deleted machine state is committed back to the main machine state.
Note that your backup software will fail to backup the current snapshot correctly. However, since vbox generates random IDs for the states, it is not easy to exclude the file from the backup set. So just ignore error messages from your backup software concerning that particular state file. This way you will have a machine state that lags only some minutes compared to your backup system.
#!/bin/bash
VBOXMANAGE="/usr/bin/VBoxManage -q"
if [ $# != 1 ]
then
echo "Usage: $0 VBoxName"
exit
fi
echo "Renaming old snapshot..."
$VBOXMANAGE snapshot "$1" edit previous --name deleteme
echo "Renaming current snapshot..."
$VBOXMANAGE snapshot "$1" edit current --name previous
echo "Taking new snapshot..."
$VBOXMANAGE snapshot "$1" take current
echo "Deleting old snapshot..."
$VBOXMANAGE snapshot "$1" delete deleteme
Evoke 2010 wrapup
On Friday and Saturday I went to the Evoke 2010 in Cologne together with 0xtob. Exactly 25 hours before the 4k Intro compo deadline we started coding… Well, I haven’t coded an intro ever before, 0xtob has some more experience. Plus the two other, very brilliant entries in the competition had much more time to prepare. But nevertheless we managed to submit an entry for Linux, which took about 3.2KiB.
0xtob even managed to code a minimalistic sound engine in less than an hour, so that we had at least some noise playing in the background. The whole intro is just one scene without any fading in or out so far. It’s basically a raytraced implicit, morphing function (interpolating between two animated implicit functions). So we actually do not render any explicit geometry. The raytracer is written in GLSL, and the textures are a port of Ken Perlin’s original improved Perlin noise to GLSL, which I somehow managed to do. The intro runs on both Linux and OS X, but on OS X it is currently about 7KiB, so not quite 4k. A Windows port will follow at some time, I guess. We are planning to clean up and beautify the intro somewhat and put it on pouet in the coming weeks.
All in all it was a lot of fun, and we got a lot of help: jix borrowed us his MBP running Linux, because the orga did not want to accept OS X as the host OS, and 0xtob’s Quadro NVS was not up to the task rendering the whole thing in 720p. 🙂 Some unknown guy borrowed us the MDP to DVI adapter. Robert helped to crunch the binary to minimal size, and also made the shader more colourful than ever. Roman gave helpful hints and was another pair of eyes watching over the code.