Back to Article Listing

Snapshots from the Edge

aka: Upgrading to the latest snapshot of OpenBSD

OpenBSD is the easiest and fastest upgrade of any OS I have run.



My Goal is to run the most current OpenBSD snapshot.

This is my choice and it may not be a good choice for you!

This is not to be considered a HOW-TO, definitive guide, or an advocacy for running cutting edge operating systems. These are just my notes on the steps I take to keep some of my boxen running the latest snapshot. There may be other ways of doing things, this is just my way. Please do not try this at home unless you understand what you are doing.

Introductory exerpts from OpenBSD's FAQ and Upgrade Guide

Between formal releases of OpenBSD, snapshots are made available through the FTP sites. As the name implies, these are builds of whatever code is in the tree at the instant the builder grabbed a copy of the code for that particular platform. Remember, on some platforms, it may be DAYS before the snapshot build is completed and put out for distribution. There is no promise that the snapshots are completely functional, or even install. Often, a change that needs to be tested may trigger snapshot creation. Some platforms have snapshots built on an almost daily basis, others will be much less frequent. If you desire to run -current, a recent snapshot is often all you need, and upgrading to a snapshot is a required starting point before attempting to build -current from source.

Note: Upgrades are only supported from one release to the release immediately following it. Do not skip releases.

It is highly recommended that you read through and fully understand this process before attempting it. If you are doing it on a critical or physically remote machine, it is recommended that you test this process on an identical, local system to verify its success before attempting on a critical or remote computer.

Upgrading is a convenient way to bring your OpenBSD system up to the most recent version. However, the results are not intended to precisely match the results of a wipe-and-reload installation. Old library files in particular are not removed in the upgrade process, as they may be required by older applications that may or may not be upgraded at this time. If you REALLY wish to get rid of all these old files, you would probably be better off reinstalling from scratch.

OpenBSD documentation is top notch. There is every reason to read the man pages, FAQs, and mailing list archives. These links take you away!

My Steps


I outline upgrading here so, it is assumed that you have a running OpenBSD installation. It is also assumed that you have a working network connection. I use the ftp mirror ( closet to me. Here is the link for other ways of Getting OpenBSD. Exact ftp locations listed here are 'as of this writing' and for my i386. Please note, your platform and current conditions may differ.

These steps are simple enough to repeat without notes, but I upgrade fairly often so, I actually wrote them into a small script that I copy to all the machines I admin. The only changes needed are: the release (twice a year) and the sets to download. Not all boxen get all sets. e.g. firewalls get a light setup, my desktop gets a heavy setup. Machine architecture (i386, amd64, sparc64, etc) is handled in the script.

For the impatient:

  1. download and extract system packages
  2. merge new etc files
  3. upgrade packages
  4. reboot

OK, now for the patient:

I have a working directory called /root/upgrade, but you could just use /tmp. Also, some of the steps below could be combined. I just feel more comfortable with downloading all the needed files, then taking action.

  1. I set up my script with variables so changes from box to box would be easier.
_extract="base comp man misc game xbase xetc xfont xserv xshare"
_sets="base comp man misc xbase xetc xfont xserv xshare etc"
_kern="bsd bsd.rd pxeboot"
_src="$(arch -s)"

_sets are all the sets to download, and _extract are just the ones I want extracted in a particular step below. They are broken out to provide flexibility for different uses.

  1. fetch sets from ftp
cd $_drop
for i in $_sets; do
    ftp -V -m $_src/${i}${_rel}.tgz
  1. fetch kernels from ftp
cd $_drop
for i in $_kern; do
    ftp -V -m $_src/${i}
  1. extract etcXX.tgz into /root/upgrade/etc
tar -xzphf $_drop/etc${_rel}.tgz -C ${_drop}/etc
  1. extract other tgz right into production filesystem
for i in $_extract; do
    tar zxphf ${i}${_rel}.tgz -C /
  1. copy the kernels from working dir to production
cp ${_drop}/bsd /bsd.up
cp ${_drop}/ /
cp / /bsd

The above setup is for a multi-processor machine, but I keep the uni-processor kernel around. Adjust as needed.

  1. start mergemaster - this tool is not in base, but is very helpful
mergemaster -r -t ${_drop}/etc
  1. update packages (all other software not in base)
pkg_add -ui -F update -F updatedepends
  1. restart the kernel

An alternative to the above is to download and extract sets in one motion:

for i in $_sets; do
    ftp -V -m -o - $_src/${i}${_rel}.tgz | sudo tar xzphf - -C /

Support the Project!

Supporting open source software is simple, easy, and the right thing to do. You can donate money or hardware, purchase CD's, t-shirts, etc. Visit the donations page now

"Thank you" to the OpenBSD developers for letting us use, and benefit from, your hard work!

Special thanks to Okan for his patients and mentoring.

Copyright © 20060215 genoverly
(db datestamp: 20070821)

Copyright © 2003-2015 genoverly