← Back to the Blog

How to: upgrade FreeBSD STABLE to CURRENT

NOTE:

  • As a part of this procedure we will take system down and reboot from a new kernel,
  • long-running steps can be saffely executed on running take needed pre-steps

do a backup first

following best practices, do a backup upgrade your TEST/DEV environment first

  • If running root from ZFS, do snapshot backup first:
    assuming we are running OS from a ZFS pool called zfsroot
zfs snapshot zfsroot@$(hostname)-$(uname-r)-$(date +%F)

optionaly, backup config in /etc/


get latest source code tree from SVN:

mkdir -p /stage/distr/freebsd
cd /stage/freebsd
svnlite co http://svn.freebsd.org/base/head

this will take some time, deoending on speed of your internet connection


recompile and install new kernel and userland

  • remove any leftovers in /usr/obj (optional step)
cd /usr/ && mv obj obj.old && mkdir obj && rm -rf obk.old
  • now let’s rebuild system from sources (the longest part of a whole procedure)

as root@builder

cd head 
time make -j8 buildworld buildkernel 1>/tmp/build-CURRENT-$(date +%F).log 2>&1 &

check logs for errors and reboot upgraded system

below steps require downtime:

stop running services, then install new kernel and userland:

make -j8 installkernel installworld  
reboot

perform healthcheck and smoketest on new system

  • check /var/log/messages for errors
  • upgrade ports and packages
pkg update 
pkg upgrade
  • check common functionality
  • restore (etc) and other customization (if needed)

delete snapshot backup (optional)

based on above regression testing results

  • delete snapshot to not keep all delta (optional)

OR

  • rollback from the backup snapshot, taken in a backup part
zfs rollback zfsroot@$(hostname)-$(uname-r)-$(date +%F)

Be the first to reply