Applying Patches to OpenBSD Releases.
On this page none of the 'code' or 'commands' are my own. All of it is taken direcly from OpenBSD.org. As well I have taken snippets of text instruction. I hope no one minds as this is primarily a reference for myself and a good way for me to cement this into my memory.
So I've got a few OpenBSD servers running whatever stable branch is the newest. This is sweet and they run just fine, but all of a sudden theres some patches that must be applied. With OpenBSD 5.9 there are some patches ready to go and I have not even recieved my cd's in the mail yet!
Ok. Thats pretty cool. Now I still have a couple servers running 5.9 release and I want to follow the stable/patch branch.
Follow the OpenBSD FAQ. There is no need to search for any information on this.
Please read every word on this page: OpenBSD Stable FAQ
There are a number of ways to patch your system. The easiest way is to read and follow the directions... else wtf are you doing... So go to the Errata Page and click on the fix then follow the bloody directions. Alternately I do the following if I'm multiple patches behind.. like when installing from CD's.
First thing to do is to download the src if you havent yet, or update it if this is not your first rodeo.
# cd /usr # cvs -qd anoncvs@anoncvs.ca.openbsd.org:/cvs get -rOPENBSD_5_9 -P src
Now that we have the current source we need to:
- Rebuild the kernel
- Rebuild the userland
- Reboot with the new kernel
First Rebuild The Kernel - note I'm using GENERIC.MP as I have a multi-cored processor.
# cd /usr/src/sys/arch/$(uname -m)/conf # config GENERIC.MP # cd /usr/src/sys/arch/$(uname -m)/compile/GENERIC.MP # make clean && make # make install # reboot
Second I have to rebuild the userland
# rm -rf /usr/obj/* # cd /usr/src # make obj # cd /usr/src/etc && env DESTDIR=/ make distrib-dirs # cd /usr/src # make build # reboot # sysmerge
Next time there is a patch available I pull the src with:
# cd /usr/src # cvs -q up -rOPENBSD_5_9 -Pd
I follow the steps above to build and then crack open a beer and pat myself on the back.