OpenBSD Upgrade 7.0 To 7.1
Tags: openbsd, upgrade, migration, tutorial
Published: 2022-04-22 14:14:51

## Summary

The [OpenBSD](https://www.openbsd.org/) project released [7.1](https://www.openbsd.org/71.html) of their OS on 21 Apr 2022✨ It was their 52nd release.

{% twitter 1517131751478411264 %}

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

---

This post shows how to upgrade OpenBSD 7.0 to 7.1. The steps are based on [their official great guide](https://www.openbsd.org/faq/upgrade71.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/upgrade71.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/sd1x      2.9G    1.6G    1.2G    56%    /usr
```

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

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

#### Customize upgrade (optional)

[/auto_upgrade.conf](https://man.openbsd.org/sysupgrade) and [/upgrade.site](https://man.openbsd.org/upgrade.site.5) are available.

### 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:

```console
$ doas sysupgrade
```

It will print like this:

```console
Fetching from https://cdn.openbsd.org/pub/OpenBSD/7.1/amd64/
SHA256.sig   100% |***********************************************************|  2144       00:00    
Signature Verified
INSTALL.amd64 100% |**********************************************************| 43495       00:00    
base71.tgz   100% |***********************************************************|   330 MB    00:36    
bsd          100% |***********************************************************| 22339 KB    00:05    
bsd.mp       100% |***********************************************************| 22438 KB    00:06    
bsd.rd       100% |***********************************************************|  4498 KB    00:02    
comp71.tgz   100% |***********************************************************| 73366 KB    00:10    
game71.tgz   100% |***********************************************************|  2744 KB    00:01    
man71.tgz    100% |***********************************************************|  7601 KB    00:03    
xbase71.tgz  100% |***********************************************************| 55182 KB    00:08    
xfont71.tgz  100% |***********************************************************| 22965 KB    00:04    
xserv71.tgz  100% |***********************************************************| 20117 KB    00:05    
xshare71.tgz 100% |***********************************************************|  4544 KB    00:01    
Verifying sets.
Fetching updated firmware.
intel-firmware-20210608v0->20220207v0: ok
vmm-firmware-1.14.0->1.14.0p0: ok
Read shared items: ok
Upgrading.
```

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


![sysupgrade-upgrade-to-be-completed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fjppcvousfmpuqxgs9md.png)

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

```console
running rc.sysmerge
===> Updating /etc/changelist
===> Updating /etc/fbtab
===> Updating /etc/newsyslog.conf
===> Updating /etc/X11/xenodm/GiveConsole
===> Updating /etc/X11/xenodm/TakeConsole
===> Updating /etc/syslog.conf
===> Linking /etc/fonts/conf.d/10-hinting-slight.conf
===> Linking /etc/fonts/conf.d/11-lcdfilter-default.conf
===> Linking /etc/fonts/conf.d/45-generic.conf
===> Linking /etc/fonts/conf.d/60-generic.conf
--- /etc/login.conf unhandled, re-run sysmerge to merge the new version
```

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

Well, in my case, it failed:
```
syspatch: Error retrieving https://cdn.openbsd.org/pub/OpenBSD/syspatch/7.1/amd64/SHA256.sig: 404 Not Found
```

It seems because no patches on amd64 had been provided.

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

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

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

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

When you type `m` and start merge mode, you can type `l` to choose the left diff and `r` to choose the right.

After all the diffs are merged, you will be asked:

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

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

### 4. Apply `syspatch` (skippable)

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

[What's new](https://www.openbsd.org/71.html#new) section in the release page also shows "Some highlights" in "Ports and packages". For example, [PHP](https://www.php.net/) [8.1](https://www.php.net/releases/8.1/) was instroduced as well as [7.4](https://www.php.net/releases/7_4_0.php) and [8.0](https://www.php.net/releases/8.0/) :)

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.

Besides, one of them was:

```console
--- +python-2.7.18p7 -------------------
*** Python 2.7 is end-of-life and no longer receives security updates.
```

Thank you and farewell, [Python](https://www.python.org/) [2.7](https://peps.python.org/pep-0373/)... ;)

### 6. Remove old files

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

> No files need to be cleaned up for this release.

No task. Sweet 🥳

### 7. Special packages

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

- lang/python
- games/multimc

Besides, special notes on Python 3 are shown:

> The default Python 3.x flavor has changed to Python 3.9. 
> 
> ...
> 
> Python 3.8 is planned to be removed prior to the 7.2 release. 

### 8. Reboot

Almost done!

```console
$ doas reboot
```

That's it. Hope the new system brings you another happiness :)

---

With great appreciation to the OpenBSD project and the community.