Running pkgbasify on a FreeBSD 15.0 host to convert a jail

Not long ago, I ran pkgbasify on a FreeBSD 15.0 jail – this time I’m going to do it slightly differently. I’m going to run the script on the host.

In this post:

  • FreeBSD 15.0
  • the jail is named dns1
  • I’ll use the variable MYJAIL to make your copy/paste easier and my future runs easier

Following the instructions at https://github.com/FreeBSDFoundation/pkgbasify I did the following.

Download

[23:03 r730-01 dvl ~/bin] % fetch https://github.com/FreeBSDFoundation/pkgbasify/raw/refs/heads/main/pkgbasify.lua
pkgbasify.lua                                           21 kB 5699 kBps    00s
[23:03 r730-01 dvl ~/bin] % chmod +x ./pkgbasify.lua

Prepare the jail

Based on previous runs, I added the following to my jail configuration and restarted the jail:

# added for pkgbasify
allow.chflags;
securelevel = -1;

Snapshot the jail

[23:12 r730-01 dvl ~/bin] % sudo zfs snapshot data02/jails/dns1@before.pkgbasify
[23:12 r730-01 dvl ~/bin] % 

Run the script

[23:13 r730-01 dvl ~/bin] % export MYJAIL=dns1
[23:13 r730-01 dvl ~/bin] % sudo ./pkgbasify.lua --jail $MYJAIL                
Running this tool will irreversibly modify your system to use pkgbase.
This tool and pkgbase are experimental and may result in a broken system.
It is highly recommended to backup your system before proceeding.
Do you accept this risk and wish to continue? (y/n) y
Updating FreeBSD-base repository catalogue...
FreeBSD-base repository is up to date.
Updating local repository catalogue...
Fetching meta.conf: 100%     179 B   0.2 kB/s    00:01    
Fetching data: 100%   378 KiB 386.6 kB/s    00:01    
Processing entries: 100%
local repository update completed. 1119 packages processed.
All repositories are up to date.
Checking integrity... done (0 conflicting)
Your packages are up to date.
Updating FreeBSD-ports repository catalogue...
Fetching meta.conf: 100%     179 B   0.2 kB/s    00:01    
Fetching data: 100%    11 MiB  11.2 MB/s    00:01    
Processing entries: 100%
FreeBSD-ports repository update completed. 37824 packages processed.
Updating FreeBSD-ports-kmods repository catalogue...
Fetching meta.conf: 100%     179 B   0.2 kB/s    00:01    
Fetching data: 100%    35 KiB  35.6 kB/s    00:01    
Processing entries: 100%
FreeBSD-ports-kmods repository update completed. 239 packages processed.
Updating FreeBSD-base repository catalogue...
Fetching meta.conf: 100%     179 B   0.2 kB/s    00:01    
Fetching data: 100%    82 KiB  84.0 kB/s    00:01    
Processing entries: 100%
FreeBSD-base repository update completed. 509 packages processed.
All repositories are up to date.
Creating /jails/dns1/usr/local/etc/pkg/repos/FreeBSD-base.conf
Updating FreeBSD-base repository catalogue...
Fetching meta.conf: 100%     179 B   0.2 kB/s    00:01    
Fetching data: 100%    81 KiB  82.5 kB/s    00:01    
Processing entries: 100%
FreeBSD-base repository update completed. 496 packages processed.
FreeBSD-base is up to date.
The following 311 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        FreeBSD-acct: 15.0 [FreeBSD-base]
        FreeBSD-acpi: 15.0 [FreeBSD-base]
        FreeBSD-apm: 15.0 [FreeBSD-base]
...
        FreeBSD-zoneinfo: 15.0p7 [FreeBSD-base]

Number of packages to be installed: 311

