kraftsrv.net

Raspberry Pi 上の FreeBSD 環境のマイナーアップグレード

Raspberry Pi 上の FreeBSD 13.0-RELEASE 環境を 13.1-RELEASE にマイナーアップグレードする手順です。
FreeBSD 13 から 64-bit ARMv8 (aarch64) が Tier 1 Architecture となりましたため、freebsd-update コマンドでアップグレードを行うことが可能となります。

アップグレード前の確認

OS リリースレベルとバージョン

アップグレード前の OS リリースレベルとバージョンを確認します。

OS リリースレベル

root@raspberrypi:~ # uname -r
13.0-RELEASE-p11

カーネルのバージョン

root@raspberrypi:~ # freebsd-version -k
13.0-RELEASE-p11

ユーザランドのバージョン

root@raspberrypi:~ # freebsd-version -u
13.0-RELEASE-p11

freebsd-update の設定

本稿では freebsd-update の設定は全てデフォルトを使用することとします。
以下は /etc/freebsd-update.conf の設定内容となります。

KeyPrint 800651ef4b4c71c27e60786d7b487188970f4b4169cc055784e21eb71d410cc5
ServerName update.FreeBSD.org
Components src world kernel
IgnorePaths
IDSIgnorePaths /usr/share/man/cat
IDSIgnorePaths /usr/share/man/whatis
IDSIgnorePaths /var/db/locate.database
IDSIgnorePaths /var/log
UpdateIfUnmodified /etc/ /var/ /root/ /.cshrc /.profile
MergeChanges /etc/ /boot/device.hints
# WorkDir /var/db/freebsd-update
# MailTo root
# AllowAdd yes
# AllowDelete yes
# KeepModifiedMetadata yes
# StrictComponents no
# BackupKernel yes
# BackupKernelDir /boot/kernel.old
# BackupKernelSymbolFiles no

アップグレードの準備

ファイルの取得

13.1-RELEASE へのアップグレードに必要なファイルを取得します。

root@raspberrypi:~ # freebsd-update -r 13.1-RELEASE upgrade

インストールされたコンポーネント確認のプロンプトが表示されます。
『y』を入力して Enter を押下します。

src component not installed, skipped
Looking up update.FreeBSD.org mirrors... 2 mirrors found.
Fetching metadata signature for 13.0-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 world/base world/base-dbg

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

Does this look reasonable (y/n)? y

ファイルの取得処理が行われます。

Fetching metadata signature for 13.1-RELEASE from update2.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.
Inspecting system... done.
Fetching files from 13.0-RELEASE for merging... done.
Preparing to download files... done.
Fetching 5279 patches.....10....20....30....40....50....60....70....80....90....100....110....120....130....140....150..
....
....
10....5220....5230....5240....5250....5260....5270.... done.
Applying patches... done.
Fetching 463 files... ....10....20....30....40....50....60....70....80....90....100....110....120....130....140....150..
..160....170....180....190....200....210....220....230....240....250....260....270....280....290....300....310....320...
.330....340....350....360....370....380....390....400....410....420....430....440....450....460. done.
Attempting to automatically merge changes in files... done.

/etc/ttys のマージが自動的に行われなかったため、手動での編集が必要であるメッセージが表示されます。
そのまま Enter を押下します。

The following file could not be merged automatically: /etc/ttys
Press Enter to edit this file in vi and resolve the conflicts
manually...

