Updating FreeBSD the Manual Way

A few years ago I stopped updating my FreeBSD servers the standard way and instead follow the same method that I use in mkjail.sh

freebsd-update is a fine tool, but it's long past its expiration date. The original purpose was to save bandwidth and only ship binary diffs to clients, but bandwidth is not a common issue anymore. The main issue is that freebsd-update requires making thousands of HTTP requests which can take a long time if the update server has high latency and we aren't quite ready for a full rollout of pkgbase yet. So here's the cheat code to fast updates.

1. Download the base.txz, src.txz, and kernel.txz for your target RELEASE.

2. Move /boot/kernel to /boot/kernel.old; you may have to clear out old kernels first.

3. Extract the kernel

tar -C / -xvpf kernel.txz

4. Reboot into the new kernel.

5. Extract base.txz, do not clobber /etc

tar -C / --exclude=etc --clear-nochange-fflags -xvpf base.txz

6. Extract src.txz. Clean out /usr/src first if you have to.

tar -C / -xzvpf src.txz

7. Run etcupdate

cd /usr/src
etcupdate

8. Run your pkg upgrades

pkg upgrade

9. Clean out old libs and files that were removed since the update

cd /usr/src
yes | make delete-old
yes | make delete-old-libs

10. Reboot

This can mostly be scripted, which I do. I can update a server completely in a couple minutes. I don't know of any Linux distro that can do a major upgrade this fast.

freebsd