Upgrade & Update FreeBSD

27 Aug 2020

My short cheat sheet for upgrading FreeBSD server. This is only for the GENERIC kernel, for a custom kernel there are more to it. For more in-depth reading see the FreeBSD handbook.

Upgrade minor/major releases

freebsd-update -r 12.1-RELEASE upgrade

where 12.1-RELEASE is the release to upgrade to.

You will need to confirm that the identified components is correct, and then it will just continue to download patches.

src component not installed, skipped
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching metadata signature for 12.0-RELEASE from update4.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata files... done.
Inspecting system... done.

The following components of FreeBSD seem to be installed:
kernel/generic kernel/generic-dbg world/base world/doc world/lib32

The following components of FreeBSD do not seem to be installed:
world/base-dbg world/lib32-dbg

Does this look reasonable (y/n)? y

Fetching metadata signature for 12.1-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 12.0-RELEASE for merging... done.
Preparing to download files... done.
Fetching 10468 patches...
<lots of numbers and dots here>

After this you will get a review and accept the changes, this is different depending on the patches and version.

When all changes are reviewed it is time to install them

freebsd-update install

and it may ask for a reboot and then you need to run freebsd-update install again.

Upgrade packages after Major upgrade

On minor upgrades packages mostly still works. But on Major upgrades the ABI changes, so the packages need to be upgraded. Using pkg update will update packages, but because some installed packages can still be on the same version it needs to be a forced update so a new clean package built for the current version will be downloaded

pkg update -f

Following the handbook ports are upgraded using portmaster (or other similar tool)

portmaster -af

include the -G parameter to skip the configure dialogs that will pop using above command.

Finally run freebsd-update one last time to make sure everything is updated

freebsd-update install