OpenBSD Upgrade Guide: 5.1 to 5.2


[FAQ Index] | [5.0 -> 5.1] | [5.2 -> 5.3]

Note: Upgrades are only supported from one release to the release immediately following it. Do not skip releases.

It is highly recommended that you read through and fully understand this process before attempting it. If you are doing it on a critical or physically remote machine, it is recommended that you test this process on an identical, local system to verify its success before attempting on a critical or remote computer.

Upgrading is a convenient way to bring your OpenBSD system up to the most recent version. However, the results are not intended to precisely match the results of a wipe-and-reload installation. Old library files in particular are not removed in the upgrade process, as they may be required by older applications that may or may not be upgraded at this time. If you REALLY wish to get rid of all these old files, you are probably better off reinstalling from scratch.

Table of Contents:


Before upgrading: things to think about and be aware of

This is not a complete list of the changes that took place between 5.1 and 5.2, but rather some of the important things that will impact a large number of users in the upgrade process. For a more complete list of changes, see plus51.html and the CVS change logs.


The upgrade process

Upgrading by install kernel

If you have access to the system's console, the easiest and safest way to upgrade is to boot from the install kernel by boot media or bsd.rd and follow the upgrade steps, which are very similar to the install process.

Afterwards, complete the upgrade by following the final steps as detailed below.

One easy way to boot from the install kernel is to place the 5.2 version of bsd.rd in the root of your boot drive, then instruct the boot loader to boot using this new bsd.rd file. On amd64 and i386, you do this by entering "boot bsd.rd" at the initial boot> prompt.

Upgrading without install kernel

This is NOT the recommended process. Use the install kernel method if at all possible!

Sometimes, one needs to do an upgrade of a machine when one can't easily use the normal upgrade process. The most common case is when the machine is in a remote location and you don't have easy access to the system console. One can usually do this by carefully following this process:


Final steps

Whether you upgrade by using an install kernel and doing a formal "upgrade" process, or do a "in-place" binary upgrade, you need to update the system configuration files which are included in the etc52.tgz which have not been dealt with so far. There are two processes we provide for you -- manually copying over some files and patching others, or using the sysmerge(8) process.

1a. Merging locally changed files via sysmerge(8)

Who should use sysmerge(8):
People running highly modified systems or systems that didn't start out at the previous release (for example, a snapshot part way between releases), who are upgrading to a snapshot or who have not carefully upgraded their system in the past will find sysmerge vastly superior to using the patches, as it works with what is actually on your system, instead of what we expected was on your system. It will also give you much greater control over your upgrade process, and will involve you in it more closely.

Who may wish to NOT use sysmerge(8):
With recent improvements in sysmerge, we hope that relatively few people have reason not to use sysmerge(8)! However, people with a large quantity of similar machines to upgrade may find the "patch file" process faster, and perhaps the basis of a customized upgrade script.

Using sysmerge(8) for the first time:
If you have a system that's been upgraded in the past via the patch file process you will probably find the FIRST time you upgrade by sysmerge, you have a LOT of manual file changes to make. This is because the patch file process only attempted to achieve functional compatibility on the upgraded system, and did not respect the version control information sysmerge(8) uses to identify "unchanged" files. Rest assured, later runs of sysmerge will be far less painful, and often completely effortless.

The sysmerge(8) utility will compare the files that are actually on your system with those that would be installed in a fresh install, and assist you in merging the changes into your system. Note that unlike the patch file, there are no assumptions made about what is actually on your system, so you can use sysmerge(8) to move between more arbitrary points in the development process, such as from an earlier 5.1-current to 5.2-release or from one -current to a later one. Sysmerge(8) compares the current files on your system with the files that would have been installed with a new install, and what would have been there from the last run of sysmerge. Usually, it can figure out what to do to update your files, but if it has difficulty, it will give you the option of keeping the old file, installing the new file, or assisting you in the manual merging of the old and new files, using sdiff.

Please read the sysmerge(8) manual page before using it on your system. You are also advised to read the diff(1), sdiff(1) and even review more(1) manual pages before continuing.

Assuming the etc52.tgz and xetc52.tgz files exists in your ${RELEASEPATH}, run it with:

sysmerge -s ${RELEASEPATH}/etc52.tgz -x ${RELEASEPATH}/xetc52.tgz
For the files sysmerge(8) can't resolve on its own, it will show you a unified diff(1), run through your favorite $PAGER (i.e., more(1)) and ask you if you wish to:
  Use 'd' to delete the temporary ./var/www/htdocs/index.html
  Use 'i' to install the temporary ./var/www/htdocs/index.html
  Use 'm' to merge the temporary and installed versions
  Use 'v' to view the diff results again

  Default is to leave the temporary file to deal with by hand

If you wish to retain your existing file, delete the temporary file, if you wish to replace your existing file with the new version, install the temporary file. If you wish to merge the two together, choosing 'm' will put you into sdiff(1), where you can manually merge the file. The default is to come back and deal with the file later, manually.

Sysmerge(8) saves all your replaced files into a temporary directory, similar to /var/tmp/sysmerge.24959/backups, so if you accidentally clobber something that was probably not such a good idea, you have a chance to recover it. Note that daily(8) cleans old files from this directory, but it will survive a reboot.

