Installing ezjail 3.3 on FreeBSD 9.2 using ZFS

Today I will be installing ezjail 3.3 on a FreeBSD 9.2 system. I will give an overview of the installation and go straight to the configuration of the first jail.

As I type this, I’m looking back at my old notes from 2008.


I installed ezjail with this command:

pkg install ezjail


Enable ezjail by adding this command to /etc/rc.conf:


This system is configured with ZFS and each jail will have their own ZFS filesystem. The /usr/local/etc/ezjail.conf contains this (I have omitted the commented out directives):

# Setting this to YES will start to manage the basejail and newjail in ZFS

# Setting this to YES will manage ALL new jails in their own zfs


After making those changes, I created the filesystem referenced above:

zfs create system/usr/jails

Creating the base jail

This command creates the base jail:

# ezjail-admin install -r 9.2-RELEASE
base.txz                                      100% of   64 MB  185 kBps 05m57s
lib32.txz                                     100% of   12 MB  185 kBps 01m06s
110307 blocks
Note: a non-standard /etc/make.conf was copied to the template jail in order to get the ports collection running inside jails.

The next step is to upgrade the base jail to 9.2-RELEASE-p3.

Upgrading the base jail to the latest version

FreeBSD 9.2-RELEASE was originally installed on the host system. freebsd-update was then used to install the latest binary update of that release. Now the the host system is running FreeBSD 9.2-RELEASE-p3. The previous step installed FreeBSD 9.2-RELEASE into the basejail. This step will update that basejail to what we have in the host system. The basejail would work fine without this update, but I think it’s best to run the latest binary update.

ezjail-admin uses freebsd-update for this step, and will use the output of uname -r to determine what parameters to pass to freebsd-update:

ezjail-admin update -u 
Looking up mirrors... 5 mirrors found.
Fetching metadata signature for 9.2-RELEASE from done.
Fetching metadata index... done.
Inspecting system... done.
Preparing to download files... done.
Fetching 3 patches.. done.
Applying patches... done.

The following files will be updated as part of updating to 9.2-RELEASE-p3:
Installing updates... done.

Creating the first jail

This command creates a jail with the given name and IP address:

ezjail-admin create  "em0|"

The IP address will be dynamically added to em0 by ezjail when the jail is started, and removed when the jail stops.

Starting the jail

This command starts the jail:

$ sudo ezjail-admin start
Configuring jails:.
Starting jails:

You can see the jail running via jls:

$ jls
   JID  IP Address      Hostname                      Path
     1            /usr/jails/

Jail console

Now you can connect to the jail and do any post installation configuration.

$ sudo ezjail-admin console
FreeBSD 9.2-RELEASE-p3 (GENERIC) #0: Sat Jan 11 03:25:02 UTC 2014

Welcome to FreeBSD!

Before seeking technical support, please use the following resources:

o  Security advisories and updated errata information for all releases are
   at - always consult the ERRATA section
   for your release first as it's updated frequently.

o  The Handbook and FAQ documents are at and,
   along with the mailing lists, can be searched by going to  If the doc package has been installed
   (or fetched via pkg_add -r lang-freebsd-doc, where lang is the
   2-letter language code, e.g. en), they are also available formatted
   in /usr/local/share/doc/freebsd.

If you still have a question or problem, please take the output of
`uname -a', along with any relevant error messages, and email it
as a question to the mailing list.  If you are
unfamiliar with FreeBSD's directory layout, please refer to the hier(7)
manual page.  If you are not familiar with manual pages, type `man man'.

Edit /etc/motd to change this login announcement.

root@mailjail:~ # 

Installation of packages within the jail

Now that you are root in the jail, you can do anything you want. I will be installing packages compiled by poudriere.

Hope this helps.

Website Pin Facebook Twitter Myspace Friendfeed Technorati Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top