FreeBSD

Update Kernel FreeBSD

FreeBSD is one of the many operating systems in the Berkeley Software Distribution family, which includes OpenBSD, NetBSD, DragonFly BSD, to name a few. FreeBSD shares quite a few similarities with Linux; the core difference between the two is that unlike Linux, FreeBSD comes as complete with the kernel, drivers, as well as system software. With every new release, FreeBSD gets new features to make the kernel more performance efficient.

This post demonstrates how to upgrade FreeBSD version 11.x to v12.

Upgrade FreeBSD v11 to v12

Step 1: Prerequisites

To see what version you’re currently using, issue the command below:

$ freebsd-version
$ uname -mrs

The output reveals we’re using version 12.2 as the latest, but the following commands let you upgrade the kernel anyway. Next, type in the command below, and press enter:

$ freebsd-update fetch install

Then, use the pkg command to update any or all packages.

$ pkg update && pkg upgrade

Step 2: Upgrade FreeBSD using the Binary Method

Use the freebsd-update command below to update using the binary method:

$ freebsd-update -r 12.2-RELEASE upgrade

The command above examines the configuration file. It’ll ask permission to make changes, so press y when it does.

With the downloads and configurations are taken care of, we’ll now change the disk properties. Enter the command below:

$ freebsd-update install

Then restart the system:

$ reboot

Upon a successful reboot, make sure the system is back online and use the command below to get rid of the old files and continue with the upgrade:

$ freebsd-update install

With the base system updated, update all the binary packages with the command below:

$ pkg-static install -f pkg

$ pkg update && pkg upgrade

Then check the following directory:

$ sudo /usr/sbin/freebsd-update install

Step 3: Verifying the Update

First, verify if every service is active:

$ ps aux
$ sockstat -l
$ sockstat -4
$ sockstat -6
$ netstat -a -n | grep LISTEN
$ top

Make sure the log file isn’t encountering any errors while using the various command line utilities:

$ tail -f /var/log/messages

$ grep error /path/to/app
$ egrep -i 'err|warn|cri' /var/log/messages

Check the current version:

$ uname -mrs
$ freebsd-version

Wrapping up

This post illustrated how to upgrade FreeBSD v11 to 12 with the binary package method. Although FreeBSD 11.2 has not ended its support, it is better to upgrade to version 12. With every upgrade, the FreeBSD kernel is made more resource-efficient and faster.

About the author

Younis Said

I am a freelancing software project developer, a software engineering graduate and a content writer. I love working with Linux and open-source software.