Saturday, April 19, 2014

Hurd 2013


Back in 2013, an updated version of Debian Hurd came out, aptly titled Hurd 2013. I downloaded the ISO but never got around to even trying to install it until yesterday.

While other GNU projects have basically driven the state of the art forward on a regular basis, the Hurd might get the award for the most slowly advancing project of all time. I'd put it right behind the Enlightenment window manager. It does keep moving forward though, inch by inch.

What is this Hurd you speak of? Basically it's GNU's take on the kernel. It's different from most kernels though because it implements a microkernel architecture.

What is this microkernel architecture you speak of? Well, I hope I explain this inoffensively accurately...

Most kernels are one big block of code, occupying a single address space. If an app wants to read a chunk of data from a file, it asks the kernel (via a system call) to read the chunk into a specified block of memory. Inside the kernel, the request trickles down through various subsystems and drivers. Something like: virtual file system subsystem -> ext3 driver -> virtual block device subsystem -> sata subsystem -> specific sata driver -> sata controller... To achieve this, each subsystem or driver makes a function call to the layer below it. Since all of this is done in the same address space, it's fast, but a bug in any one subsystem or driver could crash the entire system.

In a microkernel system, the microkernel is small and discrete. It manages virtual memory, schedules processes and provides a mechanism for proceses to talk to each other: Interprocess Communication (or IPC). That's all. Kernel components run as separate processes on top of a microkernel, each in their own address space, and communcate with each other and with user-space apps via IPC. If an app wants to read a chunk of data from a file, the request has to trickle down through an analogous set of subsystems and drivers, but rather than making function calls, the subsystems in the chain communicate via IPC. This involves a lot of copying and synchronization, and is potentially slower, but much more robust. Since everything runs in separate address spaces, it's much harder for a bug in one subsystem or driver to take down the entire system.

The Hurd isn't the only microkernel OS out there. Minix, QNX, Tru64 and OS X are all microkernel-based. There are many others too, but those come to mind immediately. Which architecture is superior? The jury is still out. There have been some famous debates on the subject, major vendors have gone both ways, but no clear winner has emerged.


At any rate, I'd played around with Debian Hurd 0.3 years ago but never got around to trying the current version until yesterday.

I installed it in VMware and ran into a few issues, but nothing I didn't eventually figure out how to work around.

Hurd 2013 - 1. install

I had to give the VM 512mb of ram for the installer to run at all.

The graphical installer only sort-of worked. It didn't display the "Go Back" and "Continue" buttons, and eventually hung extracting files. The text and pseudo-graphical installers worked fine though.

VMware usually puts the hard drive at IDE 0:0, but sometimes, randomly, puts it at IDE 1:1. I'm not sure why, but if it's not at 0:0, then the installer will eventually fail near the end, unable to find the CD. Making sure that the hard drive is at IDE 0:0 fixes this. Go figure.

The installer is also a little confusing because it sees the CD as just another hard drive, or at least presents it that way. When partitioning disks and installing the bootloader, it gives you the option of partitioning the CD or installing the bootloader on the CD. Not a problem, but it made me smile when I saw it.

There was also a problem near the end of the installation. It asks what additional software you want to install, but any attempt to install additional software fails. Accepting the default set of software works fine though.

So, after figuring all of that out...

Hurd 2013 - 2. first login


I was running the Hurd.

Post-Install Tweaks

During the boot process, /proc errors litter the screen. It turned out that the /etc/fstab had no entry for /proc, so I added one:

proc /proc procfs defaults 0 0

But there was still some issue. Attempts to mount /proc failed.

mount: cannot start translator /hurd/procfs: Translator died


Good example there though. A system with a monolithic kernel might have crashed entirely.

I did a bunch of research and digging around but I never got it working. /proc did work in 0.3 though, so I guess that's a regression.

On the plus side though, /etc/network/interfaces worked just like in other Debian releases, and I was able to use it to give the system a static IP. In 0.3 I'd had to set the IP address manually using fsysopts, but not in 2013.


I didn't have to tweak much else. I'd created a user for myself during installation, sudo was installed by default, and the ssh server just worked.

The Web

Wget was installed by default, but nothing else. I installed lynx, iceweasel and apache2 using apt-get, just like on any other Debian system.

Lynx worked. X-forwarding didn't, so I couldn't run iceweasel yet.

Apache was tricky to configure. The config files are spread out over a bunch of different directories. I guess it's the same on modern Debian Linux systems too but it was tricky to find everything.

I actually kicked apache around for a while. I'd configured it correctly, as it turned out, but the server wouldn't start until after I installed the apache2-dev, libapr1-dev and php5-dev packages. Apparently one of them added some important file. Even then though, the server would run, but wouldn't run CGI's. I eventually rebooted for an unrelated reason and was surprised to find CGI's working after the reboot, with no changes to the apache configuration.


X Windows

In 0.3, I'd had a hell of a time getting X windows working. I eventually got twm running, but nothing else.

In Hurd 2013 it was easy to get XFCE running.

Hurd 2013 - 3. xfce

I just installed the xorg and xfce4 packages, created an .xinitrc file with:


And ran startx.

There is some security setting though, that prevents a non-root user from running X on the console. I'm not sure if Debian Linux has the same issue or not. I poked around a bit but never figured it out.

I didn't bother getting a graphical login working because I didn't plan on running X most of the time.

Xterm and the other basic XFCE components worked fine but my luck with other software wasn't as good.

X-forwarding hadn't worked over ssh. I'd hoped to be able to run iceweasel in the X session but unfortunately it failed to start there too.

apt-cache search turned up and libreoffice but it appeared that some of the necessary dependencies were unavailable.

I tried Gnome and KDE too but, as with the office packages, it appeared that some of their dependencies haven't been built yet, or at least haven't made it into the repository.


Well, who knows. I'll give it a few months and try again.


The development tools, languages and libraries that I needed were all available - gcc, make, cvs, vim, pcre, ssl, readline, perl, python, php, ruby, tcl, erlang, mysql, postgresql, sqlite, freetds, firebird, odbc and mdbtools. Yeah, there's no Oracle, Sybase or DB for Hurd, but that's kind of the point of SQL Relay. One of them at least.

Hurd 2013 - 4. sqlrsh

Oracle from Hurd!

One of the shortcomings of Hurd 0.3 was lack of support for SysV IPC - semaphores, shared memory and message queues. I'd hoped that Hurd 2013 had them, but I was out of luck there:

dmuse@hurd2013:~$ ipcs

kernel not configured for shared memory

kernel not configured for semaphores

kernel not configured for message queues

So, no SQL Relay server.

I looked around a bit for how to recompile the kernel. Maybe IPC is supported, just not enabled. I didn't get too far with that though.

Something to do later.


The most obvious improvements over 0.3 were support for /etc/network/interfaces and XFCE. Those are pretty big steps from a usability standpoint. I'm sure that a bunch of stuff was improved behind the scenes too, but those stood out.

It's unfortunate that /proc no longer worked, but hey, sometimes you've got to break a few eggs.

The only serious problem I ran into was general stability. My 0.3 VM sits idle most of the time. Every now and then I do an automated build on it, and it's always there waiting. 2013 doesn't seem so stable. I've had to restart the VM after leaving it idle for a few hours, several times, and sometimes it hangs at boot and has to be restarted again. It kind of feels like a filesystem problem, and a few times I've fsck'ed it and then fsck'ed it again, only to find more errors on the second pass. Hmmm. I see tune2fs, mkfs.ext3 and mkfs.ext4, maybe I can migrate the filesystem to ext3 or 4. It's not clear whether the kernel supports those filesystems or not though.

Fingers crossed.