freebsd-update - 13.4 RELEASE → 14.2 RELEASE - 仮想環境で実験

クラウディア 
1. 概要
2. ports の更新
3. パッチをあてる
4. GENERIC boot を用意しておく
5. バージョンアップ
6. 再起動後

1. 概要

 「VirtualBox」上に、「FreeBSD 13.4 RELEASE」のマシンがありますので、これを「FreeBSD 14.2 RELEASE」にアップデートしてみます。  アップデート前のマシンは、いくつかのサーバアプリケーションをインストールしたものです。

2. ports の更新

 放置しておいたので、アップデートの発生している、「ports」が山ほどあります。  全部更新しておきます。  数が相当数あったのと、重い「ports」が存在したので、数日かかりました。

3. パッチをあてる

 現在の状況を見てみます。

$ uname -a
FreeBSD ns.vm.sing.ne.jp 13.4-RELEASE FreeBSD 13.4-RELEASE MYKERNEL amd64
 パッチがあたっていないので、パッチをあてるところから・・・。  以下、「root」ユーザ権限で。

freebsd-update fetch
 メッセージは長々と出力されるので割愛します。

Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching public key from update1.freebsd.org... done.
Fetching metadata signature for 13.4-RELEASE from update1.freebsd.org... done.
Fetching metadata index... done.
Fetching 2 metadata files... done.
Inspecting system... done.
Preparing to download files... done.
Fetching 20 patches.....10....20 done.
Applying patches... done.
Fetching 3 files... . done.
The following files will be updated as part of updating to
13.4-RELEASE-p2:
/bin/freebsd-version
/boot/kernel/ctl.ko

・・・	略	・・・

/rescue/dumpfs
/rescue/dumpon
:
 Spaceq で進めていきます。  アップデート。

freebsd-update install
 下記のメッセージが表示されます。

Creating snapshot of existing boot environment... done.
Installing updates...
Restarting sshd after upgrade
Performing sanity check on sshd configuration.
Stopping sshd.
Waiting for PIDS: 810.
Performing sanity check on sshd configuration.
Starting sshd.
Scanning //usr/share/certs/blacklisted for certificates...
Scanning //usr/share/certs/trusted for certificates...
Scanning //usr/local/share/certs for certificates...
 done.
 
 再起動。

shutdown -r now
 更新を確認。

uname -a

FreeBSD ns.vm.sing.ne.jp 13.4-RELEASE-p1 FreeBSD 13.4-RELEASE-p1 GENERIC amd64
 「FreeBSD 13.4-RELEASE」から「FreeBSD 13.4-RELEASE-p1」へ変わっています。

4. GENERIC boot を用意しておく

 メジャーアップデートなので必要になるかもしれないので、あらかじめメディアだけは用意しておきます。  「.iso」ファイルをダウンロードして、それをマウントするのが手っ取り早い。  カーネルさえあればいいので、「DVD」メディアでなく、「CD」メディアで十分。  ダウンロード。

mkdir -pv /tmp/disk
curl https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/13.4/FreeBSD-13.4-RELEASE-amd64-disc1.iso --output /tmp/disk/FreeBSD-13.4-RELEASE-amd64-disc1.iso

5. バージョンアップ

 バージョンアップ。  「root」ユーザ権限で。

freebsd-update -r 14.2-RELEASE upgrade

Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching metadata signature for 13.4-RELEASE from update2.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata files... done.
Inspecting system... done.

The following components of FreeBSD seem to be installed:
kernel/generic kernel/generic-dbg src/src world/base world/lib32

The following components of FreeBSD do not seem to be installed:
world/base-dbg world/lib32-dbg

Does this look reasonable (y/n)?
 yEnter で答えます。  以降、メッセージはなるべく省略して、入力が必要な個所のみ記述します。  基本的に、デフォルトのコンフィグレーションファイルと異なるものは「conflicts」でっせといって下記のように表示されます。

