OpenBSD 7.2 を 7.3 へ アップグレード

作成
( 更新 )
@nabbisen

はじめに

OpenBSD プロジェクトから 2023 年 4 月 10 日に OS の 7.3 がリリースされました🌷 54 番目のリリースに当たります。

What’s New (英語) | Changelog (英語)

本記事で OpenBSD 7.2 を 7.3 にアップグレードする手順を説明します。 各手順は 公式のすばらしいガイド (英語) に基づいています。

チュートリアル

実行するコマンド一式を示しながら、ステップ・バイ・ステップ形式で書いた、アップグレード用のガイドです。

🌊 🐡 🌊

1. アップグレード前準備: 検証とカスタイマイズ

公式のチュートリアルには Before using any upgrade method (私訳: アップグレード方法に関わらずその前に行うこと) セクションが設けられています。

アップグレード方法としては sysupgrade を使うのが、たいていの場合、良いでしょう。

ディスク空き容量の確認

/usr に 1.1GB 以上の空きがあることが必要です。

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

OK のようです :)

現在の利用内容がアップグレード結果に適合することの確認

Configuration and syntax changes (私訳: 設定と構文の変更) and Special packages (私訳: 特別なパッケージ) を確認しましょう。 後者には PostgreSQL / Python / Gitea が含まれています。


バックアップ (必要な場合)

適宜、事前にバックアップを取得しておきましょう。

アップグレード内容のカスタマイズ (必要な場合)

/auto_upgrade.conf をレスポンス・ファイルとして利用できます。 OpenBSD の autoinstall のドキュメントに、次のように書かれています:

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.

(私訳: /auto_install.conf または /auto_upgrade.confbsd.rd 内蔵の RAM ディスクに存在する場合、autoinstall は、ネットブートモードで起動されたマシンのように振る舞いますが、ローカルにあるレスポンス・ファイルを使用します。両方のファイルが存在する場合、/auto_install.conf が優先されます。)

/auto_upgrade.conf の完全な内容の一例は次のようなものです:

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

この場合、xbase を除く x 一式と game が、インストール対象外になります。

それから /upgrade.site を用いた指定も可能です。


2. sysupgrade によるアップグレード

準備は良いでしょうか。

* 注意: 以下のコマンド sysupgrade は、ひとたび実行すると中断はできません。

準備ができたのでしたら、以下のコマンドを実行しましょう。実行するのはこれだけです:

$ doas sysupgrade

以下のように出力されるでしょう:

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.

マシンの再起動が自動で行われます。そして以下のように続きます:

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

もう一度再起動が行われます。その後に sysmerge が自動で実行されます。私の場合、出力内容は以下のようなものでした:

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

sshd その他のデーモンが、従来同様に起動されます。

そして syspatchsysmerge と同様に実行されます:

Checking for available binary patches...

私が実行した時は、対象は何もありませんでした。それから以下のように続きました:

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

OpenBSD/amd64 ...

login:

ついにログインメッセージが表示されます。そこには “OpenBSD 7.3 (GENERIC.MP)” とあるでしょう。

3. アップグレード後の操作: sysmerge (必要に応じて)

公式ドキュメントに アップグレード後に行うこと (英語) が書かれています。大いに参考になるでしょう。

In some cases, configuration files cannot be modified automatically. Run

# sysmerge

to check and perform these configuration changes.

ここで言われているのは、手動で sysmerge を実行することが必要な場合もある、ということです。 以下のような conf ファイルを、手動でマージすることが必要な場合もあります。気を付けてください:

  • /etc/login.conf

コマンドを実行してみましょう:

$ doas sysmerge

まず差分が出力されるでしょう。それから以下のようにたずねられます:

  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]

最初の 3 つは、以下のような挙動になります:

  • d: 現在の (ローカルの) ファイルを保持する。
  • i: sysupgrade が取得した新しいファイルでローカルを上書きする。
  • m: 対話型形式で手動でマージする。

m を入力するとマージモードが立ち上がります。一つ一つの差分について、いずれを採用するのかを確認されるでしょう:

  • l を入力すると左側が採用されます。
  • r は右側です。

その後に、マージ結果ファイルに対して、どの操作を行うのかをたずねられます:

  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]

e を入力すると、エディタが起動されてマージ結果ファイルを編集できるようになります。

i を入力すると、マージ結果ファイルをマシンにインストールします:

===> Merging /etc/login.conf (running cap_mkdb(1), needs a relog)

4. syspatch の適用 (スキップ可能)

ここからの 2 つのタスクは、日常的なメンテナンスで、システムをアップデートする時にも実施するものです。

syspatch は重要なコマンドです。OpenBSD から、必要と判明し次第都度、継続的に提供される公式のバイナリ・パッチです。

さて sysupgradesyspatch をプロセス内で実行します。そのためここで手動で実行する必要はありません:

$ # きっとスキップ可能です:
$ # doas syspatch

5. パッケージのアップデート

What’s new (英語) セクションがリリースページにありますが、そこの “Ports and packages” (私訳: Ports とパッケージ) に “Some highlights” (私訳: 注目点) が記載されています。例えば MariaDB10.9.4 になり、また PostgreSQL は 15.2 になります。

このコマンドはマシンにインストールされているすべてのパッケージをアップデートします:

$ doas pkg_add -u

大量の出力がなされるでしょう。しかし慎重に読む必要があります。終わりの部分は特に、です。そこに重要な変更点や実施すべきアクションが書かれているかもしれません。

OpenBSD 7.3 は Python 3.9 から 3.10 への移行を推進しています。それゆえ多くの py3-* パッケージが更新されます。

6. 設定と構文の変更

必要に応じて conf を更新して、Configuration and syntax changes (英語) に書かれている内容を適用しましょう。

7. 古いファイルの削除

ここはシンプルな手順です。公式チュートリアルの Files to remove (英語) (私訳: 削除すべきファイル) に書かれていることを行うだけです。

今回の対象はありません。

8. 特別なパッケージ

公式チュートリアルの Special packages (英語) を確認しましょう。使っているものがあるかもしれません:

  • gitea
  • gotweb
  • postgresql
  • puppet / puppetdb
  • python

Gitea を使っている場合、注意してください。詳細はドキュメントに書かれています:

The gitea static files location was changed

(私訳: gitea の static ファイルの場所が変わりました)

PostgreSQL を使っている場合、アップグレードが必要になるでしょう:

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

(私訳: postgresql-server pkg-readme に書かれているように pg_upgrade を使いましょう。そうで無ければ dump/restore を使いましょう。)

さて、先述の通り、今回のリリースで Python の 3.9 から 3.10 への移行が加速されています。Python 3.9 は次のリリースで消える予定です。

9. 再起動

ゴールが見えて来ました !

$ doas reboot

これで完了です。

おわりに

新しいシステムとあなたが長く楽しい時間を過ごせますように :)

OpenBSD プロジェクトとコミュニティへの深い感謝を込めつつ。

Series

OpenBSD アップグレード
  1. OpenBSD 6.9 を 7.0 へ アップグレード
  2. OpenBSD 7.1 を 7.2 へ アップグレード
  3. OpenBSD 7.2 を 7.3 へ アップグレード

Comments or feedbacks are welcomed and appreciated.