[Bug 284410] [handbook] Thinjail creation steps with ZFS are incomplete/incorrect

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 28 Jan 2025 14:52:22 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284410

            Bug ID: 284410
           Summary: [handbook] Thinjail creation steps with ZFS are
                    incomplete/incorrect
           Product: Documentation
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Website
          Assignee: doc@FreeBSD.org
          Reporter: andy@codeedog.com

Referring to Handbook, Section 17.5.1. Creating a Thin Jail Using OpenZFS
Snapshots

Following these steps with a fresh install of 14.2_RELEASE fails at a number of
points. Directories and/or datasets aren't created along the way that are
required and the final jail.conf file contains a path (under # HOSTNAME/PATH)
that doesn't exist (wasn't created) during the step-by-step instructions.

The missing steps require some deeper knowledge of ZFS to understand how to
correct (how to set a mount point on a dataset), or the instructions should be
adjusted to work with the created dataset(s). I would think the former would be
preferable because the latter implies jails won't be in the usual (expected)
directory location.

Here are the steps I used to successfully create a thin jail with ZFS:

# Create zroot/jails dataset with a mountpoint of /usr/local/jails/
# See footnote[1]
zfs create -p zroot/jails -o mountpoint=/usr/local/jails

# Fetch media
zfs create zroot/jails/media
fetch
https://download.freebsd.org/ftp/releases/amd64/amd64/14.2-RELEASE/base.txz -o
/usr/local/jails/media/14.2-RELEASE-base.txz

# Start template creation from media
zfs create -p zroot/jails/templates/14.2-RELEASE
tar -xf /usr/local/jails/media/14.2-RELEASE-base.txz -C
/usr/local/jails/templates/14.2-RELEASE --unlink

# copy minimal files
cp /etc/resolv.conf /usr/local/jails/templates/14.2-RELEASE/etc/resolv.conf
cp /etc/localtime /usr/local/jails/templates/14.2-RELEASE/etc/localtime

# update
freebsd-update -b /usr/local/jails/templates/14.2-RELEASE/ fetch install

# complete template with a snapshot for thinjail reuse
zfs snapshot zroot/jails/templates/14.2-RELEASE@base

# Create dataset to hold thin jails
zfs create zroot/jails/containers

# FINALLY, create the thin jail from the template
zfs clone zroot/jails/templates/14.2-RELEASE@base
zroot/jails/containers/thinjail
# Create /etc/jails.conf.d/thinjail.conf


------
[1] - Perhaps handbook shows the result of zfs-list after mountpoint creation.
eg:

zfs list zroot/jails
NAME          USED  AVAIL  REFER  MOUNTPOINT
zroot/jails   914M   887G    96K  /usr/local/jails

-- 
You are receiving this mail because:
You are the assignee for the bug.