The following file could not be merged automatically: /etc/mail/mailer.conf
Press Enter to edit this file in vi and resolve the conflicts
manually...
 Enter を押すと、「vi」が起動して、相違のある部分が表示されますので、残す部分以外は削除していきます。  起動できなくなるような編集をしない限りは、最悪、後でも編集しなおせるので、最低限必要な箇所を編集していきます。  同様に、編集の発生しているコンフィグレーションファイルが、次々に編集対象になります。  あるいは、下記のように。

The following changes, which occurred between FreeBSD 13.4-RELEASE and
FreeBSD 14.2-RELEASE have been merged into /etc/hosts:
--- current version
+++ new version
@@ -14,18 +14,18 @@
 #
 # Imaginary network.
 #10.0.0.2              myname.my.domain myname
 #10.0.0.3              myfriend.my.domain myfriend
 #
-# According to RFC 1918, you can use the following IP networks for
-# private nets which will never be connected to the Internet:
+# According to RFC 1918, you can use the following IP blocks for
+# private internets:
 #
-#      10.0.0.0        -   10.255.255.255
-#      172.16.0.0      -   172.31.255.255
-#      192.168.0.0     -   192.168.255.255
+#      10.0.0.0        -   10.255.255.255      (10/8 prefix)
+#      172.16.0.0      -   172.31.255.255      (172.16/12 prefix)
+#      192.168.0.0     -   192.168.255.255     (192.168/16 prefix)
 #
-# In case you want to be able to connect to the Internet, you need
+# In case you want to make addresses available on the Internet, you need
 # real official assigned numbers.  Do not try to invent your own network
 # numbers but instead get one from your network provider (if any) or
 # from your regional registry (ARIN, APNIC, LACNIC, RIPE NCC, or AfriNIC.)
 #
 192.168.100.196                ns.vm.sing.ne.jp
Does this look reasonable (y/n)?
 前のバージョンから、減る個所を「-」、今度のバージョンで増える箇所を「+」で表示して。  「どうね?」と、きいてきます。  たいてい、y Enter で問題ないでしょう。  上記のたぐいが、一通り終わったら、下記のように。

The following files will be removed as part of updating to
14.2-RELEASE-p0:
/boot/kernel/amr.ko
/boot/kernel/amr_cam.ko

・・・	略	・・・

/boot/kernel/qat_c62x_fw.ko
/boot/kernel/qat_common.ko
:
 更新するファイルをずらずらと表示してきます。  Space または q で進めていきます。  最終的に、下記を表示して終了します。

To install the downloaded upgrades, run 'freebsd-update [options] install'.
 ってことで、インストール。

freebsd-update install
 下記のメッセージが表示されます。

Creating snapshot of existing boot environment... done.
Installing updates...
Kernel updates have been installed.  Please reboot and run
'freebsd-update [options] install' again to finish installing updates.
 「カーネルが変わったけん、再起動して、アップデートしなされ」ということですな。  再起動。

shutdown -r now

6. 再起動後

 再起動後にログインしたときのログイン時のメッセージが

FreeBSD 14.2-RELEASE releng/14.2-n269506-c8918d6c7412 GENERIC
 となっております。  再度、「root」ユーザ権限で。

freebsd-update install
 この下のメッセージの途中は、時間がかかります。  1~2時間は、覚悟した方がいいかもです。

Creating snapshot of existing boot environment... done.
Installing updates...Removing conflicting directory ///usr/src/sys/contrib/openzfs/cmd/arc_summary
Removing conflicting directory ///usr/src/sys/contrib/openzfs/cmd/zvol_wait

Restarting sshd after upgrade
Performing sanity check on sshd configuration.
Stopping sshd.
Waiting for PIDS: 805.
Performing sanity check on sshd configuration.
Starting sshd.
Scanning /usr/share/certs/untrusted for certificates...
Scanning /usr/share/certs/trusted for certificates...
Scanning /usr/local/share/certs for certificates...

Completing this upgrade requires removing old shared object files.
Please rebuild all installed 3rd party software (e.g., programs
installed from the ports tree) and then run
'freebsd-update [options] install' again to finish installing updates.
 これを読みますと、サードパーティのソフトウェアをアップデートしたうえで、再度「freebsd-update」せよ、とのことです。  メジャーアップデートのときは、こうなりますな。  まず。