エディタ (vi) が起動して /etc/ttys の編集画面が表示されます。
※エディタの編集画面は行番号の表示を行っています。

     28 # If console is marked "insecure", then init will ask for the root password
     29 # when going to single-user mode.
     30 console none                            unknown off secure
     31 #
     32 ttyv0   "/usr/libexec/getty Pc"         xterm   onifexists secure
     33 # Virtual terminals
     34 ttyv1   "/usr/libexec/getty Pc"         xterm   onifexists secure
     35 ttyv2   "/usr/libexec/getty Pc"         xterm   onifexists secure
     36 ttyv3   "/usr/libexec/getty Pc"         xterm   onifexists secure
     37 ttyv4   "/usr/libexec/getty Pc"         xterm   onifexists secure
     38 ttyv5   "/usr/libexec/getty Pc"         xterm   onifexists secure
     39 ttyv6   "/usr/libexec/getty Pc"         xterm   onifexists secure
     40 ttyv7   "/usr/libexec/getty Pc"         xterm   onifexists secure
     41 ttyv8   "/usr/local/bin/xdm -nodaemon"  xterm   off secure
     42 # Serial terminals
     43 # The 'dialup' keyword identifies dialin lines to login, fingerd etc.
     44 ttyu0   "/usr/libexec/getty 3wire"      vt100   onifconsole secure
     45 ttyu1   "/usr/libexec/getty 3wire"      vt100   onifconsole secure
     46 ttyu2   "/usr/libexec/getty 3wire"      vt100   onifconsole secure
     47 ttyu3   "/usr/libexec/getty 3wire"      vt100   onifconsole secure
     48 # Dumb console
     49 dcons   "/usr/libexec/getty std.9600"   vt100   off secure
     50 <<<<<<< current version
     51 # USB OTG virtual serial port
     52 ttyU0   "/usr/libexec/getty 3wire"      vt100   onifconsole  secure
     53 ttyU1   "/usr/libexec/getty 3wire"      vt100   onifconsole  secure
     54 =======
     55 # Xen Virtual console
     56 xc0     "/usr/libexec/getty Pc"         xterm   onifconsole secure
     57 # RISC-V HTIF console
     58 rcons   "/usr/libexec/getty std.9600"   vt100   onifconsole secure
     59 >>>>>>> 13.1-RELEASE

本稿では以下の内容となるよう編集を行うこととします。
編集後、エディタを保存終了します。

     28 # If console is marked "insecure", then init will ask for the root password
     29 # when going to single-user mode.
     30 console none                            unknown off secure
     31 #
     32 ttyv0   "/usr/libexec/getty Pc"         xterm   onifexists secure
     33 # Virtual terminals
     34 ttyv1   "/usr/libexec/getty Pc"         xterm   onifexists secure
     35 ttyv2   "/usr/libexec/getty Pc"         xterm   onifexists secure
     36 ttyv3   "/usr/libexec/getty Pc"         xterm   onifexists secure
     37 ttyv4   "/usr/libexec/getty Pc"         xterm   onifexists secure
     38 ttyv5   "/usr/libexec/getty Pc"         xterm   onifexists secure
     39 ttyv6   "/usr/libexec/getty Pc"         xterm   onifexists secure
     40 ttyv7   "/usr/libexec/getty Pc"         xterm   onifexists secure
     41 ttyv8   "/usr/local/bin/xdm -nodaemon"  xterm   off secure
     42 # Serial terminals
     43 # The 'dialup' keyword identifies dialin lines to login, fingerd etc.
     44 ttyu0   "/usr/libexec/getty 3wire"      vt100   onifconsole secure
     45 ttyu1   "/usr/libexec/getty 3wire"      vt100   onifconsole secure
     46 ttyu2   "/usr/libexec/getty 3wire"      vt100   onifconsole secure
     47 ttyu3   "/usr/libexec/getty 3wire"      vt100   onifconsole secure
     48 # Dumb console
     49 dcons   "/usr/libexec/getty std.9600"   vt100   off secure
     50 # Xen Virtual console
     51 xc0     "/usr/libexec/getty Pc"         xterm   onifconsole secure
     52 # RISC-V HTIF console
     53 rcons   "/usr/libexec/getty std.9600"   vt100   onifconsole secure
     54 # USB OTG virtual serial port
     55 ttyU0   "/usr/libexec/getty 3wire"      vt100   onifconsole  secure
     56 ttyU1   "/usr/libexec/getty 3wire"      vt100   onifconsole  secure

/etc/devd.conf のアップグレードに因る差分確認のプロンプトが表示されます。
『y』を入力して Enter を押下します。

