Skip to main content.

Creating pre-patched OpenBSD ISOs


Live demo in BSD Now Episode 044. | Originally written by TJ for | Last updated: 2014/10/18

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

So you're planning a large deployment of OpenBSD systems. Do you install the -release image and then manually patch them all for errata? What a waste of time. It will be much more efficient to build one single ISO image with all the patches applied to it already. You can even use it in combination with the autoinstall feature for a very fast mass deployment. This tutorial will show you how to create your own bootable ISO or install sets that contain all of the fixes in the -stable branch. This is all being done on a regular OpenBSD box, and has the side benefit of also updating it to the latest -stable branch in the process. To get started, let's check out the source code for the -stable branch. This assumes you don't currently have anything in the /usr/src or /usr/xenocara directories.

# cd /usr
# cvs -qd get -rOPENBSD_`uname -r | sed 's/\./_/'` -P src xenocara

Since we're building the entire OS, we need both xenocara (the source code for OpenBSD's version of Xorg) and src (the source code for everything else). Next, we go about building -stable as we normally would. This assumes you're using an SMP system. Start off by configuring and building the kernel like so:

# cd /usr/src/sys/arch/`machine`/conf
# config GENERIC.MP
# cd ../compile/GENERIC.MP
# make clean && make && make install

Normally you would reboot before building and installing the userland, but -stable usually only gets small fixes that won't break any compatibility. We'll skip the reboot and go straight to building the rest of the system.

# cd /usr/src
# make obj
# cd /usr/src/etc && env DESTDIR=/ make distrib-dirs
# cd /usr/src
# make build

After that finishes, we do pretty much the same thing for Xorg.

# cd /usr/xenocara
# make bootstrap
# make obj
# make build

Then we create some directories that we'll use to hold our patched install media. They can be anywhere you want, but make sure you have enough free space.

# export DESTDIR=/root/dest
# export RELEASEDIR=/root/rel
# test -d ${DESTDIR} && mv ${DESTDIR} ${DESTDIR}.old && rm -rf ${DESTDIR}.old
# mkdir -p ${DESTDIR} ${RELEASEDIR}

This seemingly excessive list of commands will make sure the directories are empty and create them if they don't exist. We have to be sure there aren't any sets there that were created previously. Next, we'll create the install sets from what we just compiled.

# cd /usr/src/etc
# make release
# cd /usr/src/distrib/sets
# sh checkflist

And do the same for Xorg.

# cd /usr/xenocara
# mkdir -p ${DESTDIR} ${RELEASEDIR}
# make release

Now we can organize the directories into the proper release structure and tidy up. This assumes you used the same directories that I used as an example.

# cd /root
# mkdir OpenBSD
# mv rel `machine`
# mkdir `uname -r`
# mv `machine` `uname -r`/
# mv `uname -r` OpenBSD/

We also need to append the correct checksums for the xenocara sets and create the index listing. Signing the checksum file is easy, but it's up to you to safely get the public key to the client machines.

# cd OpenBSD/`uname -r`/`machine`
# cksum -a SHA256 x* >> SHA256
# signify -G -p /etc/signify/ -s /etc/signify/stable-base.sec
# signify -S -s /etc/signify/stable-base.sec -m SHA256 -e -x SHA256.sig
# ls -1 > index.txt

If everything worked, your new sets should be available in the release directory. You can serve this via HTTP for PXE installations or however you'd like to do it. Lastly, we can create a bootable ISO image from those sets. We'll need to install the sysutils/cdrtools tool from ports or packages.

# export PKG_PATH=`uname -r`/packages/`machine`
# pkg_add cdrtools
# cd /root
# mkisofs -r -no-emul-boot -b `uname -r`/`machine`/cdbr -c boot.catalog -o install.iso /root/OpenBSD

You now have a completely updated image of OpenBSD, ready to be installed.

# cdrecord -v dev=/dev/rcd0c -data install.iso

Assuming your disk drive is /dev/cd0, that's all you need to do.

Latest News

New announcement


Hi, Mr. Dexter...

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 210: Your questions, part I


Direct Download:HD VideoMP3 AudioTorrent This episode was brought to you by Headlines A Reimplementation Of Netbsd Using a Microkernel Minix author Andy Tanenbaum writes in Part 1 of a-reimplementation-of-netbsd-using-a-microkernel Based on the MINIX 3 microkernel, we have constructed a system that to the user looks a great deal like NetBSD. It uses pkgsrc,...

Episode 209: Signals: gotta catch ‘em all


Direct Download:HD VideoMP3 AudioTorrent This episode was brought to you by Headlines Trip Report: FreeBSD in China at COPU and LinuxCon This trip report is from Deb Goodkin, the Executive Director of the FreeBSD Foundation. She travelled to China in May 2017 to promote FreeBSD, meet with companies, and participate in discussions around Open...

Episode 208: Faces of Open Source


Direct Download:HD VideoMP3 AudioTorrent This episode was brought to you by Headlines LLVM, Clang and compiler-rt support enhancements In the last month I started with upstream of the code for sanitizers: the common layer and ubsan. I worked also on the elimination of unexpected failures in LLVM and Clang. I've managed to...

Episode 207: Bridge over the river Cam


Direct Download:HD VideoMP3 AudioTorrent This episode was brought to you by Headlines BSDCam recap The 2017 Cambridge DevSummit took place from 2-4 August 2017. The event took place over three days including a formal dinner at St John's College, and was attended by 55 registered developers and guests. Prior to the start of...