ライン

ポイント:portsでmakeすることが減りました

ライン

 はじめに

ports-mgmt/pkg

 時代が進んでしまい、ついにportauditも利用できなくなってしまいました。
仕方が無いので、古いバージョンで動作させているマシンもpkgに変えていくことにします。

 手順

インストール

 まずは、入れれば良いのかなと。

# cd /usr/ports/ports-mgmt/pkg
# make install clean
===>  Cleaning for pkg-1.3.8_3
You are about to convert your system to pkg while you have ports/packages
installed with the old pkg_install tools.

To switch to pkg:
    1) Install ports-mgmt/pkg
       cd ports-mgmt/pkg && make UPGRADEPKG=1 install clean
    2) Convert your package database by running pkg2ng

*** Error code 1

Stop in /usr/ports/ports-mgmt/pkg.

入らないんだ?

# make UPGRADEPKG=1 install clean
===>  License BSD2CLAUSE accepted by the user
=> pkg-1.3.8.tar.xz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch ftp://ftp2.jp.freebsd.org/pub/FreeBSD/ports/distfiles/pkg-1.3.8.tar.xz
fetch: ftp://ftp2.jp.freebsd.org/pub/FreeBSD/ports/distfiles/pkg-1.3.8.tar.xz: File unavailable (e.g., file not found, no access)
=> Attempting to fetch http://distcache.FreeBSD.org/local-distfiles/portmgr/pkg-1.3.8.tar.xz
pkg-1.3.8.tar.xz                              100% of 1744 kB  421 kBps
===> Fetching all distfiles required by pkg-1.3.8_3 for building
===>  Extracting for pkg-1.3.8_3
===>  License BSD2CLAUSE accepted by the user
===> Fetching all distfiles required by pkg-1.3.8_3 for building
=> SHA256 Checksum OK for pkg-1.3.8.tar.xz.
===>  Patching for pkg-1.3.8_3
===>  Applying FreeBSD patches for pkg-1.3.8_3
===>  Configuring for pkg-1.3.8_3
configure: loading site script /usr/ports/Templates/config.site
...
 install  -o root -g wheel -m 0644 libpkg/pkg.pc '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/libdata/pkgconfig'
====> Compressing man pages (compress-man)
===>  Installing for pkg-1.3.8_3
===>  Checking if pkg already installed
===>   Registering installation for pkg-1.3.8_3
If you are upgrading from the old package format, first run:

  # pkg2ng

===>  Cleaning for pkg-1.3.8_3
# rehash
# pkg2ng
Converting packages from /var/db/pkg
Converting jpeg-8_3...
...
Converting portupgrade-2.4.12,2...
Analysing shared libraries, this will take a while...
Checking all packages:  87%
...
Checking all packages: 100%

表示されたように実施することで解消できました。
では、脆弱性確認をしてみます。

# pkg audit -F
Fetching vuln.xml.bz2: 100%  456 kB 233.7k/s    00:02
apache22-2.2.27_6 is vulnerable:
apache22 -- several vulnerabilities
CVE: CVE-2013-5704
CVE: CVE-2014-0226
CVE: CVE-2014-0231
CVE: CVE-2014-0118
WWW: http://portaudit.FreeBSD.org/f927e06c-1109-11e4-b090-20cf30e32f6d.html

libxml2-2.9.1_1 is vulnerable:
libxml2 -- Denial of service
CVE: CVE-2014-3660
WWW: http://portaudit.FreeBSD.org/0642b064-56c4-11e4-8b87-bcaec565249c.html

2 problem(s) in the installed packages found.

まじかー。対処しましょう。

# pkg install apache22
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100%   968 B   1.0k/s    00:01
Fetching digests.txz: 100%    2 MB 513.5k/s    00:04
Fetching packagesite.txz: 100%    5 MB 481.6k/s    00:11
Processing new repository entries: 100%
FreeBSD repository update completed. 23618 packages processed:
  0 updated, 0 removed and 23618 added.
