This documents the currently-needed tricks to successfully build a ?chroot in GNU/Hurd.

Preparation

It can be a good idea to put the chroot on a separate translator, for instance:

# dd [...] < /dev/zero > storage
# mke2fs storage
# settrans -c chroot /hurd/ext2fs $PWD/storage

Unpack

Debootstrap should be able to build the content:

# debootstrap --keyring=/usr/share/keyrings/debian-ports-archive-keyring.gpg --extra-suites=unreleased sid chroot http://deb.debian.org/debian-ports/

Tricks

One current issue to know about chroots is that since passive translators (e.g. /servers/socket/1) are started by the root translator, which is not aware of the chrooting, these passive translators are started non-chrooted, leading to a few issues.

Sockets

Since the passive pflocal translator will not be chrooted, local socket creation will actually happen in the root filesystem. To make things work correctly the programs inside the chroot need to be able to access them:

# CHROOT=$PWD/chroot
# settrans -kp $CHROOT/servers /hurd/firmlink /servers
# settrans -kp $CHROOT/dev /hurd/firmlink /dev
# settrans $CHROOT/tmp /hurd/firmlink /tmp
# settrans -c $CHROOT/var/lib/dbus /hurd/firmlink /var/lib/dbus
# settrans -c $CHROOT/run/dbus /hurd/firmlink /run/dbus
# settrans -kp $CHROOT/proc /hurd/firmlink /proc
# settrans -c $CHROOT/$HOME/.dbus /hurd/firmlink /$HOME/.dbus

Buildds

Debian build daemons use a specialized script instead of debootstrap:

# mkdir ~/chroots
# /usr/share/sbuild/create-chroot unstable

They also use sbuild to start the build:

# sbuild foo_1.2.3-1