FreeBSD 10.0は、ALPHAからBETA1まで怒涛のアップデートが続いたと思ったら、BETA2でいきなり足踏みがあった。
これは、freebsd-update(8)にバグがあったためで、結果として以下の問題があったようだ。
①freebsd-updateでFreeBSD 10.0-BETA1へのアップグレードができない
②FreeBSD 10.0-BETA1でfreebsd-updateを使えない。
それが2013/10/29(日本時間)に解決された。
各OSバージョンでいったんfreebsd-updateし、最新の状態にしてから10.0-BETA2に更新すればよい。
詳細は以下。
Multiple freebsd-update bugs break upgrading to FreeBSD 10.0
油断してるとpkgngが死ぬ
もう一つ。
今回のfreebsd-updateでは、freebsd-update installを3回求められた。
あまり記憶がないのだが、前からこうだったかな..。
ただこの3回目のinstallが曲者である。
メッセージ(後述)を見ると分かるが、古いライブラリを削除するもののようだ(make delete-old-libsのようなもの)。
したがって、ports, pkgでインストールしたソフトウェアは動かなくなる可能性がある。
恐ろしいのは、pkgコマンド(pkgng)も対象であるということだ。
告白すると、「面倒くせえ。そんなもん、後でゆっくりアップグレードするわい」と進めたら、pkgが死んでその他のソフトウェアもアップグレードできなくなって頭を抱えました。はい。
さて以下に正しい手順を示す。
アップグレード例(FreeBSD 10.0-BETA1からBETA2へ)
ではまず現状の確認。
upgradeすると失敗する。
情報通りですな。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# uname -a FreeBSD testsv 10.0-BETA1 FreeBSD 10.0-BETA1 #0 r256420: Sun Oct 13 01:43:07 UTC 2013 root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 # freebsd-update upgrade -r 10.0-BETA2 Password: Looking up update.FreeBSD.org mirrors... none found. Fetching public key from update.FreeBSD.org... done. Fetching metadata signature for 10.0-BETA1 from update.FreeBSD.org... done. Fetching metadata index... done. Fetching 2 metadata files... done. The update metadata is correctly signed, but failed an integrity check. Cowardly refusing to proceed any further. # |
そこでupgradeではなく、いったんupdateするとfreebsd-updateが更新される。
1 2 3 4 5 6 7 8 9 10 11 12 13 |
# freebsd-update fetch (略) The following files will be updated as part of updating to 10.0-BETA1-p1: /bin/freebsd-version /usr/sbin/freebsd-update /var/db/mergemaster.mtree WARNING: FreeBSD 10.0-BETA1 is approaching its End-of-Life date. It is strongly recommended that you upgrade to a newer release within the next 1 month. # freebsd-update install Installing updates... done. # |
フレッシュなfreebsd-updateで改めてアップグレード。
今度は問題なし。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# freebsd-update upgrade -r 10.0-BETA2 Looking up update.FreeBSD.org mirrors... none found. Fetching metadata signature for 10.0-BETA1 from update.FreeBSD.org... done. Fetching metadata index... done. Inspecting system... done. The following components of FreeBSD seem to be installed: kernel/generic src/src world/base world/games world/lib32 The following components of FreeBSD do not seem to be installed: world/doc Does this look reasonable (y/n)? (略) |
あとは指定されるままにinstall, reboot,もう一回installをすると以下のメッセージが。
1 2 3 4 5 6 7 |
# freebsd-update install Password: Installing updates... 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 "/usr/sbin/freebsd-update install" again to finish installing updates. |
ここで迂闊に3回目のfreebsd-updateをすると、先述の通り面倒なことになる。
pkgコマンドですべてのソフトウェアを強制再インストールする。
man pkg-installしてもそれっぽいのが無かったので、以下のようにした。
1 2 3 4 5 6 7 8 9 10 |
# pkg info|cut -f1 -d" "|xargs pkg install -fy Updating repository catalogue pkg: No packages matching 'gettext-0.18.3.1' has been found in the repositories (略) [18/18] Reinstalling tmux-1.8_1... done # (2013/11/18 追記) pkg upgrade -fyですべてのpkgを再インストール可能 (2013/11/18 追記ここまで) |
freebsd-update installをもう一回して終了。
freebsd-updateの修正
以上、なのだが。
今回のfreebsd-updateバグ回避方法にはもうひとつ、freebsd-updateそのものを更新する方法がある。
その方法も試したので以下に示す。
(正直に言うと、ERRATAの「Perform one of the following:」を読み飛ばし、freebsd-updateにパッチ当てるという余計な手間をかけた。悔しいので手順を示す)
とはいえ、freebsd-updateの修正とOSアップデート手順は先述URLに丁寧に書かれている。
英語ではあるけれども、鍛えられたFreeBSDソルジャーなら屁でもない。
が、どこかに有用と感じてくれる人がいるかもしれない。
以下は10.0-BETA1から10.0-BETA2にアップグレードした例。
必要なものはsrc。
gpgもあるといいけど、まあ要らない。
srcの展開
srcのある人はスキップしてよい。
bsdconfigやら、DVDイメージ、DVDから展開する。
以下はDVDから展開する例(実際は仮想マシンからディスクイメージ読んでるだけなんですけどね)。
1 2 3 4 |
$ sudo mount -t cd9660 /dev/cd0 /mnt $ cd /mnt/usr/freebsd-dist $ sudo tar -C / -xvzpf ./src.txz (略) |
gnupgのインストール
これも、まあ本気のサーバ管理をしている人以外は不要じゃないかな。
以下はpkgでインストールする例。
意外にたくさんのお友達を連れてきた。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
$ pkg search gnupg gnupg-1.4.15 gnupg-2.0.22 pecl-gnupg-1.3.3_1 py27-gnupg-1.2.3 qca-gnupg-2.0.0.b3_1 $ sudo pkg install gnupg-2.0.22 Updating repository catalogue The following 8 packages will be installed: Installing libgpg-error: 1.12 Installing libgcrypt: 1.5.3 Installing libassuan: 2.1.1 Installing ca_root_nss: 3.15.1_1 Installing curl: 7.32.0 Installing pth: 2.0.7 Installing libksba: 1.3.0 Installing gnupg: 2.0.22 The installation will require 15 MB more space 3 MB to be downloaded (略) |
パッチの入手と適用
gnupgのない人は拡張子.ascのダウンロードは不要。
1 2 3 4 5 6 7 |
$ fetch http://security.freebsd.org/patches/EN-13:04/freebsd-update.patch fetch: http://security.freebsd.org/patches/EN-13:04/freebsd-update.patch: size of remote file is not known freebsd-update.patch 2754 B 25 kBps 00m00s $ fetch http://security.freebsd.org/patches/EN-13:04/freebsd-update.patch.asc fetch: http://security.freebsd.org/patches/EN-13:04/freebsd-update.patch.asc: size of remote file is not known freebsd-update.patch.asc 801 B 3785 Bps 00m00s $ |
gpgでファイルの確認。
gpgが無ければスキップしてよい。
1 2 3 4 5 6 7 |
$ gpg --verify ./freebsd-update.patch.asc Warning: using insecure memory! gpg: Signature made Sun Oct 27 05:14:13 2013 JST using RSA key ID 5DCF6AE7 gpg: Good signature from "FreeBSD Security Officer <security-officer@FreeBSD.org>" gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 1CF7 FF6F ADF5 CA9F BE1B 8CB2 ED67 ECD6 5DCF 6AE7 |
なんかWARNINGでてるけどまあいいでしょ。
パッチ適用
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
$ cd /usr/src $ sudo patch < ~/somewhere/freebsd-update.patch Hmm... Looks like a unified diff to me... The text leading up to this was: -------------------------- |Index: usr.sbin/freebsd-update/freebsd-update.sh |=================================================================== |--- usr.sbin/freebsd-update/freebsd-update.sh |+++ usr.sbin/freebsd-update/freebsd-update.sh -------------------------- Patching file usr.sbin/freebsd-update/freebsd-update.sh using Plan A... Hunk #1 succeeded at 1200. Hunk #2 succeeded at 2814. Hunk #3 succeeded at 2852. Hunk #4 succeeded at 2876. done |
freebsd-updateのコンパイルとインストール
1 2 3 4 |
$ cd /usr/src/usr.sbin/freebsd-update/ $ sudo make install -DWITHOUT_MAN install -o root -g wheel -m 555 freebsd-update.sh /usr/sbin/freebsd-update $ |
10.0-BETA1のみ以下を実行
1 |
$ sudo sed -i '' -e 's/%@/%~@/' /usr/sbin/freebsd-update |
freebsd-updateの修正は以上で完了。
改めてfreebsd-updateを実行すればよい。
以上
No tags for this post.