The process will require 994 MiB more space.
325 MiB to be downloaded.
[  1/311] Fetching FreeBSD-libmilter-dev-15.0p10: 100%    86 KiB  87.8 kB/s    00:01    
[  2/311] Fetching FreeBSD-libsqlite3-dev-15.0: 100%  2144 KiB   2.2 MB/s    00:01    
[  3/311] Fetching FreeBSD-libldns-dev-15.0p10: 100%   669 KiB 684.8 kB/s    00:01    
[  4/311] Fetching FreeBSD-tcpd-15.0: 100%    44 KiB  44.6 kB/s    00:01    
...
[311/311] Fetching FreeBSD-ctf-dev-15.0: 100%   138 KiB 141.6 kB/s    00:01    
Checking integrity... done (0 conflicting)
Checking integrity... done (0 conflicting)
The following 311 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        FreeBSD-acct: 15.0 [FreeBSD-base]
        FreeBSD-acpi: 15.0 [FreeBSD-base]
        FreeBSD-apm: 15.0 [FreeBSD-base]
        FreeBSD-at: 15.0 [FreeBSD-base]
        FreeBSD-atf: 15.0 [FreeBSD-base]
        FreeBSD-atf-dev: 15.0 [FreeBSD-base]
        FreeBSD-atf-lib: 15.0 [FreeBSD-base]
        FreeBSD-audit: 15.0p10 [FreeBSD-base]
        FreeBSD-audit-dev: 15.0 [FreeBSD-base]
        FreeBSD-audit-dev-lib32: 15.0 [FreeBSD-base]
        FreeBSD-audit-lib: 15.0 [FreeBSD-base]
        FreeBSD-audit-lib32: 15.0 [FreeBSD-base]
        FreeBSD-autofs: 15.0 [FreeBSD-base]
        FreeBSD-bhyve: 15.0 [FreeBSD-base]
        FreeBSD-blocklist: 15.0p3 [FreeBSD-base]
        FreeBSD-blocklist-dev: 15.0 [FreeBSD-base]
 ...
        FreeBSD-zlib-lib32: 15.0 [FreeBSD-base]
        FreeBSD-zoneinfo: 15.0p7 [FreeBSD-base]

Number of packages to be installed: 311

The process will require 994 MiB more space.
[  1/311] Installing FreeBSD-acct-15.0...
[  2/311] Installing FreeBSD-acpi-15.0...
[  3/311] Installing FreeBSD-apm-15.0...
[  4/311] Installing FreeBSD-atf-15.0...
...
[311/311] Installing FreeBSD-set-tests-15.0...
Checking integrity... done (0 conflicting)
The following 311 package(s) will be affected (of 0 checked):

Installed packages to be REINSTALLED:
        FreeBSD-acct-15.0 [FreeBSD-base]
        FreeBSD-acpi-15.0 [FreeBSD-base]
        FreeBSD-apm-15.0 [FreeBSD-base]
        FreeBSD-at-15.0 [FreeBSD-base]
...
        FreeBSD-zoneinfo-15.0p7 [FreeBSD-base]

Number of packages to be reinstalled: 311
[  1/311] Reinstalling FreeBSD-acct-15.0...

...

[310/311] Extracting FreeBSD-tests-dbg-15.0p11: 100%
[311/311] Reinstalling FreeBSD-set-tests-15.0...
==> Running trigger: mandoc.ucl
=====
Message from FreeBSD-local-unbound-15.0p10:

--
After upgrading local-unbound, the configuration file should be regenerated
by running "service local_unbound setup" before restarting the service.
Conversion finished.

Please verify that the contents of the following critical files are as expected:
/jails/dns1/etc/master.passwd
/jails/dns1/etc/group
/jails/dns1/etc/ssh/sshd_config

After verifying those files, restart the system.

I looked at those first three files. Seemed OK.

Then I restarted sshd in that jail, just to be sure.

[23:20 r730-01 dvl ~/bin] % sudo jexec $MYJAIL service sshd restart
Performing sanity check on sshd configuration.
Stopping sshd.
Waiting for PIDS: 98398.
Performing sanity check on sshd configuration.
Starting sshd.

After restarting that jail, I confirmed it was done:

[23:21 r730-01 dvl ~/bin] % sudo pkg -j $MYJAIL which /usr/bin/uname
/usr/bin/uname was installed by package FreeBSD-runtime-15.0p11

Now I can update that jail to FreeBSD 15.1 via pkgbase.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top