Couple of months ago I got my sister a MacBook Air with the new M4 chip, and she was happier than ever. However, I was the happiest, as she gave me her old MacBook Pro 2015.
As always, I installed FreeBSD on it, it was FreeBSD 14.2-RELEASE at the time, installed the required drivers, attached a Thunderbolt 3 to Ethernet adapter to it (thank you to whoever made it work via the bge
drivers) and… nothing. It’s been sitting on the floor for months now.
Last week I decided I’m going to do my FreeBSD work again. I have a todo list with 20+ action items in them.
But first thing first, I need a -CURRENT machine so I can do my development.
So, here’s a simple guid on how to migrate to FreeBSD -CURRENT using PkgBase.
First we need to setup the pkgbase repo, so pkg
can use it. I will be using pkg.FreeBSD.am
, which is my regional pkg cache, but other than that, everything is pretty standard.
root@mbp15srv0:~ # mkdir -p /usr/local/etc/pkg/repos
root@mbp15srv0:~ # cat - > /usr/local/etc/pkg/repos/FreeBSD-base.conf
FreeBSD-base {
url = "pkg+https://pkg.freebsd.am/FreeBSD:15:amd64/base_latest/";
mirror_type = "srv";
signature_type = "fingerprints";
fingerprints = "/usr/share/keys/pkg";
enabled = yes;
}
Next up, we create and mount a Boot Environment, that way, if we screw something up, we can always come back.
root@mbp15srv0:~ # bectl list
BE Active Mountpoint Space Created
default NR / 2.99G 2025-04-20 22:45
root@mbp15srv0:~ # bectl create 15.0-CURRENT-pkgbase
root@mbp15srv0:~ # bectl mount 15.0-CURRENT-pkgbase
/tmp/be_mount.6i35
But before we start, let’s make sure we’re on the latest version of pkg
, since the devs keep adding cool features for PkgBase.
root@mbp15srv0:~ # pkg install pkg
Updating FreeBSD.am repository catalogue...
Fetching meta.conf: 0%
FreeBSD.am repository is up to date.
Updating FreeBSD-base repository catalogue...
Fetching meta.conf: 0%
FreeBSD-base 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: 2.1.2 -> 2.1.4 [FreeBSD.am]
Number of packages to be upgraded: 1
12 MiB to be downloaded.
Proceed with this action? [y/N]: y
[1/1] Fetching pkg-2.1.4.pkg: 100% 12 MiB 12.5MB/s 00:01
Checking integrity... done (0 conflicting)
[1/1] Upgrading pkg from 2.1.2 to 2.1.4...
[1/1] Extracting pkg-2.1.4: 100%
Updating FreeBSD.am repository catalogue...
Fetching meta.conf: 0%
FreeBSD.am repository is up to date.
Updating FreeBSD-base repository catalogue...
Fetching meta.conf: 0%
FreeBSD-base repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The most recent versions of packages are already installed
We need to do pkg update
so we get the repo metadata. We’ll also set the ABI
to 15, since we’ll be installing that.
root@mbp15srv0:~ # env ABI="FreeBSD:15:amd64" pkg update -f -r FreeBSD-base
pkg: Setting ABI requires setting OSVERSION, guessing the OSVERSION as: 1500000
pkg: Warning: Major OS version upgrade detected. Running "pkg bootstrap -f" recommended
Updating FreeBSD-base repository catalogue...
pkg: Repository FreeBSD-base has a wrong packagesite, need to re-create database
Fetching meta.conf: 100% 179 B 0.2kB/s 00:01
Fetching data.pkg: 100% 52 KiB 53.2kB/s 00:01
Processing entries: 0%
Newer FreeBSD version for package FreeBSD-zoneinfo:
To ignore this error set IGNORE_OSVERSION=yes
- package: 1500043
- running userland: 1500000
Ignore the mismatch and continue? [y/N]: y
Processing entries: 100%
FreeBSD-base repository update completed. 554 packages processed.
FreeBSD-base is up to date.
Now we can do the installation using -r
, which will set the root directory. I’m also using -Fy
which will fetch-only, and assume yes for everything.
root@mbp15srv0:~ # env ABI="FreeBSD:15:amd64" pkg -r /tmp/be_mount.6i35/ install -Fy -r FreeBSD-base -g 'FreeBSD-*'
pkg: Setting ABI requires setting OSVERSION, guessing the OSVERSION as: 1500000
pkg: Warning: Major OS version upgrade detected. Running "pkg bootstrap -f" recommended
Updating FreeBSD-base repository catalogue...
Fetching meta.conf: 0%
FreeBSD-base repository is up to date.
FreeBSD-base is up to date.
The following 554 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
FreeBSD-acct: 15.snap20250612001522 [FreeBSD-base]
FreeBSD-acct-dbg: 15.snap20250612001522 [FreeBSD-base]
FreeBSD-acct-man: 15.snap20241026125659 [FreeBSD-base]
FreeBSD-acpi: 15.snap20250612160001 [FreeBSD-base]
FreeBSD-acpi-dbg: 15.snap20250612160001 [FreeBSD-base]
[...]
FreeBSD-zfs-dev-lib32: 15.snap20250612160001 [FreeBSD-base]
FreeBSD-zfs-lib32: 15.snap20250612160001 [FreeBSD-base]
FreeBSD-zfs-man: 15.snap20250531144220 [FreeBSD-base]
FreeBSD-zoneinfo: 15.snap20250521200023 [FreeBSD-base]
Number of packages to be installed: 554
The process will require 6 GiB more space.
1 GiB to be downloaded.
[1/507] Fetching FreeBSD-kernel-minimal-15.snap20250613001933.pkg: 100% 39 MiB 861.9kB/s 00:47
[...]
[371/484] Fetching FreeBSD-smbutils-dev-lib32-15.snap20250612160001.pkg: 100% 86 KiB 87.8kB/s 00:01
[372/484] Fetching FreeBSD-libsqlite3-dbg-lib32-15.snap20250612160001.pkg: 100% 1 MiB 1.2MB/s 00:01
Checking integrity... done (0 conflicting)
And finally, I can do the actual installation. Again, not forgetting about ABI, and BACKUP_LIBRARIES
with BACKUP_LIBRARY_PATH
.
root@mbp15srv0:~ # env ABI="FreeBSD:15:amd64" BACKUP_LIBRARIES=true BACKUP_LIBRARY_PATH=/tmp/be_mount.6i35/usr/local/lib/compat/pkg pkg -r /tmp/be_mount.6i35/ install
-Uy -r FreeBSD-base -g 'FreeBSD-*'
pkg: Setting ABI requires setting OSVERSION, guessing the OSVERSION as: 1500000
pkg: Warning: Major OS version upgrade detected. Running "pkg bootstrap -f" recommended
Checking integrity... done (0 conflicting)
The following 554 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
FreeBSD-acct: 15.snap20250612001522 [FreeBSD-base]
FreeBSD-acct-dbg: 15.snap20250612001522 [FreeBSD-base]
FreeBSD-acct-man: 15.snap20241026125659 [FreeBSD-base]
[...]
Number of packages to be installed: 554
The process will require 6 GiB more space.
[1/554] Installing FreeBSD-acct-15.snap20250612001522...
[1/554] Extracting FreeBSD-acct-15.snap20250612001522: 100%
[2/554] Installing FreeBSD-acct-dbg-15.snap20250612001522...
[2/554] Extracting FreeBSD-acct-dbg-15.snap20250612001522: 100%
[3/554] Installing FreeBSD-acct-man-15.snap20241026125659...
[3/554] Extracting FreeBSD-acct-man-15.snap20241026125659: 100%
[4/554] Installing FreeBSD-acpi-15.snap20250612160001...
[4/554] Extracting FreeBSD-acpi-15.snap20250612160001: 100%
[5/554] Installing FreeBSD-acpi-dbg-15.snap20250612160001...
[...]
[553/554] Installing FreeBSD-zfs-man-15.snap20250531144220...
[553/554] Extracting FreeBSD-zfs-man-15.snap20250531144220: 100%
[554/554] Installing FreeBSD-zoneinfo-15.snap20250521200023...
[554/554] Extracting FreeBSD-zoneinfo-15.snap20250521200023: 100%
Done!
Now we can chroot in and do some changes.
chroot /tmp/be_mount.6i35/ /bin/sh
We will see a lot of files ending with .pkgsave
, these are the old files. Some things are required for us, such as sshd_config
, master.passwd
, sysctl.conf
. Now, this is a pretty fresh installation, so I don’t need to do other changes, but you might!
root@mbp15srv0:/ # cp /etc/ssh/sshd_config.pkgsave /etc/ssh/sshd_config
root@mbp15srv0:/ # cp /etc/master.passwd.pkgsave /etc/master.passwd
root@mbp15srv0:/ # cp /etc/group.pkgsave /etc/group
root@mbp15srv0:/ # pwd_mkdb -p /etc/master.passwd
root@mbp15srv0:/ # cp /etc/sysctl.conf.pkgsave /etc/sysctl.conf
I think this is a good time to delete the other .pkgsave
files. The FreeBSD Wiki says that I also need to delete /boot/kernel/linker.hints
# find / -name '*.pkgsave' -delete
# rm /boot/kernel/linker.hints
Back on the host, outside the chroot, I can finally activate the BE, at least temporarily, so only for the next boot.
root@mbp15srv0:~ # bectl list
BE Active Mountpoint Space Created
15.0-CURRENT-pkgbase - /tmp/be_mount.6i35 4.62G 2025-06-13 13:05
default NR / 3.07G 2025-04-20 22:45
root@mbp15srv0:~ # bectl unmount 15.0-CURRENT-pkgbase
root@mbp15srv0:~ # bectl activate -t 15.0-CURRENT-pkgbase
Successfully activated boot environment 15.0-CURRENT-pkgbase
for next boot
root@mbp15srv0:~ # bectl list
BE Active Mountpoint Space Created
15.0-CURRENT-pkgbase T - 4.62G 2025-06-13 13:05
default NR / 3.07G 2025-04-20 22:45
A reboot… with fingers crossed!
shutdown -r now
The machine is up and running!
root@mbp15srv0:~ # uname -a
FreeBSD mbp15srv0.evn0.loc.illuriasecurity.com 15.0-CURRENT FreeBSD 15.0-CURRENT main-n277903-a14573de29de GENERIC amd64
Let’s make this BE the default now.
root@mbp15srv0:~ # bectl list
BE Active Mountpoint Space Created
15.0-CURRENT-pkgbase N / 4.62G 2025-06-13 13:05
default R - 3.08G 2025-04-20 22:45
root@mbp15srv0:~ # bectl activate 15.0-CURRENT-pkgbase
Successfully activated boot environment 15.0-CURRENT-pkgbase
root@mbp15srv0:~ # bectl list
BE Active Mountpoint Space Created
15.0-CURRENT-pkgbase NR / 7.54G 2025-06-13 13:05
default - - 666M 2025-04-20 22:45
Finally, I will re-install pkg
(not sure if that’s needed) and update my packages.
pkg bootstrap -f
pkg upgrade
All good! Now I can get to work 🙂
Special thanks to everyone who wrote the Wiki article and to ivy
on the FreeBSD IRC channel for answering my questions.
That’s all folks…