OpenBSD Upgrade 7.1 to 7.2

created
( modified )
@nabbisen

Summary

The OpenBSD project released 7.2 of their OS on 20 Oct 2022✨ It was their 53rd release.

What’s New | Changelog

This post shows how to upgrade OpenBSD 7.1 to 7.2. The steps are based on their official great guide.

Tutorial

Here is a step-by-step guide for the upgrade with a set of the commands to run.

🌊 🐡 🌊

1. Pre-upgrade: Validate and customize

The official tutorial includes Before using any upgrade method section.

Using sysupgrade is perhaps a good choice.

Validate available disk size

/usr should be greater than 1.1GB.

$ df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
(...)
/dev/sd1d      6.8G    1.8G    4.6G    29%    /usr

OK :)

Validate it’s compatible with the current usage

Check: Configuration and syntax changes and Special packages.

Customize upgrade (optional)

/auto_upgrade.conf is available as the response file. The OpenBSD manual page on autoinstall says:

If either /auto_install.conf or /auto_upgrade.conf is found on bsd.rd’s built-in RAM disk, autoinstall behaves as if the machine is netbooted, but uses the local response file. In case both files exist, /auto_install.conf takes precedence.

The whole example of /auto_upgrade.conf is like:

Location of sets = disk
Pathname to the sets = /home/_sysupgrade/
Set name(s) = -x*
Set name(s) = +xbase*
Set name(s) = -game*
Set name(s) = done
Directory does not contain SHA256.sig. Continue without verification = yes

In this case, x sets except xbase and game are excluded.

Also, /upgrade.site can be applied.

2. Upgrade with sysupgrade

No problem left ? You might have to take some backups.

* Caution: It is unable to stop sysupgrade on the way once run.

Let’s just run the command, if ready:

$ doas sysupgrade

It will print like this:

Fetching from https://cdn.openbsd.org/pub/OpenBSD/7.2/amd64/
SHA256.sig   100% |*************************************|  2144       00:00    
Signature Verified
INSTALL.amd64 100% |************************************| 43554       00:00    
base72.tgz   100% |*************************************|   331 MB    00:12    
bsd          100% |*************************************| 22445 KB    00:02    
bsd.mp       100% |*************************************| 22550 KB    00:02    
bsd.rd       100% |*************************************|  4533 KB    00:00    
comp72.tgz   100% |*************************************| 74598 KB    00:05    
game72.tgz   100% |*************************************|  2745 KB    00:00    
man72.tgz    100% |*************************************|  7610 KB    00:01    
xbase72.tgz  100% |*************************************| 52832 KB    00:03    
xfont72.tgz  100% |*************************************| 22967 KB    00:02    
xserv72.tgz  100% |*************************************| 14815 KB    00:02    
xshare72.tgz 100% |*************************************|  4559 KB    00:00    
Verifying sets.
Fetching updated firmware.
fw_update: added none; updated intel; kept vmm
Upgrading.

The sysupgrade process reboots the machine automatically. The process will continue like this:

Let's upgrade the sets!
Location of sets? (disk http nfs or 'done') [http] disk
Is the disk partition already mounted? [yes] yes
Pathname to the sets? (or 'done') [7.2/amd64] /home/_sysupgrade/

Select sets by entering a set name, a file name pattern or 'all'. De-select
sets by prepending a '-', e.g.: '-game*'. Selected sets are labelled '[X]'.
    [X] bsd           [X] comp72.tgz    [X] xbase72.tgz   [X] xserv72.tgz
    [X] bsd.rd        [X] man72.tgz     [X] xshare72.tgz
    [X] base72.tgz    [X] game72.tgz    [X] xfont72.taz
Set name(s)? (or 'abort' or 'done') [done] done
Directory does not contain SHA256.sig. Continue without verification? [no] yes
Installing bsd          100% |**************************| 22445 KB    00:00
Installing bsd.rd       100% |**************************|  4533 KB    00:00
Installing base72.tgz   100% |**************************|   331 MB    00:25
Installing comp72.tgz   100% |**************************| 74598 KB    00:18
Installing man72.tgz    100% |**************************|  7610 KB    00:04
...