Updating database digests format: 100%
pkg: ruby19-bdb has a missing dependency: pkgconf
pkg: portupgrade has a missing dependency: pkgconf
pkg: ruby has a missing dependency: pkgconf
pkg: libffi has a missing dependency: pkgconf
pkg: ja-asterisk-sounds has a missing dependency: pkgconf
pkg: asterisk-stat has a missing dependency: pkgconf
pkg: fpdf has a missing dependency: pkgconf
The following 3 packages will be affected (of 0 checked):

New packages to be INSTALLED:
        apr: 1.5.1.1.5.4
        db5: 5.3.28_2

Installed packages to be UPGRADED:
        apache22: 2.2.27_6 -> 2.2.29_2

The process will require 51 MB more space.
15 MB to be downloaded.

Proceed with this action? [y/N]: y
Fetching apache22-2.2.29_2.txz: 100%    2 MB 510.8k/s    00:05
Fetching apr-1.5.1.1.5.4.txz: 100%  387 kB 396.5k/s    00:01
Fetching db5-5.3.28_2.txz: 100%   12 MB 557.2k/s    00:23
Checking integrity... done (1 conflicting)
Checking integrity... done (0 conflicting)
Conflicts with the existing packages have been found.
One more solver iteration is needed to resolve them.
The following 7 packages will be affected (of 0 checked):

Installed packages to be REMOVED:
        mod_php5-5.4.31,1
        asterisk-stat-2.0.1_14
        fpdf-1.7_1,1
        apr-devrandom-gdbm-db42-1.4.5.1.3.12_1

New packages to be INSTALLED:
        db5: 5.3.28_2
        apr: 1.5.1.1.5.4

Installed packages to be UPGRADED:
        apache22: 2.2.27_6 -> 2.2.29_2

The process will require 41 MB more space.

Proceed with this action? [y/N]: y
[preparing module `php5' in /usr/local/etc/apache22/httpd.conf]
[1/7] Deleting mod_php5-5.4.31,1: 100%
[2/7] Deleting asterisk-stat-2.0.1_14: 100%
[3/7] Deleting fpdf-1.7_1,1: 100%
[4/7] Deleting apr-devrandom-gdbm-db42-1.4.5.1.3.12_1:  76%
pkg: /usr/local/lib/apr-util-1/apr_dbm_db.so fails original SHA256 checksum, not removing
[4/7] Deleting apr-devrandom-gdbm-db42-1.4.5.1.3.12_1:  80%
pkg: /usr/local/lib/apr-util-1/apr_dbm_gdbm.so fails original SHA256 checksum, not removing
[4/7] Deleting apr-devrandom-gdbm-db42-1.4.5.1.3.12_1:  86%
pkg: /usr/local/lib/libapr-1.so fails original SHA256 checksum, not removing
[4/7] Deleting apr-devrandom-gdbm-db42-1.4.5.1.3.12_1:  90%
pkg: /usr/local/lib/libaprutil-1.so fails original SHA256 checksum, not removing
[4/7] Deleting apr-devrandom-gdbm-db42-1.4.5.1.3.12_1: 100%
[5/7] Installing db5-5.3.28_2: 100%
[6/7] Installing apr-1.5.1.1.5.4: 100%
/usr/local/etc/apache22/httpd.conf /usr/local/share/examples/apache22/httpd.conf differ: char 826, line 16
===> Creating users and/or groups.
Using existing group 'www'.
Using existing user 'www'.
[7/7] Upgrading apache22 from 2.2.27_6 to 2.2.29_2: 100%

あっという間に更新できました。
ちなみに、表示された内容を良く見ていないまま終了したんですが、更新後に消えちゃったパッケージとかあったみたいで、サービスができないものがありました。ちゃんとチェックすべきですね。

で、pkg installで消えた物を追加して、解消。
別ページには追記していますが、PHP5関連の挙動は変化している過渡期にあったので、また表示しなくなる障害が発生。
原因調べて、サービス再起動で解消。

最後の残作業は、/etc/make.confに

WITH_PKGNG=yes

を追加しておきます。
pkgの利用操作方法は、どこかに書いたのでここでは割愛です。

【改訂履歴】作成:2014/04/25 更新:2014/11/01

【参考リンク】

Copyright © 1996,1997-2006,2007- by F.Kimura,