Curious about the Hurd? Have a 1-5 GiB partition free? Let's install GNU/Hurd on it!
This page covers two ways to install a Debian GNU/Hurd system from a running
Debian GNU/Linux in a dual boot type of setup, using either
[crosshurd](#CrossHurd) or [mmdebstrap](#mmdebstrap).
For the sake of the examples in this page we will consider `/dev/hda3` as
the partition where you want to install your Hurd system as displayed from linux.
The examples here assume the installation of a `hurd-i386` system, but it is
simple to modify for a `hurd-amd64` installation.
## CrossHurd method
First install the [crosshurd package](http://packages.debian.org/crosshurd).
# apt install crosshurd
If you have problems it might be because the crosshurd version in the Stable
distribution is out of date, try the version in Unstable before reporting the issue.
### Preparing the partition
We create the Ext2 filesystem for the Hurd system, notice the `hurd` option.
# mke2fs -o hurd /dev/hda3
Next we create a useful mountpoint and mount the partition.
# mkdir /gnu
# mount /dev/hda3 /gnu
### Cross installing
The crosshurd package only operates in the given target directory, which is the first question asked when running the program.
# crosshurd
Answer the questions you get: $ What is the target directory?: `/gnu` $ Target Debian system?: gnu $ Target CPU?: i386
Now the program starts retrieving all the necessary base packages.
### Preparing to reboot
When all packages have been extracted we must prepare [[GRUB]] for the Hurd when we reboot.
Add the below entry to `/etc/grub.d/40_custom` file in your linux installation.
menuentry "Debian GNU/Hurd" {
set root='hd0,msdos3'
echo 'Loading GNU Mach ...'
multiboot /boot/gnumach-1.8-486-up.gz root=part:3:device:wd0 noide
echo 'Loading the Hurd ...'
module /hurd/pci-arbiter.static pci-arbiter \
--host-priv-port='${host-port}' --device-master-port='${device-port}' \
--next-task='${acpi-task}' \
'$(pci-task=task-create)' '$(task-resume)'
module /hurd/acpi.static acpi \
--next-task='${disk-task}' \
'$(acpi-task=task-create)'
module /hurd/rumpdisk.static rumpdisk \
--next-task='${fs-task}' \
'$(disk-task=task-create)'
module /hurd/ext2fs.static ext2fs \
--multiboot-command-line='${kernel-command-line}' \
--exec-server-task='${exec-task}' -T typed '${root}' \
'$(fs-task=task-create)'
module /hurd/exec.static exec '$(exec-task=task-create)'
}
*Nota Bene:* In your menu file there should be no extra white space after the back slashes.
Following this, re-create the grub configuration file:
# update-grub
### Native install
Then, reboot and select "Debian GNU/Hurd" from the Grub menu. At the prompt, setup TERM and run the native-install script.
# export TERM=mach
# ./native-install
You should add a swap partition to `/etc/fstab`. You can share the swap
partition between your Hurd and linux installations. If the swap partition
was `/dev/hda4` on linux, it will be `/dev/wd0s4` on the Hurd.
Before you reboot the system be sure to set a root password.
# passwd
We can now reboot into the newly configured system.
# reboot-hurd
## mmdebstrap method
First we need to install the [mmdebstrap](http://packages.debian.org/mmdebstrap) and libarchive13t64 packages.
# apt install mmdebstrap libarchive13t64
The way this installation method works is to run mmdebstrap in the
[chrootless mode](https://gitlab.mister-muffin.de/josch/mmdebstrap/wiki#modes)
from a linux host. But because misconfigured package Maintainer scripts may
damage the host installation while running in chrootless mode, we wrap two
mmdebstrap calls: the first creates a throw-away linux chainroot from within
which we call mmdebstrap in chrootless mode to install our GNU/Hurd image.
We run the following command (we use line breaks for readability, but it is a
single command):
# mmdebstrap --variant=apt
--include=passwd,debian-ports-archive-keyring,mmdebstrap,sysvinit-core,sysv-rc,e2fsprogs,libarchive13t64
--customize-hook='chroot "$1"
mmdebstrap --mode=chrootless --arch=hurd-i386
--include=sysvinit-core,sysv-rc,debian-ports-archive-keyring,netdde,gnumach-image-1-486
--customize-hook="passwd --root=\"\$1\" --delete root"
--variant=apt unstable -
"deb http://ftp.ports.debian.org/debian-ports/ unstable main"
"deb http://ftp.ports.debian.org/debian-ports/ unreleased main"
| mkfs.ext2 -o hurd -d - /dev/hda3'
stable /dev/null
We then need to [configure the bootloader grub](#Preparing_to_reboot) in the
same way as described in the crosshurd method above.
You can then reboot into the Debian GNU/Hurd system and install any further
packages using `apt`.