Skip to content

poudriere_in_jail

Bryan Drewery edited this page Sep 28, 2021 · 7 revisions

Run poudriere in a jail

This guide is stale. See https://dan.langille.org/2019/10/23/moving-poudriere-from-the-host-into-a-jail/ for 3.x.

Warning! This can only be done on a 9.X or higher host because it needs recent jail features

DO NOT DO THIS UNLESS YOU KNOW WHAT YOU ARE DOING
IT NEEDS SOME FILESYSTEMS TO BE PATCHED TO BE JAIL READY

Create a poudriere jail in /etc/jail.conf:

poudriere {
    name=poudriere;
    host.hostname=poudriere;
    ip4=inherit;
    ip6=inherit;
    persist;
    children.max=10;
    allow.mount;
    allow.mount.devfs;
    allow.mount.procfs;
    allow.mount.zfs;
    allow.mount.nullfs;
    allow.raw_sockets;
    allow.socket_af;
    allow.sysvipc;
    allow.chflags;
    enforce_statfs=1;
    path=/jails/poudriere;
    exec.start="mount -t devfs devfs /dev";
    exec.stop="umount /dev; zfs umount -a";
}

Create the jail zfs filesystem to receive the jail:

# zfs create -p -o mountpoint=/jails/poudriere tank/jails/poudriere

Get and install the latest HEAD base.txz:

# cd /jails/poudriere
# fetch -q -o - https://pub.allbsd.org/FreeBSD-snapshots/amd64-amd64/10.0-HEAD-20120919-JPSNAP/ftp/base.txz | tar xpf -
# cp /etc/resolv.conf /jails/poudriere/etc/resolv.conf

Create the default dataset for poudriere:

# zfs create -o jailed=on tank/poudriere

Start the jail:

# jail -c poudriere

Give the dataset to the jail:

# zfs jail `jls -q -j poudriere jid` tank/poudriere
# jexec -U root poudriere zfs mount -a

On recent HEAD, instead of the above you can do:

# zfs jail poudriere tank/poudriere
# jexec -U root poudriere zfs mount -a

Bootstrap pkgng and install the needed tools if you want using things that are not default like subversion for ports:

# jexec -U root poudriere pkg install -y devel/subversion

Create a default poudriere.conf file in /jails/poudriere/usr/local/etc/

BASEFS=/poudriere
ZPOOL=tank
RESOLV_CONF=/etc/resolv.conf
DISTFILES_CACHE=/distfiles
CHECK_CHANGED_OPTIONS=yes
NOLINUX=1

Create the distfiles cache directory:

# mkdir /jails/poudriere/distfiles

Load the needed modules on the host:

# kldload tmpfs linux linprocfs nullfs procfs fdescfs

Fetch and install the latest poudriere:

# jexec -U root poudriere sh
poudriere# pkg install poudriere

You can now play normally with poudriere:

poudriere# poudriere ports -c -m svn
poudriere# poudriere jails -c -j test -v HEAD -m allbsd
...