How To Upgrade FreeBSD To New Release

last updated in Categories , ,

Q. I’ve custom compile kernel and I’d like to upgrade my system to latest stable release. How do I upgrade FreeBSD to new release without using freebsd-update binary tool?

A. If you have custom kernel installed freebsd-update will not work. The procedure for doing a source code based update is described below.

Step # 1: Grab latest source code

You need to use csup, which is a software package for updating collections of files across a network. First, copy config a file to /root, type:
# cp /usr/share/examples/cvsup/standard-supfile /root/supfile
Open /root/supfile, type:
# vi /root/supfile
Find the line that read as follows:
Change to (you can find cvsup mirror list here) :
Make sure tag is set to tag=RELENG_7_1 (for latest FreeBSD 7.1 release)
*default release=cvs tag=RELENG_7_1
Here is my sample /root/supfile file:

*default base=/var/db
*default prefix=/usr
*default release=cvs tag=RELENG_7_1
*default delete use-rel-suffix
*default compress

To grab update, enter:
# cvsup /root/supfile

Step #2: Build the base system

Once you have synchronized your local source tree, you can then use the source tree to rebuild the base system. It is important that you always read /usr/src/UPDATING file to save time. This file carries important information regarding upgrade procedure including known issues, bugs and workaround.
# vi /usr/src/UPDATING
Once you are aware of all issues, first build base system, enter:
# cd /usr/src
# make buildworld

Step #3: Build the FreeBSD kernel

Next, build and install the FreeBSD kernel using the following syntax:
# make buildkernel
# make installkernel

To build and install custom kernel named foo, enter:
# make buildkernel KERNCONF=foo
# make installkernel KERNCONF=foo

Finally, reboot the server, enter:
# reboot

Boot into a single user mode

You need to boot FreeBSD into a single user mode type boot -s at the loader prompt:
boot -s
Mount file system and run mergemaster, enter:
# mount -a -t ufs
# mergemaster -p

Accept the changes as promoted as per your configuration.

Step # 4: Install base system and libraries

Type the following command, enter:
# cd /usr/src
# make installworld

Finally, merge your configuration files, enter:
# mergemaster -i
You are now done with first stage, just reboot the system:
# reboot

Verify everything is working

See system log files and make sure everything is working properly, enter:
# uname -a
# tail -f /var/log/messages
# tail -f /path/to/other/log/files
# sockstat

Step # 5: Update FreeBSD Applications

Finally, update all installed applications such as Apache, postfix and others, enter:
# portsnap fetch update
To upgrade all installed FreeBSD ports / applications, enter:
# portversion -l '<' # portupgrade -a


Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

4 comment

  1. You might wanna call that second #2 as it is supposed to: #3 and fix kernel:
    Step #2: Build the FreeBSD kerenl
    I noticed that when I added it to my kb, author is still mentioned tho ;)

    Thanks, this helped me out bigtime !

    Still, have a question? Get help on our forum!