A complete Debian GNU/kFreeBSD system should work within a jail, on a GNU/kFreeBSD or regular FreeBSD host system, with a few limitations.
Jails work a lot like Linux OpenVZ. On the host you can see all processes running in all jails. Within a jail, you can only see the processes running in that jail.
Be aware that some files in /proc or /sys, such as /proc/mounts, are not partitioned per jail, and this may leak some (read-only) information about the host, or other guests' mountpoints.
Some features such as sysvipc are not namespaced for individual jails, so for security reasons they are disabled by default. fakeroot requires this to be enabled. Running more than one postgresql-server instance in a shared sysvipc namespace would clash, and not normally work.
The raw_sockets feature is normally disabled, to prevent IP spoofing from inside the jail. The ping tool will not work properly as a result.
Starting or stopping a jail
Assuming a debootstrap'd installation already exists in /srv/jail/$JID/, here is an example of how to start it up inside a jail:
JID=101 # Linux-like /proc and /sys filesystems mount -t linprocfs linprocfs /srv/jail/$JID/proc mount -t linsysfs linsysfs /srv/jail/$JID/sys # Ramdisk required for /run mount -t tmpfs tmpfs /srv/jail/$JID/run # A restricted, read-only /dev filesystem mount -t devfs devfs /srv/jail/$JID/dev # Compatibility symlink from /dev/shm to /run/shm ln -s /run/shm /srv/jail/$JID/dev/ # Optionally enable networking HOSTNAME=jail$JID.example.com # This IP address should also be assigned to one of the host's interfaces IP=10.1.0.$JID mkdir -p /var/run/jail jail -J /var/run/jail/$JID.jid -c jid=$JID \ name=jail$JID \ path=/srv/jail/$JID \ host.hostname=$HOSTNAME \ ip4.addr=$IP \ command=/bin/sh -- -c "/etc/init.d/rc S && /etc/init.d/rc 2"
If openssh-server is installed within the jail, you should be able to SSH into it like a virtual private server.
The devd package may be removed as it will typically not work in a jail.
jls (to list running jails) is not available yet.
jexec is not available yet, but you can probably get by with jail -m jid=$JID command=/bin/bash
A jail stops 'running' when all processes within it exit. (Within the jail, /etc/init.d/rc 0 ; exec kill -1 might be a way to force a shutdown?)
The libjail package was not distributed with Squeeze. The kernel functionality has existed since FreeBSD 4.x however, so it may work if you can build the necessary userland tools.