The following changes, which occurred between FreeBSD 13.0-RELEASE and
FreeBSD 13.1-RELEASE have been merged into /etc/devd.conf:
--- current version
+++ new version
@@ -15,27 +15,23 @@
        directory "/etc/devd";
        directory "/usr/local/etc/devd";
        pid-file "/var/run/devd.pid";

        # Setup some shorthand for regex that we use later in the file.
-       #XXX Yes, these are gross -- imp
-       set scsi-controller-regex
-               "(aac|aacraid|ahc|ahd|amr|ciss|\
-               esp|ida|iir|ips|isp|mlx|mly|mpr|mps|mpt|sym|trm)\
-               [0-9]+";
+       #XXX Yes, this is gross -- imp
        set wifi-driver-regex
-               "(ath|bwi|bwn|ipw|iwi|iwm|iwn|malo|mwl|otus|ral|rsu|rtwn|rum|\
-               run|uath|upgt|ural|urtw|wi|wpi|wtap|zyd)[0-9]+";
+               "(ath|bwi|bwn|ipw|iwlwifi|iwi|iwm|iwn|malo|mwl|otus|ral|rsu|rtw|rtwn|rum|\
+               run|uath|upgt|ural|urtw|wpi|wtap|zyd)[0-9]+";
 };

 # Note that the attach/detach with the highest value wins, so that one can
 # override these general rules.

 #
 # Configure the interface on attach.  Due to a historical accident, this
 # script is called pccard_ether. We omit the usbus devices because those
-# devices are assocaited with the USB Bus and provide an ifnet device to
+# devices are associated with the USB Bus and provide an ifnet device to
 # allow usb traffic to be captured with usbdump(8).
 #
 # NB: DETACH events are ignored; the kernel should handle all cleanup
 #     (routes, arp cache).  Beware of races against immediate create
 #     of a device with the same name; e.g.
@@ -153,32 +149,10 @@
        match "cdev" "ums[0-9]+";

        action "service moused stop $cdev";
 };

-# This entry starts the ColdSync tool in daemon mode. Make sure you have an up
-# to date /usr/local/etc/palms. We override the 'listen' settings for port and
-# type in /usr/local/etc/coldsync.conf.
-notify 100 {
-       match "system"          "USB";
-       match "subsystem"       "DEVICE";
-       match "type"            "ATTACH";
-       match "vendor"          "0x082d";
-       match "product"         "0x0100";
-       match "release"         "0x0100";
-       action "/usr/local/bin/coldsync -md -p /dev/$cdev -t usb";
-};
-
-#
-# Rescan SCSI device-names on attach, but not detach.  However, it is
-# disabled by default due to reports of problems.
-#
-attach 0 {
-       device-name "$scsi-controller-regex";
-//     action "camcontrol rescan all";
-};
-
 # Don't even try to second guess what to do about drivers that don't
 # match here.  Instead, pass it off to syslog.  Commented out for the
 # moment, as the pnpinfo variable isn't set in devd yet.  Individual
 # variables within the bus supplied pnpinfo are set.
 nomatch 0 {
@@ -190,28 +164,13 @@
        match "bus" "uhub[0-9]+";
        action "logger Unknown USB device: vendor $vendor product $product \
                bus $bus";
 };

-# Some PC-CARDs don't offer numerical manufacturer/product IDs, just
+# Some Cardbus cards don't offer numerical manufacturer/product IDs, just
 # show the CIS info there.
-nomatch 20 {
-       match "bus" "pccard[0-9]+";
-       match "manufacturer" "0xffffffff";
-       match "product" "0xffffffff";
-       action "logger Unknown PCCARD device: CISproduct $cisproduct \
-               CIS-vendor $cisvendor bus $bus";
-};
-
 nomatch 10 {
-       match "bus" "pccard[0-9]+";
-       action "logger Unknown PCCARD device: manufacturer $manufacturer \
-               product $product CISproduct $cisproduct CIS-vendor \
-               $cisvendor bus $bus";
-};
-
-nomatch 10 {
        match "bus" "cardbus[0-9]+";
        action "logger Unknown Cardbus device: device $device class $class \
                vendor $vendor bus $bus";
 };

