Skip to main content.

Keeping your BSD up to date


Live demo in BSD Now Episode 043. Originally written by TJ for | Last updated: 2014/06/25

NOTE: the author/maintainer of the tutorial(s) is no longer with the show, so the information below may be outdated or incorrect.

Whether you've got a single laptop or a whole cluster of servers, keeping your system(s) up to date and patched is critical. Fortunately, it's pretty simple to do so in most of the BSDs. This tutorial will show you how to keep both the base system and third party applications up to date on both FreeBSD and OpenBSD.


By now, you've probably learned the difference between -RELEASE, -STABLE and -CURRENT. Today we're assuming you are just following the normal -RELEASE branch. To patch your base system patched for security and errata, simply do:

# freebsd-update fetch install

Looking up mirrors... 5 mirrors found.
Fetching metadata signature for 9.2-RELEASE from done.
Fetching metadata index... done.
Inspecting system... done.
Preparing to download files... done.

And with that, you're patched. You may need to restart services or reboot the system, depending on what was upgraded. Please take note of which versions are supported. If you wanted to jump from one major version to another, the freebsd-update command also does that.

# freebsd-update upgrade -r 10.0-RELEASE

This works for -BETA, -RCx and -RELEASE versions. If you want -STABLE or -CURRENT, consult the previously-mentioned tutorial. During this upgrade process, you will be asked to merge configuration files and reboot twice. Maybe binary upgrades aren't your thing though, or you want to customize part of the system you're using. In that case, the traditional source-based method of upgrading might be better for you. We'll show the same two scenarios as before. This will assume you don't have the source code in /usr/src already. You will need subversion installed for this process. We'll be using 10.0-RELEASE as the example, so change that to whatever version you're running.

# rm -rf /usr/src
# svn co /usr/src

This will give you an up-to-date source tree for 10.0-RELEASE, including all security patches. To upgrade your source tree in the future, just run:

# svn update /usr/src

If the kernel was affected and needs rebuilding, do:

# cd /usr/src
# make -j `sysctl -n hw.ncpu` buildkernel  ## Add "KERNCONF=yourkernelname" if you did a custom kernel.
# make installkernel                       ## Add "KERNCONF=yourkernelname" if you did a custom kernel.
# cd /usr/obj && chflags -R noschg * && rm -rf *
# reboot

Or if a part of the userland was vulnerable:

# cd /usr/src
# make -j `sysctl -n hw.ncpu` buildworld
# make installworld
# cd /usr/obj && chflags -R noschg * && rm -rf *

A reboot may or may not be needed, depending on what was changed. Be sure to read the security advisory for more information about any services that might need to be restarted. So how do you know when you need to update your system? Subscribe to the announce list and get notified automatically! It's that easy. You've also probably learned about ports, packages and even building your own repository, so how do updates tie into all of those? You have a number of options. Each of those tutorials goes into detail about staying up to date, so choose the one that matches what you're using.


Likewise, OpenBSD has different branches you can use. We'll assume you're running the normal -release branch here. Security fixes and other major problems are fixed via errata patches. Usually, you'll only need to recompile one thing per errata patch, instead of the whole userland. This has the benefit of taking a lot less time, but the downside is you have to actually read through each patch to know what needs to be updated. You can, of course, rebuild the whole userland if you want to. In this example, I'll fix a problem in the ftp command in 5.5. This is assuming you don't have the source code in /usr/src already.

# cd /usr/src
# ftp \ \
# signify -C -p /etc/signify/ -x SHA256.sig src.tar.gz
# signify -C -p /etc/signify/ -x SHA256.sig sys.tar.gz
# tar xzf src.tar.gz
# tar xzf sys.tar.gz
# rm src.tar.gz sys.tar.gz SHA256.sig

Now that we have the source code for both the userland and kernel, we can download the errata patch and apply it.

# cd /usr/src
# ftp

After checking the patch, we learn that the next steps are:

# signify -Vep /etc/signify/ -x 003_ftp.patch.sig -m - | (cd /usr/src && patch -p0)
# cd /usr/src/usr.bin/ftp
# make obj
# make
# make install
# rm -rf /usr/obj/* /usr/src/003_ftp.patch.sig

Each errata patch will have different instructions, so be sure to read them carefully. Errata patches are announced on the announce list, so subscribe to that. You can also set up a cron job to monitor the errata page for changes. Major version upgrades in OpenBSD are handled a bit differently than FreeBSD. Instead of a tool to upgrade the system, you download the new "bsd.rd" ramdisk kernel and boot from that. Once booted, it presents you with an "(U)pgrade" option for going to the next version. As an example, going from 5.4 to 5.5, we'll do so now. 5.4 didn't actually have the signify command yet, but let's pretend it did.

# ftp -o /bsd.rd`machine`/bsd.rd
# ftp`machine`/SHA256.sig
# signify -C -p /etc/signify/ -x SHA256.sig /bsd.rd
# rm SHA256.sig
# reboot

You will need console or VGA access at this point. It's possible to jump versions over SSH, but doing so is a bit more involved. At the boot prompt, type "bsd.rd" and hit enter. The "(U)pgrade" option will do most of the work for you at this point, but there are usually more steps involved. You'll need to merge the /etc sets with sysmerge upon a successful reboot. Be sure to read the upgrade guide for your release before attempting an upgrade. It will detail all the specific steps needed, including any workarounds. It also includes the upgrade method for remote systems without console access. Finally, check our ports and packages tutorial for the details on keeping third party software up to date.

Latest News

New announcement


We understand that Michael Dexter, Brad Davis, and George Rosamond think there should be more real news....

Two Year Anniversary


We're quickly approaching our two-year anniversary, which will be on episode 105. To celebrate, we've created a unique t-shirt design, available for purchase until the end of August. Shirts will be shipped out around September 1st. Most of the proceeds will support the show, and specifically allow us to buy...

New discussion segment


We're thinking about adding a new segment to the show where we discuss a topic that the listeners suggest. It's meant to be informative like a tutorial, but more of a "free discussion" format. If you have any subjects you want us to explore, or even just a good name...

How did you get into BSD?


We've got a fun idea for the holidays this year: just like we ask during the interviews, we want to hear how all the viewers and listeners first got into BSD. Email us your story, either written or a video version, and we'll read and play some of them for...

Episode 267: Absolute FreeBSD


Direct Download:MP3 AudioVideo Headlines Interview - Michael W. Lucas - / @mwlauthor BR: [Welcome Back] AJ: What have you been doing since last we talked to you [ed, ssh, and af3e] BR: Tell us more about AF3e AJ: How did the first Absolute FreeBSD come about? BR: Do you have anything special planned for MeetBSD? AJ: What...

Episode 266: File type history


Direct Download:MP3 AudioVideo Headlines OpenBSD/NetBSD on FreeBSD using grub2-bhyve When I was writing a blog post about the process title, I needed a couple of virtual machines with OpenBSD, NetBSD, and Ubuntu. Before that day I mainly used FreeBSD and Windows with bhyve. I spent some time trying to set up...

Episode 265: Software Disenchantment


Direct Download:MP3 AudioVideo Headlines [FreeBSD DevSummit & EuroBSDcon 2018 in Romania] Your hosts are back from EuroBSDcon 2018 held in Bucharest, Romania this year. The first two days of the conference are used for tutorials and devsummits (FreeBSD and NetBSD), while the last two are for talks. Although Benedict organized the devsummit in large...

Episode 264: Optimized-out


Direct Download:MP3 AudioVideo This episode was brought to you by Headlines FreeBSD & DragonFlyBSD Put Up A Strong Fight On AMD's Threadripper 2990WX, Benchmarks Against Linux The past two weeks I have been delivering a great deal of AMD Threadripper 2990WX benchmarks on Linux as well as some against Windows and Windows...