Then the machine will be rebooted again, and sysmerge will follow automatically. What I got was:

...
clearing /tmp
kern.securelevel: 0 -> 1
creating runtime link editor directory cache.
preserving editor files.
running rc.sysmerge
===> Adding the _bgplgd group
===> Adding the _agentx group
===> Adding the _bgplgd user
===> Updating /etc/changelist
===> Updating /etc/skel/.cshrc
===> Updating /etc/skel/.profile
===> Updating /etc/ssl/cert.pem
===> Updating /etc/X11/xenodm/Xsession
===> Updating /etc/X11/xinit/xinitrc
===> Updating /etc/mail/aliases
starting network daemons: sshd smtpd sndiod.
...

The daemons such as sshd will be started as usual.

Then syspatch will follow as well as sysmerge:

Checking for available binary patches...

Then nothing was found in my case.

After all, you will see the login message including “OpenBSD 7.2 (GENERIC)”.

3. Post-upgrade: sysmerge if necessary

The official documentation describes on them and helps a lot.

rc.sysmerge ran automatically in the previous process as shown. But running this command may be necessary. It sometimes requires manually merging conf files such as:

  • /etc/login.conf

Run the command:

$ doas sysmerge

You will view the diff results first. Then you will be asked:

  Use 'd' to delete the temporary ./etc/login.conf
  Use 'i' to install the temporary ./etc/login.conf
  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

How should I deal with this? [Leave it for later]

Each of the top 3 options work like:

  • d: to preserve the current file.
  • i: to overwrite it with the new file sysupgrade brought.
  • m: to merge them manually and interactively.

If you type m to start merge mode, you will be asked to type each of them at each difference:

  • l to choose the left diff,
  • r to choose the right.

Then you will see the options to deal with the merged file:

  Use 'e' to edit the merged file
  Use 'i' to install the merged file
  Use 'n' to view a diff between the merged and new files
  Use 'o' to view a diff between the old and merged files
  Use 'r' to re-do the merge
  Use 'v' to view the merged file
  Use 'x' to delete the merged file and go back to previous menu
  Default is to leave the temporary file to deal with by hand

===> How should I deal with the merged file? [Leave it for later]

If you type e, editor will run with the merged file.

If you type i, the merged file will be installed directly:

===> Merging /etc/login.conf (running cap_mkdb(1), needs a relog)

4. Apply syspatch (skippable)

The next two tasks below are usual just in order to update the system, too.

syspatch is an important command to install binary patches officially offered by OpenBSD successively as found to be needed.

Well, sysupgrade runs syspatch in the process. Therefore, it must not be necessary to run it manually here:

$ # must be skippable:
$ # doas syspatch

5. Update packages

What’s new section in the release page also shows “Some highlights” in “Ports and packages”. For example, PHP 8.1 was instroduced as well as 7.4 and 8.0 :)

This command will update all of the packages installed in the machine:

$ doas pkg_add -u

It will print a lot, but you should be careful to read, especially its tail, which may tell there are some important changes or tasks to do.

6. Remove old files

This is a simple step. All what to do is just follow Files to remove in the official tutorial. This time:

$ doas userdel _switchd
$ doas groupdel _switchd
$ doas rm /etc/rc.d/switchd \
    /usr/sbin/switchctl \
    /usr/sbin/switchd \
    /usr/share/man/man4/switch.4 \
    /usr/share/man/man5/switchd.conf.5 \
    /usr/share/man/man8/switchctl.8 \
    /usr/share/man/man8/switchd.8

7. Special packages

Check Special packages in the official tutorial. You may use some of:

  • databases/openldap
  • editors/vim
  • inputmethods/fcitx
  • lang/python
  • www/sogo

8. Reboot

Almost done !

$ doas reboot

That’s it.

Conclusion

Hope the new system brings you another happiness :)

With great appreciation to the OpenBSD project and the community.


Comments or feedbacks are welcomed and appreciated.