1b. Merging locally changed files via a patch file

This process makes a lot of assumptions about what files you have and have not modified, and that you are upgrading from 5.1-release to 5.2-release. Before following this, make sure your system matches the assumptions, and alter the process accordingly if needed -- or just use the above sysmerge process.

No new users and groups need to be created for 5.2.

You will want to extract the etc52.tgz files to a temporary location:

export RELEASEPATH=/usr/rel
tar -C /tmp -xzphf ${RELEASEPATH}/etc52.tgz
Files that can probably be copied from etc52.tgz "as is":
etc/daily
etc/moduli
etc/rc
etc/rc.conf
etc/mail/localhost.cf
etc/mail/sendmail.cf
etc/mail/submit.cf
etc/rc.d/nfsd
etc/rc.d/nginx
etc/rc.d/sendmail
etc/rc.d/tftpd
etc/rc.d/rc.subr
var/www/conf/bgplg.head
Note that it IS possible to locally modify these files; if this has been done, do NOT simply copy over those files, and consider using the sysmerge(8) process instead. Pay special attention to mail/* if you are using something other than the default Sendmail(8) configuration.

Here are copy/paste lines for copying these files, assuming you unpacked etc52.tgz in the above recommended place:

cd /tmp/etc
cp daily moduli rc rc.conf /etc
mkdir /etc/nginx
cp nginx/* /etc/nginx/
cd /tmp/etc/rc.d
cp nfsd nginx sendmail tftpd rc.subr /etc/rc.d
cp /tmp/var/www/conf/bgplg.head /var/www/conf/
cp /tmp/etc/mail/*.cf /etc/mail  # Use with care!

These files likely have local changes, but should be updated for 5.2. IF you have not altered these files, you can copy over the new version, otherwise the changes should be merged with your files:

etc/inetd.conf
etc/login.conf
etc/services
etc/sysctl.conf
etc/mail/smtpd.conf
etc/mail/spamd.conf
etc/ssh/sshd_config
The changes to these files are in this patch file. Please test this process before relying on it for a machine you can not easily get to. You can attempt to use this by executing the following as root:
cd /
ftp http://www.openbsd.org/faq/upgrade52.patch
patch -C -p0 < upgrade52.patch
This will test the patch to see how well it will apply to YOUR system; to actually apply it, leave off the "-C" option. Note that it is likely that if you have customized files or not kept them closely updated, or are upgrading from a snapshot of 5.1, they may not accept the patch cleanly. Make sure all file changes are attempted; patch(1) may quit prematurely if it gets too confused in one file, which may happen if your machine was originally installed from a snapshot or otherwise has some interim changes. The last file to be changed here should be sysctl.conf. Deleting the file sections that fail from the patch file may permit the rest to be applied. You will need to manually apply the changes that are skipped.

The following files have had changes which should be looked at, but it is unlikely they should be directly copied or merged (i.e., if you are using nsd.conf, look at the suggested change of strategy, and decide if it is appropriate for your use).

etc/bgpd.conf
etc/iked.conf

Finally, use newaliases(8) to update the aliases database, mtree(8) create any new directories:

newaliases
mtree -qdef /etc/mtree/4.4BSD.dist -p / -u


All upgraders, whether merging via sysmerge(8) or patch file should continue the upgrade process with these steps:

2. Files to delete

A number of files should be deleted from your system. Note that some of these may not exist on all systems; that's ok. Copy and paste the following lines:
rm /usr/bin/lint
rm /usr/libexec/lint[12]
rm -r /usr/libdata/lint
rm /usr/share/man/man1/lint.1
rm /etc/rc.d/btd
rm /usr/sbin/pkg
rm /sbin/raidctl
rm /usr/share/man/man4/raid.4
rm /usr/share/man/man8/raidctl.8
rm /usr/libexec/tftpd
rm -r /usr/lib/gcc-lib/*-unknown-openbsd5.1

3. Checking the kernel

Note: most people can skip this step!

If you followed the instructions for the upgrade process without install kernel, you have already completed this step. However, if you used the install kernel, and if you had a modified kernel in 5.1, it is likely you will need to modify the stock kernel of 5.2. This can be as simple as modifying a specific device using config(8), or it can involve a recompilation if the option you need is not included in the GENERIC kernel. Please consult FAQ 5 - Building the system from source before considering to recompile your kernel.

4. Upgrading packages

If you installed any packages on your system, you should upgrade them after completing the upgrade of the base system. Be aware, however, many packages will require further setup before and/or after upgrading the package. Check with the application's upgrade guide for details.

The following packages are known to have significant upgrade issues that will impact a large number of users. The fact that a package is not on this list doesn't mean it will have a trivial upgrade. You must do some homework on the applications YOU use.

The package tools support in-place updating using pkg_add -u. For instance, to update all your packages, make sure PKG_PATH is pointing to the 5.2 packages directory on your CD or nearest FTP mirror, and use something like

pkg_add -u
where the -u indicates update mode; pkg_add will prompt you for input when it encounters some ambiguity. Read the pkg_add(1) manual page and the package management chapter of the FAQ for more information.

[FAQ Index] | [5.0 -> 5.1] | [5.2 -> 5.3]


$OpenBSD: upgrade52.html,v 1.32 2023/04/09 07:14:45 jsg Exp $