Skip to main content.

Creating pre-patched OpenBSD ISOs

2014-07-02

Live demo in BSD Now Episode 044. | Originally written by TJ for bsdnow.tv | 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 anoncvs@anoncvs.usa.openbsd.org:/cvs 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/stable-base.pub -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=http://ftp.openbsd.org/pub/OpenBSD/`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

2017-05-25

Hi, Mr. Dexter. Also, we understand that Brad Davis thinks there should be more real news....

Two Year Anniversary

2015-08-08

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

2015-01-17

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?

2014-11-26

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 232: FOSDEM 2018

2018-02-07

Direct Download:HD VideoMP3 AudioTorrent> This episode was brought to you by Headlines [FOSDEM Trip report] Your BSDNow hosts were both at FOSDEM in Brussels, Belgium over the weekend. On the friday before FOSDEM, we held a FreeBSD devsummit (3rd consecutive year), sponsored by the FreeBSD Foundation and organized by Benedict (with the help from Kristof...

Episode 231: Unix Architecture Evolution

2018-01-24

Direct Download:HD VideoMP3 AudioTorrent This episode was brought to you by Headlines Unix Architecture Evolution from the 1970 PDP-7 to the 2017 FreeBSD Q: Could you briefly introduce yourself? I’m a professor of software engineering, a programmer at heart, and a technology author. Currently I’m also the editor in chief of the IEEE...

Episode 230: Your questions, Part III

2018-01-24

Direct Download:HD VideoMP3 AudioTorrent> This episode was brought to you by Headlines KPTI patch lands in FreeBSD -current After a heroic effort by Konstantin Belousov kib@FreeBSD.org, the first meltdown patch has landed in FreeBSD This creates separate page tables for the Kernel and userland, and switches between them when executions enters the kernel, and when...

Episode 229: The Meltdown of Spectre

2018-01-17

Direct Download:HD VideoMP3 AudioTorrent> This episode was brought to you by Headlines More Meltdown Much has been happened this week, but before we get into a status update of the various mitigations on the other BSDs, some important updates: Intel has recalled the microcode update they issued on January 8th. It turns out this update...