OpenBSD Upgrade 7.2 to 7.3
Tags: openbsd, upgrade, migration, server
Published: 2023-04-22 04:10:41

## Summary

The [OpenBSD](https://www.openbsd.org/) project released [7.3](https://www.openbsd.org/73.html) of their OS on 10 Apr 2023🌷 It is their 54th release.

{% twitter 1645426672999739395 %}

[What's New](https://www.openbsd.org/73.html#new)  | [Changelog](https://www.openbsd.org/plus73.html)

This post shows how to upgrade OpenBSD 7.2 to 7.3.
The steps are based on [their official great guide](https://www.openbsd.org/faq/upgrade73.html).

## Tutorial

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

<center>🌊 🐡 🌊</center>

### 1. Pre-upgrade: Validate and customize

The official tutorial includes [Before using any upgrade method](https://www.openbsd.org/faq/upgrade73.html#BeforeUpdate) section.

Using [`sysupgrade`](https://man.openbsd.org/sysupgrade) is perhaps a good choice.

#### Validate available disk size

`/usr` should be greater than 1.1GB.

```console
$ df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
(...)
/dev/sd1e      7.6G    1.8G    5.4G    25%    /usr
```

OK :)

#### Validate compatibility with the current usage

Check: [Configuration and syntax changes](https://www.openbsd.org/faq/upgrade73.html#ConfigChanges) and [Special packages](https://www.openbsd.org/faq/upgrade73.html#SpecialPackages). The latter includes changes on [PostgreSQL](https://www.postgresql.org/), [Python](https://www.python.org/) and [Gitea](https://gitea.io/en-us/).

---

#### Backups (Optional)

You might have to take some backups.

#### Customize upgrade (Optional)

[/auto_upgrade.conf](https://man.openbsd.org/sysupgrade) is available as the response file.
The OpenBSD manual page on [autoinstall](https://man.openbsd.org/autoinstall.8) 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:

```ini
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](https://man.openbsd.org/upgrade.site.5) can be applied.

---

### 2. Upgrade with `sysupgrade`

OK. You must be ready.

\* Caution: The command below, `sysupgrade`,  is unable to stop on the way once it is run.

Let's just run the command, if ready:

```console
$ doas sysupgrade
```

It will print like this:

```console
Fetching from https://cdn.openbsd.org/pub/OpenBSD/7.3/amd64/
SHA256.sig   100% |*************************************|  2144       00:00
Signature Verified
INSTALL.amd64 100% |************************************| 44817       00:00
base73.tgz   100% |*************************************|   364 MB    00:29
bsd          100% |*************************************| 24400 KB    00:01
bsd.mp       100% |*************************************| 24513 KB    00:01
bsd.rd       100% |*************************************|  4547 KB    00:00
comp73.tgz   100% |*************************************| 75042 KB    00:03
game73.tgz   100% |*************************************|  2745 KB    00:00
man73.tgz    100% |*************************************|  7832 KB    00:01
xbase73.tgz  100% |*************************************| 56869 KB    00:02
xfont73.tgz  100% |*************************************| 22967 KB    00:01
xserv73.tgz  100% |*************************************| 14847 KB    00:01
xshare73.tgz 100% |*************************************|  4583 KB    00:00
Verifying sets.
Fetching updated firmware.
fw_update: added none; updated intel; kept none
Upgrading.
```

The machine will reboot automatically. Then 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.3/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] base73.tgz    [X] game73.tgz    [X] xfont73.taz
    [X] bsd.md        [X] comp73.tgz    [X] xbase73.tgz   [X] xserv73.tgz
    [X] bsd.rd        [X] man73.tgz     [X] xshare73.tgz
Set name(s)? (or 'abort' or 'done') [done] done
Directory does not contain SHA256.sig. Continue without verification? [no] yes
Installing bsd          100% |**************************| 24400 KB    00:00
Installing bsd.mp       100% |**************************| 24513 KB    00:01
Installing bsd.rd       100% |**************************|  4547 KB    00:00
Installing base73.tgz   100% |**************************|   364 MB    00:37
...
```

Then the machine will reboot again, and [`sysmerge`](https://man.openbsd.org/sysmerge) will follow automatically. What I got was:

```console
...
clearing /tmp
kern.securelevel: 0 -> 1
creating runtime link editor directory cache.
preserving editor files.
running rc.sysmerge
===> Updating /etc/X11/xenodm/Xresources
===> Linking /etc/fonts/conf.d/48-spacing.conf
===> Linking /etc/fonts/conf.d/59-latin-obsd.conf
starting network daemons: sshd smtpd sndiod.
running rc.firsttime
fw_update: added none; updated none; kept intel
```

The daemons such as `sshd` will be started as usual.

Then [`syspatch`](https://man.openbsd.org/syspatch) will follow as well as `sysmerge`:

```console
Checking for available binary patches...
```

Nothing was found in my case. It was followed by:

```
starting local daemons: cron.
Sun Apr 16 17:52:41 JST 2023

OpenBSD/amd64 ...

login:
```

After all, when login is successful, you will see the login message including "OpenBSD 7.3 (GENERIC.MP)".

### 3. Post-upgrade: `sysmerge` if necessary

The official documentation [describes on them](https://www.openbsd.org/faq/upgrade73.html#AfterSets) and helps a lot.

> In some cases, configuration files cannot be modified automatically. Run
> 
> ```sh
> # sysmerge
> ```
> 
> to check and perform these configuration changes. 

It means manually running `sysmerge` in addition may be sometimes necessary.
Remember you sometimes have to manually merging conf files such as:

- `/etc/login.conf`

Run the command:

```console
$ doas sysmerge
```

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

```console
  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:

```console
===> 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:

```console
$ # must be skippable:
$ # doas syspatch
```

### 5. Update packages

[What's new](https://www.openbsd.org/73.html#new) section in the release page also shows "Some highlights" in "Ports and packages". For example, [MariaDB](https://mariadb.com/) is now [10.9.4](https://mariadb.com/kb/en/mariadb-10-9-4-release-notes/) and PostgreSQL is now [15.2](https://www.postgresql.org/docs/current/release-15-2.html).

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

```console
$ 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.

OpenBSD 7.3 propels Python migration from 3.9 to 3.10 and thus many py3-* packages are updated.

### 6. Configuration and syntax changes

Update some conf as needed to apply what [Configuration and syntax changes](https://www.openbsd.org/faq/upgrade73.html#ConfigChanges) describes.

### 7. Remove old files

This is a simple step. All what to do is just follow [Files to remove](https://www.openbsd.org/faq/upgrade73.html#RmFiles) in the official tutorial.

This time there is nothing.

### 8. Special packages

Check [Special packages](https://www.openbsd.org/faq/upgrade73.html#SpecialPackages) in the official tutorial. You may use some of:

- gitea
- gotweb
- postgresql
- puppet / puppetdb
- python

Be careful if you use Gitea. The detail is in the docs:

> The gitea static files location was changed

If you use PostgreSQL, you will have to upgrade it:

> Use pg_upgrade as described in the postgresql-server pkg-readme or do a dump/restore.

Well, as written before, this release accelerates Python migration from 3.9 to 3.10. Python 3.9 will disappear in the next release.

### 9. Reboot

Almost done !

```console
$ doas reboot
```

That's it.

## Conclusion

Hope the new system and you enjoy together long :)

With great appreciation to the OpenBSD project and the community.