Ports ] [ Debian GNU/Hurd ] [ News ] [ Installation ] [ Hurd CDs ] [ Documentation ] [ Development ] [ Contact ]

Debian GNU/Hurd Installation

This document aims to provide an easy and relatively painless set of instructions on how to get Debian GNU/Hurd up and running with a minimum amount of effort.

It is based in Neal H. Walfield's The Hurd Installation Guide. Many thanks to Neal for his contribution.

Note that some points in this manual are a bit inconvenient because they take a lot of time and may cause problems. You may prefer the installation over the prepared CD images, especially if you are a beginner. Even if they are outdated, they usually work. You can still get updates from the online repositories.

1. Overview

The Debian GNU/Hurd distribution, unlike distributions of other operating systems, does not have a nice installation program. One day it will and maybe you will help design and implement it; however, until that day, installing Debian GNU/Hurd requires another operating system, specifically, another Unix-like system. Users have indicated successful installations using different flavors of GNU/Linux as well as the BSDs. The minimum requirements of the bootstrap operating system are the ability: to create an ext2 file system; to extract a tar archive on to it; and to install GNU Grub.

GNU is similar in nature to any Unix-like system: after logging in, the user is presented with a shell and the familiar Unix VFS (virtual filesystem). Although GNU tries to be POSIX compliant, it is Not Unix. GNU/Hurd builds upon many of the Unix concepts and extends them to either add new functionality or to fix what has been perceived as flaws in the original design. The most noticeable difference is translators, user space programs which interact with the VFS. These filesystems do not live in the kernel nor do they need to be run as root; they only need access to the backing store and the mount point. Another difference is that processes, rather than having a single user identity fixed at creation time, have identity tokens which are disjoint from the process, i.e. they may be added with the appropriate permission from an authority or destroyed.

Being familiar with the Unix environment (and especially GNU userland, found in popular variants such as GNU/Linux) is an imperative for feeling at ease in GNU. Having experience with the Debian tools will also prove invaluable to the configuration and maintenance of a GNU/Hurd box.

This guide endeavors to make installing GNU/Hurd as painless a process as possible. If there are errors, they are most certainly the author's. Please report them, along with any other suggestions or criticisms, to him; all are gladly accepted.

2. Real Estate or Finding A Home

If you do not have an available partition or an extra hard drive, this can be the longest step. In this case, you will need to repartition the hard drive. One solution is to use GNU's partition editor, Parted. It features not only basic partition editing but also partition resizing and moving functionality. The manual is quite complete and includes several tutorials. Note that also there is a 63 GNU HURD or SysV partition type, it should not be used or else the installation CD will not find it. Just use 83 Linux

The Hurd supports several extensions to the ext2fs filesystem format. Foremost among these are passive translators and a fourth set of permission bits for unknown users (users without an identity--not the other user). To use these extensions, the owner of the partition must be set to hurd. mke2fs, unless specifically overridden on the command line, will set the owner to whatever kernel it is running on. As the Hurd will diligently respect this setting, care must be taken to set this appropriately or the Hurd will fail in subtle ways. Be aware that even if a file system is owned by a particular kernel, others may still use it; they just may not be able to use certain extensions.

To create a filesystem, use mke2fs and pass it -b 4096 -I 128 -o hurd to designate the Hurd as the owner of the new file system. For instance, assuming the partition is /dev/hda1:

 
 # mke2fs -b 4096 -I 128 -o hurd /dev/hda1

3. The Boot Loader

