FreeBSD 12.2 から FreeBSD 13.0 にアップグレードが正常に行えたのでメモ書きする事にしました。
作業時間
筆者の環境では10時間ほど時間が掛かりました。
また、何度も失敗したので4回目に成功する事が出来ました。
旧カーネルバージョン確認
現在のカーネルバージョンを確認する。
uname -a
FreeBSD 12.2-RELEASE-p7 GENERIC amd64
アップグレード実施
FreeBSD 13.0-RELEASE Installation Instructions を参考に実施しました。
①.現時点の最新のパッチを適用します。
freebsd-update fetch
freebsd-update install
②.アップグレードのコマンドを実行する。
freebsd-update upgrade -r 13.0-RELEASE
③.Does this look reasonable は Y にする。
Looking up update.FreeBSD.org mirrors... 2 mirrors found.
Fetching metadata signature for 12.2-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.
The following components of FreeBSD seem to be installed:
kernel/generic kernel/generic-dbg src/src world/base world/doc
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)? y
④.アップグレードには長時間掛かるので様子を見ます。
Fetching metadata signature for 13.0-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 12.2-RELEASE for merging... done.
Preparing to download files... done.
Fetching 47245 patches.....10....20....省略....47230....47240.. done.
Applying patches... done.
Fetching 13554 files... ....10....20....省略....13540....13550.. done.
Attempting to automatically merge changes in files... done.
⑤.手動による修正が必要なコメントが表示する。
The following file could not be merged automatically: /etc/hosts.allow
Press Enter to edit this file in /usr/bin/vi and resolve the conflicts
manually...
<<<<<<< current version
ALL : localhost 127.0.0.1 192.168.0. : allow
sshd : .ne.jp : allow
ALL : ALL : deny
=======
#
# hosts.allow access control file for "tcp wrapped" applications.
# $FreeBSD$
#
# NOTE: The hosts.deny file is deprecated.
# Place both 'allow' and 'deny' rules in the hosts.allow file.
# See hosts_options(5) for the format of this file.
# hosts_access(5) no longer fully applies.
#
# _____ _ _
# | ____| __ __ __ _ _ __ ___ _ __ | | ___ | |
# | _| \ \/ / / _` | | '_ ` _ \ | '_ \ | | / _ \ | |
# | |___ > < | (_| | | | | | | | | |_) | | | | __/ |_|
# |_____| /_/\_\ \__,_| |_| |_| |_| | .__/ |_| \___| (_)
# |_|
# !!! This is an example! You will need to modify it for your specific
# !!! requirements!
# Start by allowing everything (this prevents the rest of the file
# from working, so remove it when you need protection).
# The rules here work on a "First match wins" basis.
ALL : ALL : allow
# Wrapping sshd(8) is not normally a good idea, but if you
# need to do it, here's how
#sshd : .evil.cracker.example.com : deny
# Protect against simple DNS spoofing attacks by checking that the
# forward and reverse records for the remote host match. If a mismatch
# occurs, access is denied, and any positive ident response within
# 20 seconds is logged. No protection is afforded against DNS poisoning,
# IP spoofing or more complicated attacks. Hosts with no reverse DNS
# pass this rule.
ALL : PARANOID : RFC931 20 : deny
# Allow anything from localhost. Note that an IP address (not a host
# name) *MUST* be specified for rpcbind(8).
ALL : localhost 127.0.0.1 : allow
# Comment out next line if you build libwrap without IPv6 support.
ALL : [::1] : allow
#ALL : my.machine.example.com 192.0.2.35 : allow
# To use IPv6 addresses you must enclose them in []'s
#ALL : [fe80::%fxp0]/10 : allow
#ALL : [fe80::]/10 : deny
#ALL : [2001:db8:2:1:2:3:4:3fe1] : deny
#ALL : [2001:db8:2:1::]/64 : allow
# Sendmail can help protect you against spammers and relay-rapers
sendmail : localhost : allow
#sendmail : .nice.guy.example.com : allow
#sendmail : .evil.cracker.example.com : deny
sendmail : ALL : allow
# Exim is an alternative to sendmail, available in the ports tree
exim : localhost : allow
#exim : .nice.guy.example.com : allow
#exim : .evil.cracker.example.com : deny
exim : ALL : allow
# Rpcbind is used for all RPC services; protect your NFS!
# Rpcbind should be running with -W option to support this.
# (IP addresses rather than hostnames *MUST* be used here)
#rpcbind : 192.0.2.32/255.255.255.224 : allow
#rpcbind : 192.0.2.96/255.255.255.224 : allow
rpcbind : ALL : deny
# NIS master server. Only local nets should have access
# (Since this is an RPC service, rpcbind needs to be considered)
ypserv : localhost : allow
#ypserv : .unsafe.my.net.example.com : deny
#ypserv : .my.net.example.com : allow
ypserv : ALL : deny
# Provide a small amount of protection for ftpd
ftpd : localhost : allow
#ftpd : .nice.guy.example.com : allow
#ftpd : .evil.cracker.example.com : deny
ftpd : ALL : allow
# You need to be clever with finger; do _not_ backfinger!! You can easily
# start a "finger war".
fingerd : ALL \
: spawn (echo Finger. | \
/usr/bin/mail -s "tcpd\: %u@%h[%a] fingered me!" root) & \
: deny
# The rest of the daemons are protected.
ALL : ALL \
: severity auth.info \
: twist /bin/echo "You are not welcome to use %d from %h."
>>>>>>> 13.0-RELEASE
/var/db/freebsd-update/merge/new//etc/hosts.allow: 98 lines, 3534 characters.
⑥.手動による修正が必要なコメントが表示する。
The following file could not be merged automatically: /etc/newsyslog.conf
Press Enter to edit this file in /usr/bin/vi and resolve the conflicts
manually...
# configuration file for newsyslog
# $FreeBSD$
#
# Entries which do not specify the '/pid_file' field will cause the
# syslogd process to be signalled when that log file is rotated. This
# action is only appropriate for log files which are written to by the
# syslogd process (ie, files listed in /etc/syslog.conf). If there
# is no process which needs to be signalled when a given log file is
# rotated, then the entry for that file should include the 'N' flag.
#
# Note: some sites will want to select more restrictive protections than the
# defaults. In particular, it may be desirable to switch many of the 644
# entries to 640 or 600. For example, some sites will consider the
# contents of maillog, messages, and lpd-errs to be confidential. In the
# future, these defaults may change to more conservative ones.
#
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
/var/log/all.log 600 7 * @T00 J
/var/log/auth.log 600 7 1000 @0101T JC
/var/log/console.log 600 5 1000 * J
/var/log/cron 600 3 1000 * JC
/var/log/daily.log 640 7 * @T00 JN
/var/log/debug.log 600 7 1000 * JC
/var/log/init.log 644 3 1000 * J
/var/log/kerberos.log 600 7 1000 * J
/var/log/maillog 640 7 * @T00 JC
/var/log/messages 644 5 1000 @0101T JC
/var/log/monthly.log 640 12 * $M1D0 JN
/var/log/devd.log 644 3 1000 * JC
/var/log/security 600 10 1000 * JC
/var/log/utx.log 644 3 * @01T05 B
/var/log/weekly.log 640 5 * $W6D0 JN
/var/log/daemon.log 644 5 1000 @0101T JC
<<<<<<< current version
# \xe8\xa8\xad\xe5\xae\x9a\xe8\xbf\xbd\xe5\x8a\xa0
/var/log/ntpd.log 644 5 * $W6D0 B
/var/log/charon.log 644 5 * $W6D0 B
/var/log/backup/backup.log 644 5 * $W6D0 B
/var/log/backup/DBbackup.log 644 5 * $W6D0 B
<include> /etc/newsyslog.conf.d/*
<include> /usr/local/etc/newsyslog.conf.d/*
=======
<include> /etc/newsyslog.conf.d/[!.]*.conf
<include> /usr/local/etc/newsyslog.conf.d/[!.]*.conf
>>>>>>> 13.0-RELEASE
⑦.手動による修正が必要なコメントが表示する。
The following file could not be merged automatically: /etc/ntp.conf
Press Enter to edit this file in /usr/bin/vi and resolve the conflicts
manually...
<<<<<<< current version
pool ntp.nict.jp iburst
pool ntp.jst.mfeed.ad.jp iburst
pool time.google.com iburst
=======
#
# $FreeBSD$
#
# Default NTP servers for the FreeBSD operating system.
#
# Don't forget to enable ntpd in /etc/rc.conf with:
# ntpd_enable="YES"
#
# The driftfile is by default /var/db/ntpd.drift, check
# /etc/defaults/rc.conf on how to change the location.
#
>>>>>>> 13.0-RELEASE
<<<<<<< current version
logfile /var/log/ntpd.log
logconfig =syncstatus +sysevents +clockall
=======
#
# Set the target and limit for adding servers configured via pool statements
# or discovered dynamically via mechanisms such as broadcast and manycast.
# Ntpd automatically adds maxclock-1 servers from configured pools, and may
# add as many as maxclock*2 if necessary to ensure that at least minclock
# servers are providing good consistent time.
#
tos minclock 3 maxclock 6
>>>>>>> 13.0-RELEASE
restrict default noquery nomodify notrap
restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap
restrict 127.0.0.1
⑤~⑦の部分については、旧環境の設定に変更するようにしました。
⑧.何度も「Does this look reasonable」が表示するので、 Y を選択する。
The following changes, which occurred between FreeBSD 12.2-RELEASE and
FreeBSD 13.0-RELEASE have been merged into /etc/hosts.allow:
--- current version
+++ new version
@@ -1,3 +1,98 @@
+<<<<<<< current version
ALL : localhost 127.0.0.1 192.168.0. : allow
sshd : .ne.jp : allow
ALL : ALL : deny
+=======
+#
+# hosts.allow access control file for "tcp wrapped" applications.
+# $FreeBSD$
+#
+# NOTE: The hosts.deny file is deprecated.
+# Place both 'allow' and 'deny' rules in the hosts.allow file.
+# See hosts_options(5) for the format of this file.
+# hosts_access(5) no longer fully applies.
+#
+# _____ _ _
+# | ____| __ __ __ _ _ __ ___ _ __ | | ___ | |
+# | _| \ \/ / / _` | | '_ ` _ \ | '_ \ | | / _ \ | |
+# | |___ > < | (_| | | | | | | | | |_) | | | | __/ |_|
+# |_____| /_/\_\ \__,_| |_| |_| |_| | .__/ |_| \___| (_)
+# |_|
+# !!! This is an example! You will need to modify it for your specific
+# !!! requirements!
+
+
+# Start by allowing everything (this prevents the rest of the file
+# from working, so remove it when you need protection).
+# The rules here work on a "First match wins" basis.
+ALL : ALL : allow
+
+# Wrapping sshd(8) is not normally a good idea, but if you
+# need to do it, here's how
+#sshd : .evil.cracker.example.com : deny
+
+# Protect against simple DNS spoofing attacks by checking that the
+# forward and reverse records for the remote host match. If a mismatch
+# occurs, access is denied, and any positive ident response within
+# 20 seconds is logged. No protection is afforded against DNS poisoning,
+# IP spoofing or more complicated attacks. Hosts with no reverse DNS
+# pass this rule.
+ALL : PARANOID : RFC931 20 : deny
+
+# Allow anything from localhost. Note that an IP address (not a host
+# name) *MUST* be specified for rpcbind(8).
+ALL : localhost 127.0.0.1 : allow
+# Comment out next line if you build libwrap without IPv6 support.
+ALL : [::1] : allow
+#ALL : my.machine.example.com 192.0.2.35 : allow
+
+# To use IPv6 addresses you must enclose them in []'s
+#ALL : [fe80::%fxp0]/10 : allow
+#ALL : [fe80::]/10 : deny
+#ALL : [2001:db8:2:1:2:3:4:3fe1] : deny
+#ALL : [2001:db8:2:1::]/64 : allow
+
+# Sendmail can help protect you against spammers and relay-rapers
+sendmail : localhost : allow
+#sendmail : .nice.guy.example.com : allow
+#sendmail : .evil.cracker.example.com : deny
+sendmail : ALL : allow
+
+# Exim is an alternative to sendmail, available in the ports tree
+exim : localhost : allow
+#exim : .nice.guy.example.com : allow
+#exim : .evil.cracker.example.com : deny
+exim : ALL : allow
+
+# Rpcbind is used for all RPC services; protect your NFS!
+# Rpcbind should be running with -W option to support this.
+# (IP addresses rather than hostnames *MUST* be used here)
+#rpcbind : 192.0.2.32/255.255.255.224 : allow
+#rpcbind : 192.0.2.96/255.255.255.224 : allow
+rpcbind : ALL : deny
+
+# NIS master server. Only local nets should have access
+# (Since this is an RPC service, rpcbind needs to be considered)
+ypserv : localhost : allow
+#ypserv : .unsafe.my.net.example.com : deny
+#ypserv : .my.net.example.com : allow
+ypserv : ALL : deny
+
+# Provide a small amount of protection for ftpd
+ftpd : localhost : allow
+#ftpd : .nice.guy.example.com : allow
+#ftpd : .evil.cracker.example.com : deny
+ftpd : ALL : allow
+
+# You need to be clever with finger; do _not_ backfinger!! You can easily
+# start a "finger war".
+fingerd : ALL \
+ : spawn (echo Finger. | \
+ /usr/bin/mail -s "tcpd\: %u@%h[%a] fingered me!" root) & \
+ : deny
+
+# The rest of the daemons are protected.
+ALL : ALL \
+ : severity auth.info \
+ : twist /bin/echo "You are not welcome to use %d from %h."
+>>>>>>> 13.0-RELEASE
Does this look reasonable (y/n)? y
The following file will be removed, as it no longer exists in
FreeBSD 13.0-RELEASE: /etc/motd
Does this look reasonable (y/n)? y
The following changes, which occurred between FreeBSD 12.2-RELEASE and
FreeBSD 13.0-RELEASE have been merged into /etc/newsyslog.conf:
--- current version
+++ new version
@@ -1,7 +1,7 @@
# configuration file for newsyslog
-# $FreeBSD: releng/12.2/usr.sbin/newsyslog/newsyslog.conf 337686 2018-08-12 13:24:53Z brd $
+# $FreeBSD$
#
# Entries which do not specify the '/pid_file' field will cause the
# syslogd process to be signalled when that log file is rotated. This
# action is only appropriate for log files which are written to by the
# syslogd process (ie, files listed in /etc/syslog.conf). If there
@@ -28,16 +28,22 @@
/var/log/monthly.log 640 12 * $M1D0 JN
/var/log/devd.log 644 3 1000 * JC
/var/log/security 600 10 1000 * JC
/var/log/utx.log 644 3 * @01T05 B
/var/log/weekly.log 640 5 * $W6D0 JN
+/var/log/daemon.log 644 5 1000 @0101T JC
+<<<<<<< current version
# 設定追加
/var/log/ntpd.log 644 5 * $W6D0 B
/var/log/charon.log 644 5 * $W6D0 B
/var/log/backup/backup.log 644 5 * $W6D0 B
/var/log/backup/DBbackup.log 644 5 * $W6D0 B
<include> /etc/newsyslog.conf.d/*
<include> /usr/local/etc/newsyslog.conf.d/*
+=======
+<include> /etc/newsyslog.conf.d/[!.]*.conf
+<include> /usr/local/etc/newsyslog.conf.d/[!.]*.conf
+>>>>>>> 13.0-RELEASE
Does this look reasonable (y/n)? y
The following changes, which occurred between FreeBSD 12.2-RELEASE and
FreeBSD 13.0-RELEASE have been merged into /etc/ntp.conf:
--- current version
+++ new version
@@ -1,10 +1,35 @@
+<<<<<<< current version
pool ntp.nict.jp iburst
pool ntp.jst.mfeed.ad.jp iburst
pool time.google.com iburst
+=======
+#
+# $FreeBSD$
+#
+# Default NTP servers for the FreeBSD operating system.
+#
+# Don't forget to enable ntpd in /etc/rc.conf with:
+# ntpd_enable="YES"
+#
+# The driftfile is by default /var/db/ntpd.drift, check
+# /etc/defaults/rc.conf on how to change the location.
+#
+>>>>>>> 13.0-RELEASE
+<<<<<<< current version
logfile /var/log/ntpd.log
logconfig =syncstatus +sysevents +clockall
+=======
+#
+# Set the target and limit for adding servers configured via pool statements
+# or discovered dynamically via mechanisms such as broadcast and manycast.
+# Ntpd automatically adds maxclock-1 servers from configured pools, and may
+# add as many as maxclock*2 if necessary to ensure that at least minclock
+# servers are providing good consistent time.
+#
+tos minclock 3 maxclock 6
+>>>>>>> 13.0-RELEASE
restrict default noquery nomodify notrap
restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap
restrict 127.0.0.1
Does this look reasonable (y/n)? y
⑨.「/usr/sbin/freebsd-update install」が表示する事を確認する。
The following files will be removed as part of updating to
13.0-RELEASE-p1:
/boot/boot1.efifat
/boot/gptboot.efifat
/boot/kernel/aha.ko
/boot/kernel/alias_cuseeme.ko
/boot/kernel/atacard.ko
省略
/bin/kill
/bin/link
/bin/ln
/bin/ls
/bin/mkdir
/bin/mv
To install the downloaded upgrades, run "/usr/sbin/freebsd-update install".
⑩.freebsd-update install を実行する。
[root@FreeBSD ~]# /usr/sbin/freebsd-update install
Installing updates...
Kernel updates have been installed. Please reboot and run
"/usr/sbin/freebsd-update install" again to finish installing updates.
再起動する前に、「ファイヤーウォール(ipfw)」を無効にします。
何故かファイヤーウォールが有効だとネットワークが切断されて正常にアップグレードできない状態でした。
⑪.ipfw(ファイヤーウォール)を無効にする。
vim /etc/rc.conf
#firewall_enable="YES"
#firewall_script="/shell/ipfw/ipfw.rules"
#firewall_logging="YES"
⑫.再起動する。
reboot
⑬.カーネルバージョンを確認する。
[root@FreeBSD /var/run]# uname -a
FreeBSD FreeBSD 13.0-RELEASE-p1 FreeBSD 13.0-RELEASE-p1 #0: Wed May 26 22:15:09 UTC 2021 root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
FreeBSD FreeBSD 13.0-RELEASE-p1と表示している事を確認する。
⑭.再度、freebsd-update install を実行する。
[root@FreeBSD ~]# /usr/sbin/freebsd-update install
Installing updates... done.
⑮.アップグレード時に使用した不要になったデータを削除する。
rm -rf /var/db/freebsd-update/files
⑯.ipfw(ファイヤーウォール)を有効にする。
vim /etc/rc.conf
firewall_enable="YES"
firewall_script="/shell/ipfw/ipfw.rules"
firewall_logging="YES"
⑰.再起動する。
reboot
正常に動作している事を確認します。
筆者の環境は正常にアップグレードする事が出来ました。