@@ -244,30 +203,10 @@
        match "subsystem"       "Resume";
        action "/etc/rc.resume acpi $notify";
 };

 /* EXAMPLES TO END OF FILE
-
-# An example of something that a vendor might install if you were to
-# add their device.  This might reside in /usr/local/etc/devd/deqna.conf.
-# A deqna is, in this hypothetical example, a pccard ethernet-like device.
-# Students of history may know other devices by this name, and will get
-# the in-jokes in this entry.
-nomatch 10 {
-       match "bus" "pccard[0-9]+";
-       match "manufacturer" "0x1234";
-       match "product" "0x2323";
-       action "kldload -n if_deqna";
-};
-attach 10 {
-       device-name "deqna[0-9]+";
-       action "/etc/pccard_ether $device-name start";
-};
-detach 10 {
-       device-name "deqna[0-9]+";
-       action "/etc/pccard_ether $device-name stop";
-};

 # Examples of notify hooks.  A notify is a generic way for a kernel
 # subsystem to send event notification to userland.

 # Here are some examples of ACPI notify handlers.  ACPI subsystems that
Does this look reasonable (y/n)? y

/etc/group のアップグレードに因る差分確認のプロンプトが表示されます。
『y』を入力して Enter を押下します。

The following changes, which occurred between FreeBSD 13.0-RELEASE and
FreeBSD 13.1-RELEASE have been merged into /etc/group:
--- current version
+++ new version
@@ -16,10 +16,12 @@
 sshd:*:22:
 smmsp:*:25:
 mailnull:*:26:
 guest:*:31:
 video:*:44:
+realtime:*:47:
+idletime:*:48:
 bind:*:53:
 unbound:*:59:
 proxy:*:62:
 authpf:*:63:
 _pflogd:*:64:
Does this look reasonable (y/n)? y

/etc/ttys のアップグレードに因る差分確認のプロンプトが表示されます。
『y』を入力して Enter を押下します。

The following changes, which occurred between FreeBSD 13.0-RELEASE and
FreeBSD 13.1-RELEASE have been merged into /etc/ttys:
--- current version
+++ new version
@@ -36,17 +36,21 @@
 ttyv3  "/usr/libexec/getty Pc"         xterm   onifexists secure
 ttyv4  "/usr/libexec/getty Pc"         xterm   onifexists secure
 ttyv5  "/usr/libexec/getty Pc"         xterm   onifexists secure
 ttyv6  "/usr/libexec/getty Pc"         xterm   onifexists secure
 ttyv7  "/usr/libexec/getty Pc"         xterm   onifexists secure
-#ttyv8 "/usr/local/bin/xdm -nodaemon"  xterm   onifexists secure
+ttyv8  "/usr/local/bin/xdm -nodaemon"  xterm   off secure
 # Serial terminals
 # The 'dialup' keyword identifies dialin lines to login, fingerd etc.
-ttyu0  "/usr/libexec/getty 3wire"      vt100   onifconsole  secure
-ttyu1  "/usr/libexec/getty 3wire"      vt100   onifconsole  secure
-ttyu2  "/usr/libexec/getty 3wire"      vt100   onifconsole  secure
-ttyu3  "/usr/libexec/getty 3wire"      vt100   onifconsole  secure
+ttyu0  "/usr/libexec/getty 3wire"      vt100   onifconsole secure
+ttyu1  "/usr/libexec/getty 3wire"      vt100   onifconsole secure
+ttyu2  "/usr/libexec/getty 3wire"      vt100   onifconsole secure
+ttyu3  "/usr/libexec/getty 3wire"      vt100   onifconsole secure
 # Dumb console
 dcons  "/usr/libexec/getty std.9600"   vt100   off secure
+# Xen Virtual console
+xc0    "/usr/libexec/getty Pc"         xterm   onifconsole secure
+# RISC-V HTIF console
+rcons  "/usr/libexec/getty std.9600"   vt100   onifconsole secure
 # USB OTG virtual serial port
 ttyU0  "/usr/libexec/getty 3wire"      vt100   onifconsole  secure
 ttyU1  "/usr/libexec/getty 3wire"      vt100   onifconsole  secure
Does this look reasonable (y/n)? y

アップグレードに因り削除されるファイルの一覧が表示されます。
内容は PAGER に渡されるため、末尾の『:』の表示には『q』を押下して PAGER を終了します。

The following files will be removed as part of updating to
13.1-RELEASE-p0:
/usr/bin/clang-tblgen
/usr/bin/lldb-tblgen
/usr/bin/llvm-tblgen
/usr/bin/svnlite
/usr/bin/svnliteadmin
/usr/bin/svnlitebench
/usr/bin/svnlitedumpfilter
/usr/bin/svnlitefsfs
/usr/bin/svnlitelook
/usr/bin/svnlitemucc
/usr/bin/svnliterdump
/usr/bin/svnliteserve
/usr/bin/svnlitesync
/usr/bin/svnliteversion
/usr/include/c++/v1/__functional_03
/usr/include/c++/v1/__functional_base_03
/usr/include/c++/v1/__sso_allocator
/usr/include/c++/v1/tr1
/usr/include/c++/v1/tr1/__bit_reference
/usr/include/c++/v1/tr1/__bsd_locale_defaults.h
/usr/include/c++/v1/tr1/__bsd_locale_fallbacks.h
/usr/include/c++/v1/tr1/__config
/usr/include/c++/v1/tr1/__debug
/usr/include/c++/v1/tr1/__errc
/usr/include/c++/v1/tr1/__functional_03
/usr/include/c++/v1/tr1/__functional_base
/usr/include/c++/v1/tr1/__functional_base_03
/usr/include/c++/v1/tr1/__hash_table
/usr/include/c++/v1/tr1/__libcpp_version
/usr/include/c++/v1/tr1/__locale
/usr/include/c++/v1/tr1/__mutex_base
/usr/include/c++/v1/tr1/__node_handle
/usr/include/c++/v1/tr1/__nullptr
/usr/include/c++/v1/tr1/__split_buffer
/usr/include/c++/v1/tr1/__sso_allocator
/usr/include/c++/v1/tr1/__std_stream
/usr/include/c++/v1/tr1/__string
:

アップグレードに因り追加されるファイルの一覧が表示されます。
『q』を押下して PAGER を終了します。

The following files will be added as part of updating to
13.1-RELEASE-p0:
/boot/dtb/overlays/rk3328-analog-sound.dtbo
/boot/dtb/overlays/rk3328-i2c0.dtbo
/boot/dtb/overlays/rk3328-uart1.dtbo
/boot/dtb/overlays/rk3399-mmc0-disable.dtbo
/boot/dtb/overlays/rk3399-mmc1-disable.dtbo
/boot/dtb/overlays/rk3399-sdhci-disable.dtbo
/boot/kernel/cxgbei.ko
/boot/kernel/if_iwlwifi.ko
/boot/kernel/iwlwifi-3160-17.ucode.ko
/boot/kernel/iwlwifi-3168-29.ucode.ko
/boot/kernel/iwlwifi-7260-17.ucode.ko
/boot/kernel/iwlwifi-7265-17.ucode.ko
/boot/kernel/iwlwifi-7265D-29.ucode.ko
/boot/kernel/iwlwifi-8000C-36.ucode.ko
/boot/kernel/iwlwifi-8265-36.ucode.ko
/boot/kernel/iwlwifi-9000-pu-b0-jf-b0-46.ucode.ko
/boot/kernel/iwlwifi-9260-th-b0-jf-b0-46.ucode.ko
/boot/kernel/iwlwifi-Qu-b0-hr-b0-68.ucode.ko
/boot/kernel/iwlwifi-Qu-b0-jf-b0-68.ucode.ko
/boot/kernel/iwlwifi-Qu-c0-hr-b0-68.ucode.ko
/boot/kernel/iwlwifi-Qu-c0-jf-b0-68.ucode.ko
/boot/kernel/iwlwifi-QuZ-a0-hr-b0-68.ucode.ko
/boot/kernel/iwlwifi-QuZ-a0-jf-b0-68.ucode.ko
/boot/kernel/iwlwifi-cc-a0-68.ucode.ko
/boot/kernel/iwlwifi-so-a0-gf-a0-68.ucode.ko
/boot/kernel/iwlwifi-so-a0-gf-a0.pnvm.ko
/boot/kernel/iwlwifi-so-a0-gf4-a0-68.ucode.ko
/boot/kernel/iwlwifi-so-a0-gf4-a0.pnvm.ko
/boot/kernel/iwlwifi-so-a0-hr-b0-68.ucode.ko
/boot/kernel/iwlwifi-so-a0-jf-b0-68.ucode.ko
/boot/kernel/iwlwifi-ty-a0-gf-a0-68.ucode.ko
/boot/kernel/iwlwifi-ty-a0-gf-a0.pnvm.ko
/boot/kernel/linuxkpi_wlan.ko
/boot/kernel/mac_priority.ko
/boot/kernel/max44009.ko
/boot/kernel/ng_vlan_rotate.ko
/boot/kernel/pca954x.ko
/boot/kernel/pcf8574.ko
/boot/kernel/pcf8591.ko
/boot/kernel/sdhci_fdt.ko
/boot/kernel/t4_tom.ko
/etc/jail.conf.d
/etc/rc.d/sysctl_lastload
/etc/rc.d/tlsclntd
/etc/rc.d/tlsservd
/etc/rc.d/zfskeys
/etc/zfs/compatibility.d
/sbin/dnctl
/sbin/md5sum
:

アップグレードに因り更新されるファイルの一覧が表示されます。
『q』を押下して PAGER を終了します。

The following files will be updated as part of updating to
13.1-RELEASE-p0:
/.profile
/bin/[
/bin/cat
/bin/chflags
/bin/chio
/bin/chmod
/bin/cp
/bin/csh
/bin/date
/bin/dd
/bin/df
/bin/domainname
/bin/echo
/bin/ed
/bin/expr
/bin/freebsd-version
/bin/getfacl
/bin/hostname
/bin/kenv
/bin/kill
/bin/link
/bin/ln
/bin/ls
/bin/mkdir
/bin/mv
/bin/pax
/bin/pgrep
/bin/pkill
/bin/ps
/bin/pwait
/bin/pwd
/bin/realpath
/bin/red
/bin/rm
/bin/rmail
/bin/rmdir
/bin/setfacl
:

アップグレードのインストールを実行するコマンドのメッセージが表示されます。

To install the downloaded upgrades, run "/usr/sbin/freebsd-update install".

アップグレードのインストール

ファイルのインストール

取得したファイルをインストール (1 回目の freebsd-update コマンドを実行) します。

root@raspberrypi:~ # freebsd-update install
src component not installed, skipped
Installing updates...
Kernel updates have been installed.  Please reboot and run
"/usr/sbin/freebsd-update install" again to finish installing updates.

再起動

FreeBSD を再起動します。

root@raspberrypi:~ # shutdown -r now

ユーザランドのアップグレードのインストール

ファイルのインストール

取得したファイルをインストール (2 回目の freebsd-update コマンドを実行) します。

root@raspberrypi:~ # freebsd-update install
src component not installed, skipped
Installing updates...install: ///var/db/etcupdate/current/etc/rc.d/sysctl_lastload: No such file or directory
install: ///var/db/etcupdate/current/etc/rc.d/tlsclntd: No such file or directory
install: ///var/db/etcupdate/current/etc/rc.d/tlsservd: No such file or directory
install: ///var/db/etcupdate/current/etc/rc.d/zfskeys: No such file or directory
Scanning //usr/share/certs/blacklisted for certificates...
Scanning //usr/share/certs/trusted for certificates...
 done.

再起動

FreeBSD を再起動します。

root@raspberrypi:~ # shutdown -r now

アップグレード後の確認

OS リリースレベルとバージョン

アップグレード後の OS リリースレベルとバージョンを確認します。

OS リリースレベル

root@raspberrypi:~ # uname -r
13.1-RELEASE

カーネルのバージョン

root@raspberrypi:~ # freebsd-version -k
13.1-RELEASE

ユーザランドのバージョン

root@raspberrypi:~ # freebsd-version -u
13.1-RELEASE