Posted by: jasonk2600 | October 10, 2009

Keeping OpenBSD Up-To-Date

I.  Download Kernel and Userland Source Code


If you haven’t already done so, download the OpenBSD kernel and userland source code.  The kernel and userland source code can be downloaded from the OpenBSD FTP site.  Download the sys.tar.gz and src.tar.gz files from the main directory of the OpenBSD release that you are currently running.  For example, if you are running OpenBSD 4.5 on an i386 based system, you would download the files from the /pub/OpenBSD/4.5/i386/ directory.  Once the files have been downloaded extract them to the /usr/src directory.


# cd /usr/src
# tar -xvzf src.tar.gz
# tar -xvzf sys.tar.gz


II.  Sync the Source to the OpenBSD-STABLE Branch


It is good practice to ensure that your system’s source code is up-to-date.  Keeping the source code sync’ed with the stable branch will keep the OS free from bugs and protected from the latest security holes.  Using CVS is the recommended method of keeping your source up-to-date.  When updating the system source files, be sure to practice good Internet etiquette and use an anonymous CVS server that is near your physical location.  The OpenBSD AnonCVS documentation contains a list of CVS mirrors here.  In the example below, the system will be synchronizing its source files with the OpenBSD v4.5-STABLE branch and the OpenBSD CVS server it will be using is in California.  Simply replace ‘OPENBSD_4_5’ with the version of OpenBSD that your system is running and replace the CVS server address with one that is near you.


# cd /usr
# cvs -d up -rOPENBSD_4_5 -P src

III.  Building and Installing an Updated Kernel


After updating the system source code, the first step is to build an updated kernel.  Most users will not need to build a custom kernel and may use one of the default generic kernel configurations that OpenBSD provides.  Select the generic kernel configuration file that matches your computer’s architecture.  The generic kernel configuration files are stored in the /usr/src/sys/arch/ directory.  The example below selects a generic kernel configuration for a computer with multiple Intel based processors (an Intel Pentium 4 HT).


# cd /usr/src/sys/arch/i386/conf
# config GENERIC.MP


The next step is to compile and install the new kernel with the configuration that you selected in the previous step.


# cd /usr/src/sys/arch/i386/compile/GENERIC.MP
# make clean
# make depend
# make
# make install


Once the new kernel has been compiled and installed, reboot the computer to verify that the new kernel is functioning correctly. If the computer boots successfully continue to the next step of the update process below.


IV.  Building and Installing Updated Userland Binaries


Depending upon the various hardware components of your system, building the userland files with updated source may take anywhere from an hour to a full day. With this in mind, make sure that the /usr/obj directory is empty before compiling the userland files.


# rm -rf /usr/obj/*


Compile the userland objects and make sure that all the appropriate directories are created.


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


Finally, compile and install all the updated userland utilities. Once this lengthy process has completed reboot the computer to finalize the updating process.


# cd /usr/src
# make build



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: