FreeBSDを13.2から14.0にアップグレードした

人気ブログランキング

にほんブログ村

注意事項:
アップグレード作業は自己責任(at your own risk)で行うこと。


昨日(2023/11/21)FreeBSD 14.0が公開されたので、早速アップグレードしてみた。

アップグレードする際には予め、必ずRelease NotesやInstallation Instructionsを読んでおくこと。

Release Notes:
https://www.freebsd.org/releases/14.0R/relnotes/

Installation Instructions:
https://www.freebsd.org/releases/14.0R/installation/

また、アップグレードの最中に生じる万が一の事態に備えて、予め最新版のインストーラーをダウンロードしてインストールメディアを用意しておくこと。
https://www.freebsd.org/where/

アップグレードの前には必ず大切なデータ等のバックアップを取っておくこと。

アップグレードの前に現バージョンの更新をしておく。
# freebsd-update fetch

# freebsd-update install

# pkg update ; pkg upgrade

# shutdown -r now

アップグレード作業はコンソール画面から実行する。

# freebsd-update upgrade -r 14.0-RELEASE

以下のメッセージが表示されたら「y」を選択する。
--------------------
The following components of FreeBSD seem to be installed:
 kernel/generic kernel/generic-dbg world/base world/base-dbg world/doc
world/lib32 world/lib32-dbg

The following components of FreeBSD do not seem to be installed:

Does this look reasonable (y/n)? y
--------------------

この後、更新が中断して以下のメッセージが表示された。
--------------------
The following file could not be merged automatically: /etc/group Press Enter to edit this file in vi and resolve the conflicts manually...
--------------------

「/etc/group」で競合が生じている。

メッセージのとおり、Enterを押すとviが起動しファイルが開く。

競合箇所は以下のとおり。
--------------------
<<<<<<< current version
# $FreeBSD$
#
wheel:*:0:root, user
wheel:*:0:root >>>>>>> 14.0-RELEASE
--------------------

この場合、自分が設定したものは「wheel:*:0:root, user」なので残し、以下の記述に変更する。
--------------------
# $FreeBSD$
#
wheel:*:0:root, user
--------------------

viの基本的な操作は以下のとおり。
1行を削除する:dd
文字を挿入する:挿入したい箇所で「i」を押してから文字を入力する
1文字を削除する:削除したい文字にカーソルを合わせ「x」を押す。
保存して閉じる:「:x」と押す
保存しないで閉じる:「:q!」と押す

「/etc/group」の競合を修正したら、再び更新が中断して以下のメッセージが表示された。
--------------------
The following file could not be merged automatically: /etc/master.passwd Press Enter to edit this file in vi and resolve the conflicts manually...
--------------------

次は「/etc/master.passwd」で競合が生じている。

競合箇所は以下のとおり。
--------------------
<<<<<<< current version
# $FreeBSD$
#
root:〜長いので省略〜 &:/root:/bin/csh
root::0:0::0:0: Charlie &:/root:/bin/sh
>>>>>>> 14.0-RELEASE
--------------------

この場合、自分が設定したものは「root:〜長いので省略〜 &:/root:/bin/csh」なので残して置きたいところだが、FreeBSD 14.0ではrootの標準シェルがsh(1)になった。
参考:
https://www.freebsd.org/releases/14.0R/relnotes/
https://cgit.freebsd.org/src/commit/?id=d410b585b6f0

そこで、自分が設定していた「/root:/bin/csh」を「/root:/bin/sh」に変更し、以下の記述とする。
--------------------
# $FreeBSD$
#
root:〜長いので省略〜 &:/root:/bin/sh
--------------------

上記の問題を修正した後も色々と質問されたが「n(No)」を選択するとアップグレードが止まるので「y(Yes)」を選択して進めていく。

以下のメッセージが表示されたら、以下を実行する。
--------------------
To install the downloaded upgrades, run "/usr/sbin/freebsd-update install".
--------------------
# freebsd-update install