The bootloader of the GNU system is Grub, the GRand Unified Boot loader, and it is its main purpose to boot the GNU system core (Mach and the Hurd). Any boot loader that supports the multiboot standard, though, may be used to load Mach and the Hurd. At the moment (that we're aware of), GNU Grub is the only bootloader that supports such standard.

A word about Grub. Unlike traditional boot loaders on the x86, such as LILO, Grub is very powerful. It has a command line interface, bootp, dummy terminal support and a plethora of other features. In addition, it can boot almost any kernel. If you have ever booted an alpha or sparc, you will understand what Grub can do. Therefore, do not be scared: Grub is better. You will like it. You will not go back.

It is probably better if you install Grub before installing the Hurd, but you can always install it onto your hard drive at a later date.

4. Cross Install

The next step is to get a base system. There are several alternatives, if you are running a Debian system you can use the package crosshurd. Otherwise you can get an updated base system tarball from any of the mirrors listed at http://wiki.debian.org/DebianPorts/Mirrors.

The tarball is set up to extract everything into the current directory. After the filesystem is mounted, the archive can be extracted. Assuming that the filesystem is on /dev/hda2, the mount point is /gnu and archive is in current user's home directory, the following is required:

 
 # mount -t ext2 /dev/hda2 /gnu
 # cd /gnu
 # tar --same-owner -xvjpf ~/gnu.tar.bz2

5. Booting GNU/Hurd

All is now in readiness to boot GNU/Hurd for the first time. Note that depending on your version of GRUB, small details with vary. Please make sure whether you have GRUB1 (aka legacy aka 0.95 and later up to 0.97), or GRUB2 (aka 1.95 and later). Examples below will provide both versions, make sure to pick the right one.

If your system already has GRUB installed, just reboot it. Else, you need to use a Grub boot disk. On Debian, the grub-disk (grub1) or grub-rescue-pc (grub2) packages provides CD and Floppy disk images. Make sure that the Grub boot disk is in the drive, reboot. If all goes well, either a Grub menu or command line will be displayed. If the menu has a GNU/Hurd entry, you will probably be able to just reuse it to save a lot of typing burden. For now, if presented with a menu, press c to go to the command line.

First, GNU Mach needs to be loaded. This requires knowing the filesystem and the path to GNU Mach. Grub uses a partition nomenclature that is a bit different from both Linux and the Hurd: both IDE and SCSI drives are named (hdN,M). N is the drive number (zero based) as enumerated by the BIOS. That is, Grub makes no distinction between IDE and SCSI disks. M identifies the partition on the drive. It is zero based in grub1 but one based in grub2. If this sounds confusing, relax: Grub is also helpful.

To determine on which filesystem a particular file resides, Grub provides the find command. When this command is issued along with a filename, Grub searches on each filesystem for the specified file and prints where it was found. For example, to search for the kernel, /boot/gnumach.gz:

 
   grub1> find /boot/gnumach.gz
   (hd0,0)
 
   grub2> search -f /boot/gnumach.gz
   (hd0,1)

Here, Grub1 indicates that /boot/gnumach.gz is on (hd0,0) and Grub2, on (hd0,1) (remember the difference in partition numbering between Grub1 and Grub2). To save you a couple of typing, set Grub's root to that value:

 
   grub1> root (hd0,0)
 
   grub2> set root=(hd0,1)

Before loading the kernel, at least one option, the root partition, must be specified on the command line. This will be used by the Hurd itself (i.e. not Grub). As such, it must be in terms that the Hurd can understand.

GNU Mach enumerates disks starting at zero. IDE drives are prefixed with hd, while SCSI disks are prefixed with sd. Like Linux, drives are number by their position on the controller. For instance, the primary master is hd0 and the secondary slave is hd3. Partitions use the BSD slice naming convention and append sM to the drive name to indicate a given partition. Note that M is a one, not zero, based index. The slice number is simple to calculate: if you have Grub2, just reuse the same index, if you have Grub1, just increment what was used for Grub1 by one.

Since the Hurd has not yet been configured, it must be started in single user mode. Adding a -s to the kernel command line is all that is required.

To sum it up, assuming that the first drive (i.e. (hd0)) is the master on the master controller, we would have:

 
   grub1> kernel /boot/gnumach.gz root=device:hd0s1 -s
   [Multiboot-elf, ...]
 
   grub2> multiboot /boot/gnumach.gz root=device:hd0s1 -s

Next, the root filesystem server and the exec server must be loaded. This is done using Grub's boot module capability. The ${var} are filled in by GNU Mach. The arguments are used by the Hurd to indicate what type of information is being provided. Since the ext2fs command line is very long, it can be broken up by escaping the newline character in the normal Unix fashion. Be sure that there is not space after the antislash at the end of each line. Also be sure to differentiate { and } from ( and ). Mind the subttle differences between Grub1 and Grub2: Grub2 needs that the filename be repeated and quotes need to be used. Note that at this stage the --readonly option of ext2fs.static must not be passed.

 
  grub1> module /hurd/ext2fs.static --multiboot-command-line=${kernel-command-line} --host-priv-port=${host-port} --device-master-port=${device-port} --exec-server-task=${exec-task} -T typed ${root} $(task-create) $(task-resume)
    [Multiboot-module  0x1c4000, 0x2cfe6a bytes]
  grub1> module /lib/ld.so.1 /hurd/exec $(exec-task=task-create)
    [Multiboot-module  0x494000, 0x27afe bytes]
 
  grub2> module /hurd/ext2fs.static ext2fs --multiboot-command-line='${kernel-command-line}' --host-priv-port='${host-port}' --device-master-port='${device-port}' --exec-server-task='${exec-task}' -T typed '${root}' '$(task-create)' '$(task-resume)'
  grub2> module /lib/ld.so.1 exec /hurd/exec '$(exec-task=task-create)'

Once the Hurd is running, process can be automated by adding the appropriate commands to Grub1's /boot/grub/menu.lst or Grub2's /boot/grub/grub.cfg configuration file.

GNU/Hurd can be now booted:

 
grub> boot

If GNU/Hurd fails to boot, it could be due to shared IRQs: GNU Mach does not play well with these. You can verify your situation by looking at, for instance, the /proc/interrupts file under GNU/Linux. Also, as GNU Mach does not support loadable kernel modules, many of the drivers are compiled into the default kernel. If there are old peripherals, this can be a problem: a device may incorrectly respond to a probe intended for a completely unrelated device and thereby cause a crash. Building a new kernel with only the required device drivers will usually solve this problem. GNU Mach is easily cross compiled. If you are running Debian, install the mig package, and your stock gcc should do.

If this does not help, ask on the appropriate mailing list.

6. Native Install

Once you are presented with a shell prompt, and any time that the Hurd is in single user mode, it is necessary to set the terminal type:

 
 # export TERM=mach

Be warned that CONTROL-C and family will not work in single user mode.

We can now run the native-install script. This will configure the packages and set up several important translators:

 
 # ./native-install

Before the script terminates, it will indicate that it needs to be run a second time. Follow its instructions and reboot using the reboot command. Again, go into single user mode and run ./native-install.

7. Configuration

7.1 The Network

First, make sure that your network card is recognized by GNU Mach:

 
 # devprobe eth0
 eth0

If devprobe eth0 does not return eth0, the kernel didn't detect your network board and you need to try another board.

To configure the network, the pfinet translator must be configured. This is done using the settrans command to attach a translator to a given filesystem node. When programs access the node by, for example sending an RPC, the operating system will transparently start the server to handle the request.

 
 # settrans -fgap /servers/socket/2 /hurd/pfinet -i eth0 -a a.b.c.d -g e.f.g.h -m i.j.k.l

Here, settrans is passed several options. The first two, fg, force any existing translator to go away. The next two, ap, make both active and passive translators. By making the translator active, we will immediately see any error messages on stderr. The latter saves the translator and arguments in the node so it can be transparently restarted later (i.e. making the setting persistent across reboots). The options are followed by the node to which the translator is to be attached, then the program (i.e. translator) to run and any arguments to give it. The -i option is the interface pfinet will listen on, -a is the IP address, -g is the gateway and -m is the network mask.

Be sure to add name servers to your /etc/resolv.conf file:

 
  nameserver 192.168.1.1

To test the configuration, ping -c2 gateway. The -c is important to limit the number of pings; recall, CONTROL-C does not work in single user mode.

DHCP does not yet work on the Hurd. This is due to limitations of pfinet: it is based on the Linux' TCP/IP code and unable to listen on 0.0.0.0.

Help on settrans can be obtained by passing it the --help option. Help on a specific translator can be gotten by invoking it from the command line with the same argument, e.g.:

 
 # /hurd/pfinet --help

As there can be a lot of output, consider piping this through a pager such as less.

7.2 Other File Systems

Next, edit /etc/fstab to add any additional filesystems as well as swap space. It is very important that swap space be used; the Hurd will be an order of magnitude more stable. Note that the Hurd can transparently share a swap partition with Linux but will happily page to any device including a raw partition such as your home partition. By default, nano is the only editor installed by the base distribution.

Here is an example /etc/fstab file:

 
# <file system> <mount point>   <type>  <options>  <dump>  <pass>
/dev/hd2s1      /               ext2    rw         0       1
/dev/hd2s2      /home           ext2    rw         0       2
/dev/hd2s3      none            swap    sw         0       0

Remember to create any devices using the MAKEDEV command:

 
 # cd /dev
 # ./MAKEDEV hd2s1 hd2s2 hd2s3

To mount an nfs filesystem, /hurd/nfs translator is used. When run as non-root, the translator will connect to the server using a port above 1023. By default, GNU/Linux will reject this. To tell GNU/Linux to accept connections originating from a non-reserved port, add the insecure option to the export line. Here is an example /etc/exports file assuming the client's ip address is 192.168.1.2:

 
  /home  192.168.1.2(rw,insecure)

To mount this from a GNU box and assuming that nfs server's ip address is 192.168.1.1:

 
# settrans -cgap /mount/point /hurd/nfs 192.168.1.1:/home

7.3 Rebooting

Finally, reboot into multiuser mode, i.e. in the same way single user mode was brought up minus the -s option when loading the kernel. For details, see section 5. Booting GNU/Hurd.

Happy Hacking!

8. Final Words

8.1 The Grub Menu

Having to always load the kernel by hand can be very tedious. Edit the /boot/grub/menu.lst for Grub1 or /boot/grub/grub.cfg for Grub2 and tailor it appropriately; booting will become much quicker and easier.

8.2 Adding Devices

By default, only a few devices are created in the /dev directory. Use the MAKEDEV script to create any needed device nodes.

8.3 Installing More Packages

There are several ways to add packages. Downloading and using dpkg -i works but is very inconvenient. The easiest method is to use apt-get. Edit /etc/apt/sources.list and add one of the following unreleased entries from one of the http://wiki.debian.org/DebianPorts/Mirrors:

 
deb http://ftp.debian-ports.org/debian unreleased main

http://ftp.debian-ports.org/ and its mirrors contain packages that have hacks or patches that have not yet been integrated upstream or in Debian.

And unstable from one of the Debian mirrors (see http://www.debian.org/mirror/list for the complete list) carrying this architecture:

 
deb http://ftp.de.debian.org/debian unstable main

If GNU Mach does not recognize your network card or you use a modem, the only way to upgrade will be to download the packages and then transfer them to the GNU system. The easiest way to do this is to use apt off-line. Refer to /usr/share/doc/apt-doc/offline.text.gz for detailed instructions.

8.4 The Hurd console

Besides the Mach console you encountered during installation, the GNU/Hurd features a powerful user-space console providing virtual terminals. Currently, you have to start the Hurd console manually with the following command:

 
 # console -d vga -d pc_mouse --repeat=mouse -d pc_kbd --repeat=kbd -d generic_speaker -c /dev/vcs

Inside the Hurd console, you can switch between virtual terminals via ALT+F1, ALT+F2 and so on. ALT+CTRL+BACKSPACE detachs the Hurd console and brings you back to the Mach console, from where you can reattach again with the above command.

8.5 X.Org

X.Org has been ported and all video cards, which it supports that do not require a kernel module should work.

You need to be in the Hurd console and have repeaters setup as indicated in Section 8.4 above. As X.Org has /dev/kbd hardcoded as device for the keyboard, you have to make a symlink:

 
 # cd /dev
 # ln -s cons/kbd kbd
 # ln -s cons/mouse mouse

You will need several X packages. x-window-system-core, rxvt and twm, fvwm or wmaker are a good start.

Debconf can be used to configure X.Org, however, it is not Hurd aware and the configuration file will need to be tweaked. After configuring, change the pointer section to read:

 
Section "Pointer"
  Protocol "osmouse"
  Device "/dev/mouse"
EndSection

Emulate3Buttons and ZAxisMapping must both be disabled.

Finally, run startx.