pkg bootstrap -f

The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]:
 yEnter で答えます。

Bootstrapping pkg from pkg+https://pkg.FreeBSD.org/FreeBSD:14:amd64/quarterly, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
Installing pkg-1.21.3...
package pkg is already installed, forced install
Extracting pkg-1.21.3: 100%
 「ports」更新。

git -C /usr/ports pull
portsdb -Fu
 「ports」の更新チェック。

$ portversion -v | grep '<'
[Reading data from pkg(8) ... - 442 packages found - done]
at-spi2-core-2.54.0         <  needs updating (port has 2.54.1)
cmake-core-3.31.3           <  needs updating (port has 3.31.4)
git-2.48.0                  <  needs updating (port has 2.48.1)
jpeg-turbo-3.0.4            <  needs updating (port has 3.1.0)
json-glib-1.10.0            <  needs updating (port has 1.10.6)
libunistring-1.2            <  needs updating (port has 1.3)
liburcu-0.14.0              <  needs updating (port has 0.15.0)
png-1.6.44                  <  needs updating (port has 1.6.45)
py311-importlib-resources-6.5.1  <  needs updating (port has 6.5.2)
 更新が発生しているものは、すべて、「portupgrade」しておきます。  すべての「portupgrade」が終わったら。

freebsd-update install

Creating snapshot of existing boot environment... done.
Installing updates...rmdir: ///usr/src/sys/contrib/openzfs/cmd/zvol_wait: Not a directory
rmdir: ///usr/src/sys/contrib/openzfs/cmd/arc_summary: Not a directory
 done.
 一応、念のため、再起動しますと。  起動時のメッセージでわかりました。  「FreeBSD 13.3 RELEASE」から「FreeBSD 14.1 RELEASE」へアップグレードしたときと同様です。  「libcrypto.so.111」ちゅうのと「libssl.so.111」ちゅうのが、ありません。  そのときの、裏技を使います。  「FreeBSD 13.4 RELEASE」のままのシステムがあればよいのです。仮想環境でも構わない。  用意できたら、そのマシンから、必要となるライブラリを持ってきます。  ログインユーザで。

$ sftp -i ~/.ssh/用意したシステムの証明書 用意したシステム
 で接続して、「ftp」コマンドで。

get /usr/lib/libssl.so.111      libssl.so.111.64
get /usr/lib32/libssl.so.111    libssl.so.111.32
get /lib/libcrypto.so.111       libcrypto.so.111.64
get /usr/lib32/libcrypto.so.111 libcrypto.so.111.32
bye
 「root」ユーザ権限で。  (この時点で、「sudo」も動かないので、「su」を使います)

mv libssl.so.111.64    /usr/lib/libssl.so.111
mv libssl.so.111.32    /usr/lib32/libssl.so.111
mv libcrypto.so.111.64 /lib/libcrypto.so.111
mv libcrypto.so.111.32 /usr/lib32/libcrypto.so.111
 直後から、「sudo」が機能するようになります。  「service」を見てみると、この時点で動いているものの方が少ないので、ライブラリをいれたので、再起動します。  再起動後に、「service」がすべて起動するのを確認しました。  本当は、実機でも、「FreeBSD 13.4 RELEASE」から「FreeBSD 14.2 RELEASE」へのアップグレードを行おうと思っていたのですが・・・。  「libssl.so.111」「libcrypto.so.111」の問題があるため、またもや、実機のアップグレードは、断念しました。  「FreeBSD 13.5 RELEASE」が、2025年3月11日にリリースされる予定で、「FreeBSD 13.5 RELEASE」では、この問題が解決していることを願っております。  それとも開発者の方々は、わかっておらんのかなぁ。  いよいよダメであったら、裏技でアップグレードするしかないな。
ハイスピードプラン世界最大級のオンライン英会話EF English Live【usus ウズウズ】それがだいじWi-Fi損保との違い