Upgrading OpenBSD From 6.6 To 6.7
Tags: openbsd, os, upgrade, migration
Published: 2020-05-21 12:14:00

## Summary

Happy news, again.
[OpenBSD](https://www.openbsd.org/) project has released [6.7](https://www.openbsd.org/67.html) 😊

{% twitter 1262748070640365577 %}

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

Cute artwork ✨

![openbsd 6.7 coral fever](https://www.openbsd.org/images/CoralFever.gif)

Almost all what to do is what nice [`sysupgrade`](https://man.openbsd.org/sysupgrade) which first appeared in 6.6 will do automatically and thankfully.

---

## Tutorial

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

### 1. Pre-upgrade

```console
$ # validate available disk size of /usr is greater than 1.1GB
$ df -h
$ # Besides, in my case, 0.8GB was successful luckily 😅 (not recommended maybe. I guess it was because /home had more than 1.1G free space.)

$ # validate "named" user and group don't exist
$ cat /etc/passwd | grep named; cat /etc/group | grep named

$ # remove old files
$ doas rm -rf /usr/libdata/perl5/*/Storable \
       /usr/libdata/perl5/*/arybase.pm \
       /usr/libdata/perl5/*/auto/arybase \
       /usr/libdata/perl5/B/Debug.pm \
       /usr/libdata/perl5/Locale/{Codes,Country,Currency,Language,Script}* \
       /usr/libdata/perl5/Math/BigInt/CalcEmu.pm \
       /usr/libdata/perl5/unicore/To/_PerlWB.pl \
       /usr/libdata/perl5/unicore/lib/GCB/EB.pl \
       /usr/libdata/perl5/unicore/lib/GCB/GAZ.pl \
       /usr/share/man/man3p/B::Debug.3p \
       /usr/share/man/man3p/Locale::{Codes*,Country,Currency,Language,Script}.3p \
       /usr/share/man/man3p/Math::BigInt::CalcEmu.3p \
       /usr/share/man/man3p/arybase.3p

$ # remove moved files
$ doas rm -f /usr/sbin/{dig,host,nslookup}
```

##### References

- [Before upgrade](https://www.openbsd.org/faq/upgrade67.html#Before)
- [Files to remove](https://www.openbsd.org/faq/upgrade67.html#RmFiles)

### 2. Upgrade

```console
$ doas sysupgrade

$ # reboot automatically
$ # and sysupgrade continues

$ doas syspatch; doas pkg_add -u
$ doas reboot
```

### 3. Post-upgrade

__Be careful about the packages you have added or configured; Make sure all of the changes are compatible with yours.__
In my case, managing PostgreSQL databases was required, because it was upgraded from 11 to 12. 

##### References

- __[Special packages](https://www.openbsd.org/faq/upgrade67.html#SpecPkg)__
    - You had better check them before running `pkg_add -u`. `/usr/local/share/doc/pkg-readmes/postgresql-server` was helpful.

---

## Detailed description about "2. Upgrade"

### 2-1. `sysupgrade`

If you use SSH, remember your connection will be closed soon after running `sysupgrade`:

```console
$ doas sysupgrade
...
Connection to xxx.xxx.xxx.xxx closed by remote host.
Connection to xxx.xxx.xxx.xxx closed.
```

In this case, you may not either connect again via SSH. Don't panic. It's because the installation is still in progress like this:

![upgrade in progress](https://dev-to-uploads.s3.amazonaws.com/i/dxrm9uorhmm73fvutdr4.png)

In order to see it via network, VNC is available.
To use SSH, wait minutes, and you will be able to connet again.

Well, `sysupgrade` finishes like this:

```console
...

Installing comp67.tgz   100% |**************************| 74451 KB    00:35    
Installing man67.tgz    100% |**************************|  7464 KB    00:11    
Installing game67.tgz   100% |**************************|  2745 KB    00:01    
Installing xbase67.tgz  100% |**************************| 22912 KB    00:08    
Installing xshare67.tgz 100% |**************************|  4499 KB    00:17    
Installing xfont67.tgz  100% |**************************| 39342 KB    00:22    
Installing xserv67.tgz  100% |**************************| 16767 KB    00:03    
Location of sets? (disk http nfs or 'done') [done] done
Making all device nodes... done.
Relinking to create unique kernel... done.

CONGRATULATIONS! Your OpenBSD upgrade has been successfully completed!

syncing disks... done
rebooting...

...

running rc.sysmerge
===> Adding the _rpki-client group
===> Adding the _rpki-client user
===> Updating /etc/changelist
===> Updating /etc/login.conf
===> Updating /etc/mail/smtpd.conf
===> Updating /etc/npppd/npppd.conf
===> Updating /etc/ntpd.conf
===> Updating /etc/skel/.cshrc
===> Updating /etc/skel/.profile
===> Updating /etc/ssl/cert.pem
===> Updating /var/cron/tabs/root
===> Installing /var/db/rpki-client/openbgpd
===> Updating /var/unbound/etc/unbound.conf
===> Updating /etc/mail/aliases

...
OpenBSD/amd64 (openbsd-67-amd64.my.domain) (console)

login:
```

Here, you can connect again. "OpenBSD 6.7 (GENERIC)" will welcome!

```console
Last login: Thu May 21 17:34:42 2020 from xxx.xxx.xxx.xxx
OpenBSD 6.7 (GENERIC) #179: Thu May  7 11:02:37 MDT 2020

Welcome to OpenBSD: The proactively secure Unix-like operating system.

Please use the sendbug(1) utility to report bugs in the system.
Before reporting a bug, please try to reproduce it with the latest
version of the code.  With bug reports, please try to ensure that
enough information to reproduce the problem is enclosed, and if a
known fix for it exists, include that as well.

Welcome to fish, the friendly interactive shell
```

### 2-2. `syspatch` + `pkg_add -u`

After `sysupgrade`, run `syspatch` first:

```console
$ doas syspatch
Get/Verify syspatch67-001_wscons.tgz 100% |*************************|   128 KB    00:00    
Installing patch 001_wscons
Get/Verify syspatch67-002_rpki.tgz 100% |***************************| 41490       00:00    
Installing patch 002_rpki
Get/Verify syspatch67-003_ssh.tgz 100% |****************************|   187 KB    00:00    
Installing patch 003_ssh
Get/Verify syspatch67-004_libssl.tgz 100% |*************************|  4442 KB    00:00    
Installing patch 004_libssl
Get/Verify syspatch67-005_unbound... 100% |*************************|  3411 KB    00:00    
Installing patch 005_unbound
Relinking to create unique kernel... done; reboot to load the new kernel
Errata can be reviewed under /var/syspatch
```

Then, the turn of `pkg_add -u`.
You had better check "[Special packages](https://www.openbsd.org/faq/upgrade67.html/#SpecPkg)" beforehand.
So many packages will be updated/upgraded.
Be careful about the output which sometimes includes important information.

```console
$ doas pkg_add -u
quirks-3.325 signed on 2020-05-09T19:52:28Z
quirks-3.185->3.325: ok
...
postgresql-client-11.7->12.2 forward dependencies:
| Dependency of postgresql-server-11.7 on postgresql-client-=11.7 doesn't match
Merging postgresql-server-11.7->12.2 (ok)
postgresql-server-12.2: Make sure your existing database is backed up.
Do you want to update now ? [y/N/a] y
postgresql-client+postgresql-server-11.7->12.2: ok
...
Running tags: ok
Read shared items: ok
New and changed readme(s):
	/usr/local/share/doc/pkg-readmes/postgresql-server
--- -clamav-0.102.2 -------------------
You should also run rm -fr /var/db/clamav/*
You should also run rm -fr /var/spool/clamav/*
You should also run rm -fr /var/clamav/quarantine/*
You should also run rm -fr /var/clamav/tmp/*
--- -clamav-unofficial-sigs-4.9.2p2 -------------------
You should also run rm -rf /var/db/clamav-unofficial-sigs/*
--- -fish-3.0.2p1 -------------------
Error deleting directory /usr/local/lib/python3.6: Directory not empty
--- -gnome-icon-theme-3.12.0p5 -------------------
Files kept as partial-gnome-icon-theme-3.12.0p5 package
--- -libxml-2.9.9 -------------------
Remember to update /var/db/xmlcatalog
--- -partial-gnome-icon-theme-3.12.0p5.1 -------------------
Files kept as partial-gnome-icon-theme-3.12.0p5.1.1 package
--- -php-7.3.17 -------------------
You should also run rm -f /etc/php-7.3.sample/*
You should also run rm -f /etc/php-fpm.d/*
```

You can find examples for the latest version in the directories such as `/usr/local/share/examples`, `/etc/examples/` and `/var/www/roundcubemail/config`.

---

Happy spending time with OBSD 😊