OpenBSD Upgrade 6.9 To 7.0
Tags: openbsd, server, upgrade, tutorial
Published: 2021-10-18 10:38:45

## Summary

[OpenBSD](https://www.openbsd.org/) 51st release on 14 Oct 2021 has arrived at [7.0](https://www.openbsd.org/70.html)✨

{% twitter 1448676254236938242 %}

<center>[What's New](https://www.openbsd.org/70.html#new)</center>

---

This post shows how to upgrade OpenBSD 6.9 to 7.0.

## Tutorial

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

1. Pre-upgrade
2. Upgrade
3. Post-upgrade
4. Reboot
5. Apply `syspatch` and update packages
6. Remove old files
7. Special packages
8. Reboot

These steps are based on [the official upgrade tutorial](https://www.openbsd.org/faq/upgrade70.html).

<center>🌊 🐡 🌊</center>

### 1. Pre-upgrade

(Reference) [(Relevant section in official tutorial)](https://www.openbsd.org/faq/upgrade70.html#BeforeUpdate)

#### Validate available disk size

`/usr` should be greater than 1.1GB.

```console
$ df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
(...)
/dev/sd1x      2.9G    1.4G    1.4G    50%    /usr
```

#### Validate it's compatible with the current usage

Check: [Configuration and syntax changes](https://www.openbsd.org/faq/upgrade70.html#ConfigChanges) and [Special packages](https://www.openbsd.org/faq/upgrade70.html#SpecialPackages).

### 2. Upgrade

Is there any problem left to upgrade? Have you already taken necessary backups?
If ready, let's just run the command! (Caution: It is not able to be stopped on the way once run.)

```console
$ doas sysupgrade
```

It will print like this:

```console
Fetching from https://cdn.openbsd.org/pub/OpenBSD/7.0/amd64/
SHA256.sig   100% |**************************************************|  2144       00:00    
Signature Verified
INSTALL.amd64 100% |*************************************************| 43523       00:00    
base70.tgz   100% |**************************************************|   302 MB    00:27    
bsd          100% |**************************************************| 21090 KB    00:06    
bsd.mp       100% |**************************************************| 21181 KB    00:09    
bsd.rd       100% |**************************************************|  4109 KB    00:01    
comp70.tgz   100% |**************************************************| 73002 KB    00:18    
game70.tgz   100% |**************************************************|  2743 KB    00:01    
man70.tgz    100% |**************************************************|  7580 KB    00:02    
xbase70.tgz  100% |**************************************************| 54408 KB    00:09    
xfont70.tgz  100% |**************************************************| 22965 KB    00:07    
xserv70.tgz  100% |**************************************************| 19659 KB    00:04    
xshare70.tgz 100% |**************************************************|  4494 KB    00:02    
Verifying sets.
Fetching updated firmware.
intel-firmware-20210216v0->20210608v0: ok
vmm-firmware-1.11.0p3->1.14.0: ok
Read shared items: ok
Upgrading.
```

It reboots the machine automatically, and the `sysupgrade` process continues.

Then `sysmerge` is run automatically, too. What I got was:

```console
--- /etc/login.conf unhandled, re-run sysmerge to merge the new version
--- /etc/ssh/sshd_config unhandled, re-run sysmerge to merge the new version
```

After all, you will see the login message including "OpenBSD 7.0 (GENERIC)".

### 3. Post-upgrade

#### 3-1. `sysmerge`

```console
$ doas sysmerge
```

`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/ssh/sshd_config`
- `/etc/login.conf`

In each merging, these options (and more) are shown:

- `d`: to preserve current file.
- `i`: to overwrite with new file.
- `m`: to merge these two files manually.

At each difference in `m` merge mode, type `l` means to choose left diff and `r` to choose right diff. Additionally, `eb` is available to "edit both diffs concatenated". After editing all to merge, confirmation will be shown saying "===> How should I deal with the merged file? [Leave it for later] e
editing merged file...". Type `i` "to install the merged file".

### 4. Reboot

Reboot might be enough only once later. Do reboot here, however, because the OS has been upgraded.

```console
$ doas reboot
```

### 5. Apply `syspatch` and update packages

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

#### 5-1. `syspatch`

`syspatch` is an important command to install binary patches officially provided 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-2. Update packages

Update the packages installed in the machine.

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

Be careful to read the output which may tell there are some important changes or tasks to do.

### 6. Remove old files

The official tutorial describes [Files to remove](https://www.openbsd.org/faq/upgrade70.html#RmFiles):

```console
$ doas rm -f /usr/X11R6/lib/libdmx.* \
	  /usr/X11R6/include/X11/extensions/dmxext.h \
	  /usr/X11R6/lib/pkgconfig/dmx.pc \
	  /usr/X11R6/man/man3/DMX*.3
```

### 7. Special packages

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

- net/freeradius

### 8. Reboot

Almost done!

```console
$ doas reboot
```

That's it. Hope the new system works fine :)

---

With gratitude to the OpenBSD project and community.