Iocage makes upgrading jails quite simple. It can be a little more involved than the host upgrade but not by much.
First on the host server we need to fetch the right version of FreeBSD for iocage to use. This will create the iocage zfs file system structures for upgrading to and building 11.0 jails.
$ sudo iocage fetch 11.0-RELEASE $ zfs list NAME USED AVAIL REFER MOUNTPOINT pgdata 7.63G 262G 19K legacy pgdata/pg94 7.63G 262G 7.63G /pg94 sys 257G 580G 19K legacy sys/ROOT 2.27G 580G 19K legacy sys/ROOT/default 2.27G 580G 1.38G / sys/home 4.62G 580G 4.60G /home sys/iocage 94.2G 580G 24.9G /iocage sys/iocage/.defaults 28K 580G 19K /iocage/.defaults sys/iocage/base 1.35G 580G 19K /iocage/base sys/iocage/base/10.3-RELEASE 655M 580G 19K /iocage/base/10.3-RELEASE sys/iocage/base/10.3-RELEASE/root 655M 580G 69.5M /iocage/base/10.3-RELEASE/root sys/iocage/base/10.3-RELEASE/root/bin 804K 580G 790K /iocage/base/10.3-RELEASE/root/bin sys/iocage/base/10.3-RELEASE/root/boot 1.24M 580G 1.23M /iocage/base/10.3-RELEASE/root/boot sys/iocage/base/10.3-RELEASE/root/lib 5.35M 580G 5.34M /iocage/base/10.3-RELEASE/root/lib sys/iocage/base/10.3-RELEASE/root/libexec 196K 580G 185K /iocage/base/10.3-RELEASE/root/libexec sys/iocage/base/10.3-RELEASE/root/rescue 4.94M 580G 4.93M /iocage/base/10.3-RELEASE/root/rescue sys/iocage/base/10.3-RELEASE/root/sbin 3.81M 580G 3.79M /iocage/base/10.3-RELEASE/root/sbin sys/iocage/base/10.3-RELEASE/root/usr 569M 580G 21K /iocage/base/10.3-RELEASE/root/usr sys/iocage/base/10.3-RELEASE/root/usr/bin 48.0M 580G 47.9M /iocage/base/10.3-RELEASE/root/usr/bin sys/iocage/base/10.3-RELEASE/root/usr/include 8.11M 580G 7.94M /iocage/base/10.3-RELEASE/root/usr/include sys/iocage/base/10.3-RELEASE/root/usr/lib 39.7M 580G 39.7M /iocage/base/10.3-RELEASE/root/usr/lib sys/iocage/base/10.3-RELEASE/root/usr/lib32 39.0M 580G 38.9M /iocage/base/10.3-RELEASE/root/usr/lib32 sys/iocage/base/10.3-RELEASE/root/usr/libdata 139K 580G 127K /iocage/base/10.3-RELEASE/root/usr/libdata sys/iocage/base/10.3-RELEASE/root/usr/libexec 1.80M 580G 1.75M /iocage/base/10.3-RELEASE/root/usr/libexec sys/iocage/base/10.3-RELEASE/root/usr/sbin 8.08M 580G 8.07M /iocage/base/10.3-RELEASE/root/usr/sbin sys/iocage/base/10.3-RELEASE/root/usr/share 29.9M 580G 29.5M /iocage/base/10.3-RELEASE/root/usr/share sys/iocage/base/10.3-RELEASE/root/usr/src 394M 580G 389M /iocage/base/10.3-RELEASE/root/usr/src sys/iocage/base/11.0-RELEASE 724M 580G 19K /iocage/base/11.0-RELEASE sys/iocage/base/11.0-RELEASE/root 724M 580G 47.2M /iocage/base/11.0-RELEASE/root sys/iocage/base/11.0-RELEASE/root/bin 824K 580G 824K /iocage/base/11.0-RELEASE/root/bin sys/iocage/base/11.0-RELEASE/root/boot 1.48M 580G 1.48M /iocage/base/11.0-RELEASE/root/boot sys/iocage/base/11.0-RELEASE/root/lib 5.96M 580G 5.96M /iocage/base/11.0-RELEASE/root/lib sys/iocage/base/11.0-RELEASE/root/libexec 192K 580G 192K /iocage/base/11.0-RELEASE/root/libexec sys/iocage/base/11.0-RELEASE/root/rescue 5.75M 580G 5.75M /iocage/base/11.0-RELEASE/root/rescue sys/iocage/base/11.0-RELEASE/root/sbin 3.99M 580G 3.99M /iocage/base/11.0-RELEASE/root/sbin sys/iocage/base/11.0-RELEASE/root/usr 658M 580G 120K /iocage/base/11.0-RELEASE/root/usr sys/iocage/base/11.0-RELEASE/root/usr/bin 77.8M 580G 77.8M /iocage/base/11.0-RELEASE/root/usr/bin sys/iocage/base/11.0-RELEASE/root/usr/include 8.08M 580G 8.08M /iocage/base/11.0-RELEASE/root/usr/include sys/iocage/base/11.0-RELEASE/root/usr/lib 48.7M 580G 48.7M /iocage/base/11.0-RELEASE/root/usr/lib sys/iocage/base/11.0-RELEASE/root/usr/lib32 40.8M 580G 40.8M /iocage/base/11.0-RELEASE/root/usr/lib32 sys/iocage/base/11.0-RELEASE/root/usr/libdata 129K 580G 129K /iocage/base/11.0-RELEASE/root/usr/libdata sys/iocage/base/11.0-RELEASE/root/usr/libexec 1.91M 580G 1.91M /iocage/base/11.0-RELEASE/root/usr/libexec sys/iocage/base/11.0-RELEASE/root/usr/sbin 8.57M 580G 8.57M /iocage/base/11.0-RELEASE/root/usr/sbin sys/iocage/base/11.0-RELEASE/root/usr/share 38.4M 580G 38.4M /iocage/base/11.0-RELEASE/root/usr/share sys/iocage/base/11.0-RELEASE/root/usr/src 434M 580G 434M /iocage/base/11.0-RELEASE/root/usr/src
$ sudo iocage upgrade jail01 -r 11.0-RELEASE * Creating back-out snapshot. * Upgrading jail. Looking up update.FreeBSD.org mirrors... 4 mirrors found. Fetching metadata signature for 10.3-RELEASE from update4.freebsd.org... done. Fetching metadata index... done. Fetching 1 metadata patches. done. Applying metadata patches... done. Fetching 1 metadata files... done. Inspecting system... done. The following components of FreeBSD seem to be installed: kernel/generic src/src world/base world/doc world/lib32 The following components of FreeBSD do not seem to be installed: world/games Does this look reasonable (y/n)? y Fetching metadata signature for 11.0-RELEASE from update4.freebsd.org... done. Fetching metadata index... done. Fetching 1 metadata patches. done. Applying metadata patches... done. Fetching 1 metadata files... done. Inspecting system... done. Fetching files from 10.3-RELEASE for merging... done. Preparing to download files... done. Fetching 45107 patches.....10....20....30. done. Applying patches... done. Fetching 12420 files...
Now we need to upgrade all the packages in the jail.
$ sudo iocage console jail01 $ pkg-static install -f pkg $ pkg upgrade Shared object "libssl.so.7" not found, required by "pkg"
Here we have an issue with the old pkg binary which is linking to a version of libssl that no longer exists. To fix this we need to reinstall the pkg binary.
$ pkg-static install -f pkg pkg-static: Warning: Major OS version upgrade detected. Running "pkg-static install -f pkg" recommended Updating FreeBSD repository catalogue... FreeBSD repository is up-to-date. All repositories are up-to-date. New version of pkg detected; it needs to be installed first. The following 1 package(s) will be affected (of 0 checked): Installed packages to be UPGRADED: pkg: 1.8.8 -> 1.9.4_1 Number of packages to be upgraded: 1 3 MiB to be downloaded. Proceed with this action? [y/N]: y [blackbox@mars.com] Fetching pkg-1.9.4_1.txz: 100% 3 MiB 2.9MB/s 00:01 Checking integrity... done (0 conflicting) [blackbox@mars.com] [1/1] Upgrading pkg from 1.8.8 to 1.9.4_1... [blackbox@mars.com] [1/1] Extracting pkg-1.9.4_1: 100% Updating FreeBSD repository catalogue... FreeBSD repository is up-to-date. All repositories are up-to-date. Checking integrity... done (0 conflicting) The following 1 package(s) will be affected (of 0 checked): Installed packages to be REINSTALLED: pkg-1.9.4_1 Number of packages to be reinstalled: 1 Proceed with this action? [y/N]: y [1/1] Reinstalling pkg-1.9.4_1... [1/1] Extracting pkg-1.9.4_1: 100%
Now let’s see if it works.
$ pkg info alsa-lib-1.1.2 ALSA compatibility library ap24-mod_perl2-2.0.9,3 Embeds a Perl interpreter in the Apache server apache24-2.4.23_1 Version 2.4.x of Apache web server apr-1.5.2.1.5.4_1 Apache Portability Library augeas-1.4.0 Configuration editing tool ...
It works! Let’s continue upgrading the packages..
$ pkg upgrade Updating FreeBSD repository catalogue... FreeBSD repository is up-to-date. All repositories are up-to-date. Checking for upgrades (324 candidates): 100% Processing candidates (324 candidates): 100% The following 353 package(s) will be affected (of 0 checked): New packages to be INSTALLED: readline: 6.3.8 p5-Sub-Quote: 2.003001 p5-List-UtilsBy: 0.10 p5-Math-Random-Secure: 0.06_1 p5-Any-Moose: 0.26 ... Installed packages to be UPGRADED: zsh: 5.2_3 -> 5.3.1 xproto: 7.0.28 -> 7.0.31 wget: 1.18 -> 1.18_2 vim-lite: 8.0.0019_1 -> 8.0.0134_1 ... Installed packages to be REINSTALLED: zfs-stats-1.2.2_1 (ABI changed: 'freebsd:10:x86:64' -> 'freebsd:11:x86:64') xextproto-7.3.0 (ABI changed: 'freebsd:10:x86:64' -> 'freebsd:11:x86:64') unzip-6.0_7 (ABI changed: 'freebsd:10:x86:64' -> 'freebsd:11:x86:64') unixODBC-2.3.4 (ABI changed: 'freebsd:10:x86:64' -> 'freebsd:11:x86:64') ... Number of packages to be installed: 29 Number of packages to be upgraded: 86 Number of packages to be reinstalled: 238 The process will require 46 MiB more space. 203 MiB to be downloaded. Proceed with this action? [y/N]: [blackbox@mars.com] Fetching zsh-5.3.1.txz: 100% 4 MiB 4.1MB/s 00:01 [blackbox@mars.com] Fetching zfs-stats-1.2.2_1.txz: 100% 9 KiB 9.5kB/s 00:01 [blackbox@mars.com] Fetching xproto-7.0.31.txz: 100% 59 KiB 60.2kB/s 00:01 [blackbox@mars.com] Fetching xextproto-7.3.0.txz: 100% 21 KiB 21.9kB/s 00:01 [blackbox@mars.com] Fetching wget-1.18_2.txz: 100% 578 KiB 592.2kB/s 00:01 [blackbox@mars.com] Fetching vim-lite-8.0.0134_1.txz: 100% 5 MiB 5.5MB/s 00:01 ... Number of packages to be installed: 29 Number of packages to be upgraded: 85 Number of packages to be reinstalled: 238 The process will require 46 MiB more space. Proceed with this action? [y/N]: [blackbox@mars.com] [1/354] Upgrading perl5 from 5.20.3_15 to 5.24.1.r4_1... [blackbox@mars.com] [1/354] Extracting perl5-5.24.1.r4_1: 100% [blackbox@mars.com] [2/354] Reinstalling p5-Sub-Install-0.928_1... [blackbox@mars.com] [2/354] Extracting p5-Sub-Install-0.928_1: 100% ... [blackbox@mars.com] [54/354] Installing libassuan-2.4.3... [blackbox@mars.com] [54/354] Extracting libassuan-2.4.3: 100% [blackbox@mars.com] [55/354] Installing libtasn1-4.9... [blackbox@mars.com] [55/354] Extracting libtasn1-4.9: 100% [blackbox@mars.com] [56/354] Installing tpm-emulator-0.7.4_1... ===> Creating groups. Creating group '_tss' with gid '601'. ===> Creating users Creating user '_tss' with uid '601'. pw: user '_tss' disappeared during update pkg: PRE-INSTALL script failed
Uh oh. Houston we have a problem. No biggie. Just run this to regenerate the passwd file which will fix it.
$ vipw :w! (to save it)
Now lets finish up the pkg upgrade.
$ pkg upgrade Updating FreeBSD repository catalogue... FreeBSD repository is up-to-date. All repositories are up-to-date. Checking for upgrades (273 candidates): 100% Processing candidates (273 candidates): 100% Checking integrity... done (1 conflicting) - p5-Sub-Quote-2.003001 conflicts with p5-Moo-2.002004 on /usr/local/lib/perl5/site_perl/Sub/Defer.pm Checking integrity... done (0 conflicting) The following 298 package(s) will be affected (of 0 checked): New packages to be INSTALLED: readline: 6.3.8 p5-Sub-Quote: 2.003001 p5-Math-Random-Secure: 0.06_1 p5-Any-Moose: 0.26 ... Installed packages to be UPGRADED: zsh: 5.2_3 -> 5.3.1 wget: 1.18 -> 1.18_2 vim-lite: 8.0.0019_1 -> 8.0.0134_1 ... Installed packages to be REINSTALLED: zfs-stats-1.2.2_1 (ABI changed: 'freebsd:10:x86:64' -> 'freebsd:11:x86:64') xextproto-7.3.0 (ABI changed: 'freebsd:10:x86:64' -> 'freebsd:11:x86:64') unzip-6.0_7 (ABI changed: 'freebsd:10:x86:64' -> 'freebsd:11:x86:64') unixODBC-2.3.4 (ABI changed: 'freebsd:10:x86:64' -> 'freebsd:11:x86:64') ttcp-1.12_1 (ABI changed: 'freebsd:10:x86:64' -> 'freebsd:11:x86:64') tmux-2.3 (ABI changed: 'freebsd:10:x86:64' -> 'freebsd:11:x86:64') ... Number of packages to be installed: 25 Number of packages to be upgraded: 68 Number of packages to be reinstalled: 205 The process will require 40 MiB more space. Proceed with this action? [y/N]: y [eastern01.cello.com] [1/298] Installing tpm-emulator-0.7.4_1... ===> Creating groups. Using existing group '_tss'. ===> Creating users Using existing user '_tss'. [blackbox@mars.com] [1/298] Extracting tpm-emulator-0.7.4_1: 100% [blackbox@mars.com] [2/298] Deinstalling p5-Moo-2.002004... [blackbox@mars.com] [2/298] Deleting files for p5-Moo-2.002004: 100% [blackbox@mars.com] [3/298] Reinstalling xextproto-7.3.0... ...
Finally let’s upgrade any cpan modules we have installed in the jail.
$ cpan-outdated | cpanm --> Working on I/IB/IBB/Acme-Damn-0.08.tar.gz Fetching http://www.cpan.org/authors/id/I/IB/IBB/Acme-Damn-0.08.tar.gz ... OK Configuring Acme-Damn-0.08 ... OK Building and testing Acme-Damn-0.08 ... OK Successfully installed Acme-Damn-0.08 --> Working on K/KA/KAZEBURO/Apache-LogFormat-Compiler-0.33.tar.gz Fetching http://www.cpan.org/authors/id/K/KA/KAZEBURO/Apache-LogFormat-Compiler-0.33.tar.gz ... OK Configuring Apache-LogFormat-Compiler-0.33 ... OK Building and testing Apache-LogFormat-Compiler-0.33 ... OK Successfully installed Apache-LogFormat-Compiler-0.33 --> Working on B/BI/BINGOS/Archive-Tar-2.24.tar.gz Fetching http://www.cpan.org/authors/id/B/BI/BINGOS/Archive-Tar-2.24.tar.gz ... OK Configuring Archive-Tar-2.24 ... OK Building and testing Archive-Tar-2.24 ... OK Successfully installed Archive-Tar-2.24 ...
All done!