Skip to content

poudriere_in_jail

jashank edited this page Jan 2, 2015 · 7 revisions

Run poudriere in a jail

Warning! This can only be done on a 9.X or higher host because it needs recent jails 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 ins -y devel/subversion

Create a default poudriere.conf file /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# fetch --no-verify-peer -o - https://github.com/freebsd/poudriere/archive/master.tar.gz | tar xf -
poudriere# cd poudriere-master
poduriere# ./configure
poduriere# make
poduriere# make install

You can now play normally with poudriere

poudriere# poduriere ports -c -m svn
poudriere# poudriere jails -c -j test -v HEAD -m allbsd
...
Clone this wiki locally