coLinux – the devil’s in the details…

Pleased with my initial success with coLinux, I set out to add the finishing touches.

I’ve gone back and forth on the network configuration, trying e.g. to carefully follow Bebbo’s config example. It didn’t work for me. There seem to be issues running TAP on Vista, and bridging with my Wireless LAN interface caused the WLAN connection to start acting up. I also tried the Microsoft Loopback adapter, but no joy. I finally figured out that just using slirp with the following (recommended) setting:

(upate: I made a last minute change that proved wrong. This is what works.)

worked just fine. The only problem was that I thought I had to set the DISPLAY variable to the (dynamically configured) IP address of my laptop. But looking at the auto-generated setting for eth0 in /etc/network/interfaces, I realized that slirp had assigned an IP address for my laptop, as seen from the coLinux end:

iface eth0 inet static

The “gateway” address was the one I needed, so I could just hardcode the following in my .bashrc:

export DISPLAY=

Xming is said to be a lighter and better X-Windows server than Cygwin X, so I set out to change. No major issues, except that I had a very hard time figuring out how to get it do display Swedish characters. I’d suffered this in the coLinux console too, but that was ok, since I intended to jump into X as soon as possible.

Fixing the language support in the console was … uhm, not so easy, but I’ll attribute that to my being sorely out of practice on linux admin chores. Googling indicated that the cure was

apt-get install locales
dpkg-reconfigure locales
apt-get install console-data
dpkg-reconfigure console-data

Close, but no cigar. I also had to do
apt-get install kbd

Now, I had Swedish characters in the console, but not in X. Finally, I found this post (in Swedish), suggesting that it’s a bug in Xming’s definition of the Swedish layout. Specifying Finnish layout instead solved the problem.

The command line for Xming now looks like this:

exec0="c:\Program Files\Xming\Xming.exe -multiwindow -clipboard -silent-dup-error -xkbmodel pc105 -xkblayout fi"

I also switched to PulseAudio. Following the instructions on the coLinux wiki worked for me.

I also tried setting the environment variable COLINUX_NO_SMP_WORKAROUND=Y, to get coLinux to use both cores. I was disappointed to see that erl -smp still only saw one CPU. Apparently, coLinux makes internal use of SMP, but makes it look like a single-core system for the linux applications. My win32 version of Erlang does see both CPUs, though.

Also, it seems as if erlang under coLinux suffers from the same problem as under Win32 – erlang:now() doesn’t have sufficient resolution:

Eshell V5.6.4 (abort with ^G)
1> [erlang:now() || _ <- lists:seq(1,10)].

Note how it increments by 1 usec each time? On my other laptop running Ubuntu, the diff is ca 12 usec between each (by definition, erlang:now() always steps up at least 1 usec). I wish I could say that my Vista laptop is ~10x faster, but that’s not it. Apparently, coLinux doesn’t offer a gethrtime(). gethrvtime() also seems to be missing, and configure reports clock_gettime() as “not stable”. No disaster, perhaps, but a good erlang:now() is often useful.

coLinux on top of Vista

Since I’m lugging around a dual-core Vista laptop, I thought I’d try to make it more useful for hacking.

I’ve tried using the win32 version of xemacs, Eclipse (crashed due to some lock violation), other editors like TotalEdit, et al, but it all feels very clunky compared to a unix environment. Cygwin is ok, but has its issues as well. For one thing, running erlang from within a cygwin shell messes up command-line editing.

Enter Cooperative Linux, or coLinux – a port of the Linux kernel that allows it to run natively alongside another OS. I played around a bit with various pre-built distributions, and finally settled for the bare-bones Debian Etch root file system that comes as an option with the basic coLinux install. I use my existing Cygwin X server, and resized the root partition up to 16 8 GB.

So far, so good. I’ve used apt-get to install the necessary utilities, and was able to build Erlang/OTP R12B-4 without problems. The system feels pretty much like a native linux installation.

coLinux on Vista

The thing I have yet to figure out is how to share a file system between coLinux and Vista. I thought of using a Cygwin NFS daemon, but I don’t seem to have enough access privileges on my work laptop to pull that off. But overall, it feels extremely promising.

In-service upgrade woes

I’ve been using the StatPress plugin in this WordPress blog of mine, and when a link appeared that offered to upgrade it automatically to the newest version, I just had to try it…

Now I don’t have a working StatPress plugin anymore.

Not to say that upgrades in Erlang always go smoothly either, but the ones as simple as this usually do.
Luckily, nothing else seems broken. For now, I guess I’ll live without StatPress then. If I get lots of spare time, I might investigate what went wrong.
(Update: After a few days, the plugin started working again. Oh, well…)

Contribution summary page

I once posted a question to the erlang-questions list in order to find out which of my Open Source contributions were actually used. I was hoping to remove some of them.

This didn’t seem to be doable, and I was instead asked to put together a summary of my different contributions, together with their status and what I thought I had learned from them.

Well, that was a number of years ago, but I finally put together something along those lines: My Erlang Projects (available from the right side bar). At least it was helpful to me – I guess that’s the main value of most blog activities anyway. (: