Updating/Upgrading OpenBSD

Some related resources may include:

This rest of this guide is rather old, and OpenBSD has started to offer some simplified ways to upgrade (at least with some ports). At the time of this writing (2019-Oct-7), this guide recommends not relying upon this guide until first checking out if newer solutions will make things better...

File status: This file has a rather complete initial/first/rough draft. (A few changes were made since the last pass through these instructions: it is not expected that these changes will have broken the process.)

sudo usage (without prompting)

There may be some references to being root for some of the steps.

Some of these directions may involve using the sudo command. This command likely isn't needed if all processes are being done in root. (Simply by removing the word sudo from the examples, the commands could be run as the “root” superuser without using sudo. However, using sudo (when run as an authorized user) won't be causing any harm, as long as it doesn't prompt the user (which does not happen if the -n switch is used). One may safely count on having sudo available in a standard installation, since these upgrade directions are designed for OpenBSD which does come with sudo pre-installed.)

Write-access: make sure that any mount points being referenced are mounted as read-write.

Overview of options: Choosing whether to interact with the source code

Not every single approach has to involve directly using source code on the machine that is updated. This guide shows this fact by including details of methods that do, or may, involve no involvement with the source code. However, the most recommended approach to apply updates (provided directly by the OpenBSD team) will be to upgrade to to the latest installation binaries (for the “-release” version if using “-release” or “-stable”, or the snapshots binaries if the plan is to use “-current”) if that hasn't yet been done, and installing the compiler tools while performing any such upgrade. Then, the recommended approach is to proceed with the section that shows details about how to be using the source code.

(The rest of this section provides some of the reasoning why this was the most recommended approach, for any who may be curious about this recommendation.)

OpenBSD FAQ 10.15: the section on “Applying patches in OpenBSD” says, “Mixing and matching of patching solutions can be done if you understand how everything works, but new users should pick one method and stick with it.” Following this advice strictly could result in a user never using the “-stable” branch (if the chosen method is to use official binary-level upgrades). This guide recommends using multiple methods, so that “-stable” may be reached. It is a good idea to at least know there are multiple methods, and is probably a good idea and to use just one method at a time. (This guide will help make that happen.)

The first generally recommendable step is to make sure the version of OpenBSD is not older than the latest official “-release” version. (If the installed version of OpenBSD is older than that, then, unsurprisingly, the next step (after checking the version) is to proceed with ugprading to the latest official “-release” version.) Details about performing such upgrade(s) is in the section about upgrading to a new “-release” OpenBSD version.

To upgrade beyond just the latest “-release” version, the most recommended options will generally be involving using compiling tools and source code for the operating system, as well as additional source code.

As an example of why interaction with source code may be worth pursuing, simple updates can be achieved by applying patches from the published errata. These patches may fix known serious errors, and/or contain updates designed to apply stability to the operating system (including the boot files and other included software) even if the error hasn't yet been proven to be terribly serious. OpenBSD FAQ 10.15: the section on “Applying patches in OpenBSD” says that “Patches for the OpenBSD Operating System” ... “are NOT distributed in binary form. This means that to patch your system you must have the source code from the RELEASE version of OpenBSD readily available. In general, you should have the entire source tree available.”

Updating OpenBSD without using source code

See the section about Updating/Upgrading OpenBSD w/o interacting with source code.

Updating OpenBSD by using source code
Updating/upgrading OpenBSD using source code