以下のメッセージが表示されたら、再起動する。
--------------------
Kernel updates have been installed.  Please reboot and run
"/usr/sbin/freebsd-update install" again to finish installing updates.
--------------------
# shutdown -r now

再起動しても「X Window System」が立ち上がらずコンソール画面が表示される。

そのままログインして以下を実行する(非常に時間が掛かる)。
# freebsd-update install

終わったら再起動する。
# shutdown -r now

再起動すると再び「X Window System」が立ち上がらずコンソール画面が表示される。

そのままログインして以下を実行する(全て再インストールとなるため、非常に時間が掛かる)。
# pkg-static install -f pkg
# pkg bootstrap -f
# pkg update
# pkg upgrade

終わったら、再起動する。
# shutdown -r now

今度は「X Window System」が立ち上がるので通常どおりGUIでログインできる。

FreeBSD 14.0のリリースノートによると、以下の注意書きがある。

After a system upgrade, but before doing a zpool upgrade, the boot loader on the ESP must be updated, or the system may become unbootable.
システムのアップグレード後にzpool upgradeを実行する前にESP上のブートローダーを更新する必要があり、更新しないとシステムが起動できなくなる可能性がある。

そこでブートローダーを更新する。

アップグレード後に既存のブートローダーが設定されているか確認する。
% ls -a /boot/efi/efi/freebsd
loader.efi

もし表示されなかった場合は、以下の場所にブートローダーがあるか確認する。
% ls -a /boot

以下のように表示されたら良し。
loader.efi

既存のブートローダーが設定されていない場合は予めディレクトリを作って置く。
# mkdir -p /boot/efi/efi/freebsd

次にブートローダーを更新する。
# cp -a /boot/loader.efi /boot/efi/efi/freebsd/loader.efi

再起動して起動するか確認する。
# shutdown -r now

次にZFSストレージプールをアップグレードする。

# zpool upgrade

以下のように表示されたらアップグレードする。
--------------------
This system supports ZFS pool feature flags.

All pools are formatted using feature flags.


Some supported features are not enabled on the following pools. Once a
feature is enabled the pool may become incompatible with software
that does not support the feature. See zpool-features(7) for details.

Note that the pool 'compatibility' feature can be used to inhibit
feature upgrades.

POOL  FEATURE
---------------
zroot
      edonr
      zilsaxattr
      head_errlog
      blake3
      block_cloning
      vdev_zaps_v2
--------------------

実際にアップグレードする。
# zpool upgrade -a

以下のように表示されたら良し。
--------------------
This system supports ZFS pool feature flags.

Enabled the following features on 'zroot':
  edonr
  zilsaxattr
  head_errlog
  blake3
  block_cloning
  vdev_zaps_v2

Pool 'zroot' has the bootfs property set, you might need to update
the boot code. See gptzfsboot(8) and loader.efi(8) for details.
--------------------

更新後、再度確認してみる。
# zpool upgrade

以下のメッセージが表示されたらアップグレード完了。
--------------------
This system supports ZFS pool feature flags.

All pools are formatted using feature flags.

Every feature flags pool has all supported and requested features enabled.
--------------------

次に不要なファイルを削除する。

freebsd-updateで何度もバージョンアップを行うと「/var/db/freebsd-update」内のファイルが増える一方なので、アップグレード後に削除する。

ファイルの容量を確認する。
# du -m /var/db/freebsd-update/files

ファイルを削除する。
# echo /var/db/freebsd-update/files/* | xargs rm -f

削除が終わり、容量を確認したら以下のとおりとなった。
# du -m /var/db/freebsd-update/files
9    /var/db/freebsd-update/files

人気ブログランキング

にほんブログ村

コメント

このブログの人気の投稿

FreeBSDを14.0にアップグレードした後で気付いた異変&mixerコマンドのオプションが変更されていた件

FreeBSDで音楽プレーヤーのcmusに通知機能を追加する

FreeBSDでUSBメモリに入れた音楽ファイルの再生順を元の順番に並び替える(曲順のバラバラを解消する)方法