This post replaces Updating a jail by replacing it – 1.0.1
This version is 2.0.0 because it is the first using pkgbase and the first using bsdinstall. It is based upon work done for this mkjail issue.
Preparation
Within the ingress jail, stop and disable the main services
sudo service freshports stop sudo service freshports disable sudo service ingress stop sudo service ingress disable sudo touch /var/db/freshports/signals/OFFLINE sudo service jail stop
This is my attempt at making fewer typos. This is on the host.
export JAIL=test-ingress01
Still on the host, rename the filesystem for the jail we are replacing.
sudo zfs umount data04/freshports/${JAIL}/jails/freshports-ports
sudo zfs umount data04/freshports/${JAIL}/jails/freshports
sudo zfs rename data04/freshports/${JAIL}/jails/freshports data04/freshports/${JAIL}/jails/freshports.14.3
You may want to check the mountpoint and if the way is clear for this new filesystem:
sudo zfs create data04/freshports/${JAIL}/jails/freshports
Ensure the above newly-created filesystem is mounted at the location used in the following command:
The command I will run:
sudo BSDINSTALL_CHROOT=/jails/${JAIL}/jails/freshports bsdinstall pkgbase --jail --non-interactive
If that runs smoothly, remount the ports tree:
sudo zfs mount data04/freshports/${JAIL}/jails/freshports-ports
Configure the newly-created jail
From the ingress jail, run these commands:
cd /usr/local/libexec/freshports/Jail sudo ./copy-scripts-into-jail.sh /jails/freshports sudo cp -i /jails/freshports/vars.sh.sample /jails/freshports/vars.sh
Start the jail
sudo service jail start
Run a simple test:
sudo /usr/sbin/jexec freshports /make-port.sh /usr/ports sysutils/mkjail
Resume processing
sudo rm /var/db/freshports/signals/OFFLINE sudo service ingress enable sudo service ingress start sudo service freshports enable sudo service freshports start
One down, three to go
Before I publish this post, I’ll run the same commands on three other jails on this host.
[18:12 r730-01 dvl ~] % file /jails/*/jails/freshports/bin/sh /jails/dev-ingress01/jails/freshports/bin/sh: ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 14.3, FreeBSD-style, stripped /jails/dvl-ingress01/jails/freshports/bin/sh: ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 15.1, FreeBSD-style, stripped /jails/stage-ingress01/jails/freshports/bin/sh: ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 14.3, FreeBSD-style, stripped /jails/test-ingress01/jails/freshports/bin/sh: ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 14.3, FreeBSD-style, stripped











