OpenBSD Upgrade 7.3 to 7.4
Tags: openbsd, upgrade, migration, server
Published: 2024-02-17 02:08:39

## Summary

The [OpenBSD](https://www.openbsd.org/) project released [7.4](https://www.openbsd.org/74.html) of their OS on 16 Oct 2023 as their 55th release 💫

{% twitter 1713973815951409520 %}

<center><a href="https://www.openbsd.org/74.html#new">What's New</a> | <a href="https://www.openbsd.org/plus74.html">Changelog</a></center>

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

## Tutorial

Here is a step-by-step guide with a set of command-lines to run.

<center>🌷 🐡 🌅</center>

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

The official tutorial includes [Before using any upgrade method](https://www.openbsd.org/faq/upgrade74.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    2.5G    4.7G    35%    /usr
```

OK :)

#### Validate compatibility with the current usage

See [Configuration and syntax changes](https://www.openbsd.org/faq/upgrade74.html#ConfigChanges) and [Special packages](https://www.openbsd.org/faq/upgrade74.html#SpecialPackages).    
The latter this time includes changes around [NextCloud](https://nextcloud.com/) 23 and [Tor Browser](https://www.torproject.org/download/) prior to 12.5, both of which should be upgraded beforehand.

---

#### Backups (Optional)

You might have to create some backups.

#### Customize upgrade (Optional)

[/auto_upgrade.conf](https://man.openbsd.org/sysupgrade) is available as the response file.

Of course, you can skip this and go next if it's unnecessary. The default behavior is sufficient in most cases.

Well, 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** once it is run.

Let's just run it, if ready:

```console
$ doas sysupgrade
```

It will print out like this:

```console
Fetching from https://cdn.openbsd.org/pub/OpenBSD/7.4/amd64/
SHA256.sig   100% |********************************************************************|  2144       00:00    
Signature Verified
INSTALL.amd64 100% |*******************************************************************| 44949       00:00    
base74.tgz   100% |********************************************************************|   368 MB    00:32    
bsd          100% |********************************************************************| 24750 KB    00:03    
bsd.mp       100% |********************************************************************| 24845 KB    00:03    
bsd.rd       100% |********************************************************************|  4550 KB    00:01    
comp74.tgz   100% |********************************************************************| 75644 KB    00:09    
game74.tgz   100% |********************************************************************|  2748 KB    00:01    
man74.tgz    100% |********************************************************************|  7831 KB    00:00    
xbase74.tgz  100% |********************************************************************| 57135 KB    00:05    
xfont74.tgz  100% |********************************************************************| 22968 KB    00:21    
xserv74.tgz  100% |********************************************************************| 14951 KB    00:02    
xshare74.tgz 100% |********************************************************************|  4578 KB    00:01    
Verifying sets.
Fetching updated firmware.
fw_update: added none; updated intel; kept none
Upgrading.
```

The machine will reboot and upgrade the system. It will reboot again and [`sysmerge`](https://man.openbsd.org/sysmerge) will follow automatically. Then the daemons such as `sshd` will be started as usual. It will print out "Checking for available binary patches...", and you will see "Run syspatch(8) to install:" if there are.

Finally, you will see:

```
starting local daemons: cron.
Sun Feb 17 10:24:19 JST 2024

OpenBSD/amd64 ...

login:
```

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

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

The official documentation [describes on them](https://www.openbsd.org/faq/upgrade74.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:

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

```console
$ doas syspatch
```

### 5. Update packages

[What's new](https://www.openbsd.org/74.html#new) section in the release page also shows "Some highlights" in "Ports and packages". For example, [pfsync(4)](https://man.openbsd.org/pfsync.4) was rewritten and became good helper to [pf(4)](https://man.openbsd.org/pf.4). Also, VMM/VMD was improved this time, too.

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

```console
$ doas pkg_add -u
```

You will see a lot printed out, but should be careful to read, especially the trailings. They may tell there are some important changes or tasks to do. As to me, I always check if [fish](https://fishshell.com/), my default shell, starts normally, because I have experienced trouble which crashed it with [Python](https://www.python.org/) upgrade 😅 

### 6. Configuration and syntax changes

Update some conf as needed to apply what [Configuration and syntax changes](https://www.openbsd.org/faq/upgrade74.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/upgrade74.html#RmFiles) in the official tutorial.

There is nothing this time.

### 8. Special packages

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

- borgbackup 1.1.x, 1.2.x
- exim
- influxdb
- nextcloud 23
- telegraf
- tor browser prior to 12.5

### 9. Reboot

Almost done ! Finally and optionally run:

```console
$ doas reboot
```

## Conclusion

Hope the new system and you enjoy together long :)

With great appreciation to the OpenBSD project and the community.