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

We understand that Michael Dexter, Brad Davis, and George Rosamond think 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 258: OS Foundations

2018-08-08

Direct Download:MP3 AudioVideo This episode was brought to you by Headlines FreeBSD Foundation Update, July 2018 MESSAGE FROM THE EXECUTIVE DIRECTOR We’re in the middle of summer here, in Boulder, CO. While the days are typically hot, they can also be quite unpredictable. Thanks to the Rocky Mountains, waking up to 50-degree (~10...

Episode 257: Great NetBSD 8

2018-08-01

Direct Download:MP3 AudioVideo This episode was brought to you by Headlines NetBSD v8.0 Released The NetBSD Project is pleased to announce NetBSD 8.0, the sixteenth major release of the NetBSD operating system. This release brings stability improvements, hundreds of bug fixes, and many new features. Some highlights of the...

Episode 2^8: Because Computers

2018-07-25

Direct Download:MP3 AudioVideo This episode was brought to you by Win Celebrate our 256th episode with us. You can win a Mogics Power Bagel (not sponsored). To enter, go find the 4 episodes we did in December of 2017. In the opening, find the 4 letters in the bookshelf behind me. They...

Episode 255: What are you pointing at

2018-07-18

Direct Download:MP3 AudioVideo This episode was brought to you by Headlines What ZFS block pointers are and what's in them I've mentioned ZFS block pointers in the past; for example, when I wrote about some details of ZFS DVAs, I said that DVAs are embedded in block pointers. But I've never really...