summaryrefslogtreecommitdiff
path: root/hurd/running/chroot.mdwn
blob: 0f5ec88f8eb4bd2c88c0a1ba69eff4f75461329a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[[!meta copyright="Copyright © 2012, 2013, 2016 Free Software Foundation,
Inc."]]

[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the license
is included in the section entitled [[GNU Free Documentation
License|/fdl]]."]]"""]]

This documents the currently-needed tricks to successfully build a
[[glibc/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.
[[!tag open_issue_hurd]]

## Sockets

Since the passive [[translator/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