tips
- Troubleshooting of pkg(8)
FreeBSD 10.
0-RELEASEから導入された新しいパッケージ管理システムpkg(8)のおかげでFreeBSD 10. 0-RELEASE以降のサーバやシステム管理は格段と簡単になりました。pkg(8)の恩恵を受けているサーバ管理者は数多くいらっしゃると思います。 pkg(8)は便利ですが、
ときどきアップグレードできないことがあります。理由はPorts Collectionの構造上の変更などに伴うものが多いといえます。複数のバージョンを共存させるために元のports(7)がバージョン別に分離したとか、 ほかのports(7)と衝突が発生するためアップグレードの前に削除しておく必要があるといったものです。 次の出力は衝突が発生してアップグレードできないというメッセージを出力してpkg upgradeが失敗している例です。
# pkg upgrade -y Updating repository catalogue Upgrades have been requested for the following 11 packages: Upgrading freetype2: 2.
5.2 -> 2. 5.3 Installing py27-setuptools27: 2. 0.1 Reinstalling pango-1. 34. 1_ 1 (direct dependency changed) Upgrading pciids: 20140222 -> 20140301 Upgrading py27-cssutils: 1. 0,1 -> 1. 0_ 1,1 Reinstalling py27-dnspython-1. 11. 1_ 1 (direct dependency changed) Reinstalling py27-sqlite3-2. 7.6_ 3 (direct dependency changed) Reinstalling py27-utidy-0. 2_ 1 (direct dependency changed) Upgrading tmux: 1. 9.a -> 1. 9.a_ 1 Upgrading vim-lite: 7. 4.192 -> 7. 4.193 Reinstalling linkchecker-8. 4_ 1 (direct dependency changed) The upgrade will require 1 MB more space 0 B to be downloaded Checking integrity... pkg: WARNING: locally installed py27-setuptools-2. 0.1 conflicts on /usr/ local/ bin/ easy_ install with: - py27-setuptools27-2. 0.1 pkg: WARNING: locally installed py27-setuptools-2. 0.1 conflicts on /usr/ local/ bin/ easy_ install-2. 7 with: - py27-setuptools27-2. 0.1 (略) pkg: WARNING: locally installed py27-setuptools-2. 0.1 conflicts on /usr/ local/ lib/ python2. 7/ site-packages/ setuptools/ version. pyo with: - py27-setuptools27-2. 0.1 # こういった場合には解決方法を
「pkg updating」 で調べます。インストールされているソフトウェアに関連した問題解決方法がずらずらと表示されます。インストールしているソフトウェアに依存して表示されるメッセージはかわります。このあたりも直接/usr/ ports/ UPDATINGファイルを読むよりも便利になったところです。 # pkg updating | less 20140307: AFFECTS: users of devel/
py-setuptools dependent ports AUTHOR: sunpoet@FreeBSD. org devel/ py-setuptools is being used for every python ports (if USE_ PYDISTUTILS defined) since r336553. Due to PKGORIGIN limitation, we cannot build one python port with python27 and the other with python33 since they require different setuptools versions which have same PKGORIGIN. With the addition of py-setuptools{27,32,33}, we could now have py27-foo and py33-bar coexist in one system. Note that this is only a short-term solution. It does not help if you need coexistence of one port with different python versions, e. g. py27-foo and py33-foo. Please rebuild all ports that depend on devel/ py-setuptools and use devel/ py-setuptools{27,32,33} instead. XX represents python version (27, 32 or 33) in the following steps. pkgng users: # pkg set -o devel/ py-setuptools:devel/ py-setuptoolsXX portmaster users: # portmaster -o devel/ py-setuptoolsXX devel/ py-setuptools # portmaster -r py\*setuptools portupgrade users: # portupgrade -o devel/ py-setuptoolsXX -f devel/ py-setuptools # portupgrade -fr devel/ py-setuptools 20131216: (略) # 説明によると、
複数のバージョンを共存させるためにports(7)を3つに分離したことがわかります。一時的な回避策的な処理なので将来的にこのports(7)でまた何らかの手動での作業が必要になりそうな雰囲気もわかります。 対象となっているソフトウェアを特定してみます。
「py27-setuptools-2. 0.1」 がそれで、 これが 「/usr/ ports/ devel/ py-setuptools」 から 「/usr/ ports/ deve/ py-setuptools27」 に変わったんだなということがわかります。 # pkg info -a | grep setup py27-setuptools-2.
0.1 Python packages installer # pkg info -f py27-setuptools-2. 0.1 py27-setuptools-2. 0.1 Name : py27-setuptools Version : 2. 0.1 Installed on : Fri Jan 3 13:50:50 JST 2014 Origin : devel/ py-setuptools Architecture : freebsd:10:x86:64 Prefix : /usr/ local Categories : python devel Licenses : PSFL Maintainer : python@FreeBSD. org WWW : https:// pypi. python. org/ pypi/ setuptools Comment : Python packages installer Flat size : 1. 96MiB Description : Setuptools is a fully-featured, actively-maintained, and stable library designed to facilitate packaging Python projects, where packaging includes: - Python package and module definitions - Distribution package metadata - Test hooks - Project installation - Platform-specific details - Python 3 support WWW: https:// pypi. python. org/ pypi/ setuptools # ls /usr/ ports/ devel/ | grep setuptools py-setuptools py-setuptools-git py-setuptools27 py-setuptools32 py-setuptools33 py-setuptools_ darcs py-setuptools_ hg # 「pkg updating」 の出力に解決するためのコマンドが表示されていましたので、 それに従って変更処理を実行します。 # pkg set -o devel/
py-setuptools:devel/ py-setuptools27 Change origin from devel/ py-setuptools to devel/ py-setuptools27 for py27-setuptools-2. 0.1? [y/ N]: y # このように問題を解決してからアップグレード作業を実施すると、
次のようにアップグレードが完了します。 # pkg upgrade -y Updating repository catalogue Upgrades have been requested for the following 10 packages: Upgrading freetype2: 2.
5.2 -> 2. 5.3 Reinstalling pango-1. 34. 1_ 1 (direct dependency changed) Upgrading pciids: 20140222 -> 20140301 Upgrading py27-cssutils: 1. 0,1 -> 1. 0_ 1,1 Reinstalling py27-dnspython-1. 11. 1_ 1 (direct dependency changed) Reinstalling py27-sqlite3-2. 7.6_ 3 (direct dependency changed) Reinstalling py27-utidy-0. 2_ 1 (direct dependency changed) Upgrading tmux: 1. 9.a -> 1. 9.a_ 1 Upgrading vim-lite: 7. 4.192 -> 7. 4.193 Reinstalling linkchecker-8. 4_ 1 (direct dependency changed) The upgrade will free 852 KB 0 B to be downloaded Checking integrity... done [1/ 10] Upgrading freetype2 from 2. 5.2 to 2. 5.3... done [2/ 10] Reinstalling pango-1. 34. 1_ 1... done [3/ 10] Upgrading pciids from 20140222 to 20140301... done [4/ 10] Upgrading py27-cssutils from 1. 0,1 to 1. 0_ 1,1... done [5/ 10] Reinstalling py27-dnspython-1. 11. 1_ 1... done [6/ 10] Reinstalling py27-sqlite3-2. 7.6_ 3... done [7/ 10] Reinstalling py27-utidy-0. 2_ 1... done [8/ 10] Upgrading tmux from 1. 9.a to 1. 9.a_ 1... done [9/ 10] Upgrading vim-lite from 7. 4.192 to 7. 4.193... [10/ 10] Reinstalling linkchecker-8. 4_ 1... 242 287 done # pkg upgrade Updating repository catalogue Nothing to do # Ports Collectionベースのアップグレードの場合、
依存するソフトウェアなどを再構築する必要がある場合などそちらのソフトウェアについてもビルドが発生しますが、 pkg(8)ではすでにFreeBSDクラスタの方で関連するすべてのソフトウェアがビルドされた状態で配布されていますので、 そうした時間が発生しません。アップグレード作業はとても短時間に済むようになりました。