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.
0. Take a beadm snapshot if you use boot environments.
bectl create (uname -r)-(date +%Y-%m-%d_%H%M%S)
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.
mv /boot/kernel /boot/kernel.old
3. Extract the kernel
tar -C / -xvpf kernel.txz
4. Reboot into the new kernel
shutdown -r now
5. Extract base.txz
, but 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
shutdown -r now
These steps can mostly be scripted. 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.