snv_111bから134へ、2009.06から2010.03へのアップデート

何気にOpenSolarisが入ったPCが3台あるので 1台目のアップデート。

OpenSolaris 2010.03 がリリース直前(のはず)なので、とりあえず1台は、予定バージョンの snv_134へアップデートしてみました。

kohjuさんのメールアナウンス & blog(http://kohju.justplayer.com/diary_2010-02-20.html)に書いてありますが snv_132 -> snv_133 のアップデートはいろいろ大変そうな感じです。
で、snv_134はその辺りが修正されているといいなぁ〜と期待して実施。


$ uname -a
SunOS ss1610 5.11 snv_111b i86pc i386 i86pc
$ pfexec pkg set-publisher -P -O http://pkg.opensolaris.org/dev opensolaris.org
$ pkg publisher
発行元 タイプ 状態 URI
opensolaris.org (優先) 起点 online http://pkg.opensolaris.org/dev/
opensolaris 起点 online http://pkg.opensolaris.org/release/
$ pfexec pkg install -v SUNWipkg
Creating Plan - 評価前:
UNEVALUATED:

評価後:
Actuators:

None
このイメージで使用可能な更新は存在しません。
$

21:56 に image-update 開始!
ダウンロードサイズは 1.1G orz


$ pfexec pkg image-update -v
Creating Plan - 評価前:
UNEVALUATED:
+pkg:/entire@0.5.11,5.11-0.134:20100302T023003Z

評価後:
pkg:/entire@0.5.11,5.11-0.111:20090518T052643Z -> pkg:/entire@0.5.11,5.11-0.134:20100302T023003Z
None -> pkg:/consolidation/solaris_re/solaris_re-incorporation@0.5.11,5.11-0.134:20100302T010711Z
pkg:/SUNWsolnm@0.5.11,5.11-0.111:20090508T163629Z -> pkg:/SUNWsolnm@0.5.11,5.11-0.133:20100216T095134Z
None -> pkg:/release/name@0.5.11,5.11-0.134:20100302T043855Z
pkg:/SUNWdistro-license-copyright@0.5.11,5.11-0.111:20090508T153917Z -> pkg:/SUNWdistro-license-copyright@0.5.11,5.11-0.133:20100216T064505Z
None -> pkg:/release/copyright@0.5.11,5.11-0.134:20100302T043611Z
None -> pkg:/consolidation/vpanels/vpanels-incorporation@0.5.11,5.11-0.134:20100302T010742Z
None -> pkg:/consolidation/install/install-incorporation@0.5.11,5.11-0.134:20100302T010520Z
pkg:/SUNWicdc@0.5.11,5.11-0.111:20090508T160828Z -> pkg:/SUNWicdc@0.5.11,5.11-0.130:20091219T005628Z
pkg:/SUNWinstall@0.5.11,5.11-0.111:20090508T160958Z -> pkg:/SUNWinstall@0.5.11,5.11-0.133:20100216T075758Z
None -> pkg:/system/install@0.5.11,5.11-0.134:20100302T054329Z
None -> pkg:/install/beadm@0.5.11,5.11-0.134:20100302T031110Z
...
None -> pkg:/consolidation/jdmk/jdmk-incorporation@0.5.11,5.11-0.134:20100302T010540Z
None -> pkg:/consolidation/dbtg/dbtg-incorporation@0.5.11,5.11-0.134:20100302T010425Z
Actuators:
restart_fmri: svc:/application/desktop-cache/gconf-cache:default
restart_fmri: svc:/application/desktop-cache/input-method-cache:default
restart_fmri: svc:/application/desktop-cache/pixbuf-loaders-installer:default
restart_fmri: svc:/application/font/fc-cache:default
restart_fmri: svc:/system/manifest-import:default
restart_fmri: svc:/application/desktop-cache/icon-cache:default
restart_fmri: svc:/application/desktop-cache/mime-types-cache:default
restart_fmri: svc:/system/manifest-import:default
restart_fmri: svc:/system/rbac:default
restart_fmri: svc:/application/desktop-cache/gconf-cache:default
restart_fmri: svc:/application/desktop-cache/input-method-cache:default
restart_fmri: svc:/application/desktop-cache/pixbuf-loaders-installer:default
restart_fmri: svc:/application/font/fc-cache:default
restart_fmri: svc:/system/manifest-import:default
restart_fmri: svc:/application/desktop-cache/icon-cache:default
restart_fmri: svc:/application/desktop-cache/mime-types-cache:default
None
DOWNLOAD PKGS FILES XFER (MB)
system/library 17/1531 3498/114273 23.88/1143.39 39 43.39
Completed 1531/1531 114273/114273 1143.39/1143.39 3.39 9

PHASE ACTIONS
Removal Phase 111711/117889
Warning - directory etc/sma/snmp/mibs not empty - contents preserved in /tmp/tmpPpKkIr/var/pkg/lost+found/etc/sma/snmp/mibs-20100326T234652Z
Removal Phase 117889/117889
Install Phase 169075/170437
The 'pcieb' driver shares the alias 'pciexclass,060400' with the 'pcie_pci'
driver, but the system cannot determine how the latter was delivered.
Its entry on line 2 in /etc/driver_aliases has been commented
out. If this driver is no longer needed, it may be removed by booting
into the 'opensolaris-snv_111-4' boot environment and invoking 'rem_drv pcie_pci'
as well as removing line 2 from /etc/driver_aliases or, before
rebooting, mounting the 'opensolaris-snv_111-4' boot environment and running
'rem_drv -b pcie_pci' and removing line 2 from
/etc/driver_aliases.
The 'pcieb' driver shares the alias 'pciexclass,060401' with the 'pcie_pci'
driver, but the system cannot determine how the latter was delivered.
Its entry on line 3 in /etc/driver_aliases has been commented
out. If this driver is no longer needed, it may be removed by booting
into the 'opensolaris-snv_111-4' boot environment and invoking 'rem_drv pcie_pci'
as well as removing line 3 from /etc/driver_aliases or, before
rebooting, mounting the 'opensolaris-snv_111-4' boot environment and running
'rem_drv -b pcie_pci' and removing line 3 from
/etc/driver_aliases.
Install Phase 169242/170437
driver (asy) install failed with return code 1
command run was: /usr/sbin/add_drv -n -b /tmp/tmpPpKkIr -i "pci11c1,480" -m * 0666 root sys,*,cu 0600 uucp uucp asy
command output was:

                                                                                                                      • -

Option (-m) : missing token: (*)
Usage:
add_drv [ -m ' ','<...>' ]
[ -n ]
[ -f ]
[ -v ]
[ -i '' ]
[ -b ]
[ -c ]
[ -p ]

Example:
add_drv -m '* 0666 bin bin' -i 'acme,sd new,sd' sd
Add 'sd' drive with identify names: acme,sd and new,sd.
Every minor node will have the permission 0666,
and be owned by bin with group bin.

                                                                                                                      • -

Install Phase 170437/170437
Update Phase 2223/2223
PHASE ITEMS
Reading Existing Index 8/8
Indexing Packages 1531/1531
Optimizing Index...
PHASE ITEMS
Indexing Packages 1534/1534

opensolaris-snv_111-3 のクローンが存在しており、それが更新およびアクティブ化されました。
次回リブート時にはブート環境 opensolaris-snv_111-4 が「/」にマウントされます。
準備が整ったらリブートしてこの更新済みの BE に切り替えてください。

                                                                                                                                                    • -

注: 次の場所で公開されているリリースノートを確認してください:

http://opensolaris.org/os/project/indiana/resources/relnotes/200906/x86/

                                                                                                                                                    • -

DOWNLOADがCompletedになったのが、大体 23:45、アップデートが終わったのが 0:58。
ここまでで3時間。

続き:http://d.hatena.ne.jp/handler/20100330/1269890792

 OpenSolarisのソースコードをゲットする

OpenSolarisソースコードですが、サイト上のOpenGrok(http://src.opensolaris.org/source/)で簡単に検索・閲覧ができます。

今回は、ローカルディスクにソースコードを持ってくるところ。

OpenSolarisのサイト内 [Main Pages] -> [Get the Source] にありますが、Mercurial (hg) repositoryからsshで取りに行くという意外と大変な方法が記載されています。
(基本的に会社の中からsshって使えないだろう&sshだと回線的に重い?)


ssh://anon@hg.opensolaris.org/hg/project/project-repo

実は上記条件のため、何度か試しつつ挫折をしていたのですが bitbucketサイトにミラーがあるようで、今回無事ゲットできました。


$ hg clone http://bitbucket.org/mirror/onnv-gate/
destination directory: onnv-gate
requesting all changes
adding changesets
adding manifests
adding file changes
added 10898 changesets with 128585 changes to 56532 files
updating working directory
45123 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ ls
onnv-gate/
$

ちなみに、家の回線で 11分 ほどかかりました。
(回線はマンション共用型なので、そんなに速くないかな?)
今日のリポジトリ状態で tarで800Mbyte、tar.gzで320Mbyteとなりました。


$ ls -al
drwxr-xr-x 3 hoge staff 4 Feb 9 02:32 ./
drwxr-xr-x 6 hoge staff 8 Feb 9 02:16 ../
drwxr-xr-x 5 hoge staff 7 Feb 9 02:27 onnv-gate/
-rw-r--r-- 1 hoge staff 321250878 Feb 9 02:31 onnv-gate_20100209.tar.gz
$

 構築メモ(インストールコマンド)

個人的なメモです。

○SunStudio


$ pfexec pkg install sunstudio12u1

perl 5.10.1のコンパイルオプション


$ ./Configure -des -Dcc=/usr/bin/cc -Dusethreads -Dprefix=/usr/local -Duse64bitint \
-Dusedtrace

perl初期設定


$ pfexec /usr/local/bin/cpan YAML
$ pfexec /usr/local/bin/cpan App::cpanminus
以降は、cpanm にて。

○perlbrew URL (これがあれば!) 先は githubです。


$ wget http://xrl.us/perlbrew
$ chmod 744 perlbrew
$ ./perlbrew install
$ ./perlbrew init
$ vi ~/.bashrc
#
# perlbrew init の結果を追加
#
$ source ~/.bashrc
$ rm perlbrew
$ perlbrew install perl-5.12.2 -D=usethreads -D=use64bitint

dtraceとかいろいろ指定する場合


$ perlbrew install perl-5.12.2 -D=usethreads -D=use64bitint -D=usedtrace \
-Duseshrplib -D=cc=/usr/gcc/4.3/bin/gcc --as perl-5.12.2-dtrace
例のごとく失敗するので、~/perl5/perlbrew/build/perl-5.12.2 以下で Makefile.SHの書き換えと、rm *.o を実行してから make;make test;make install が必要です。

○cpanminusも


perlbrew install-cpanm

○アップデート


$ cpanm App::cpanoutdated
$ cpan-outdated | cpanm
○Berkeley DB

$ cd build_unix/
$ CC=/usr/bin/cc ../dist/configure --prefix=/usr/local/BerkeleyDB.4.8

 構築メモ(構成)

Core2 Quad のサーバを追加。

H/W選択は、自作サーバカンファレンスのストリーミングを見ながら以下に決定。
 ○M/B:Intel DG41MJ
 ○CPU:Intel Core2 Quad Q9400s 2.66GHz TDP 65W
 ○MEM:ADATA DDR2 PC2-6400 2GBx2

自作サーバカンファレンスがおもしろかったです。
IntelのM/Bって、いわゆるリファレンス的なM/Bだと思っていたので今まで買ったことがないんですが、省電力という意味では優秀らしいです。



○zone構成

グローバルzone:各zone用の管理用。アプリ:bind

非グローバルzone

zone名 mount先 アプリ
mail /zone/mail Postfix
web /zone/web ApacheCacti
dev /zone/dev
db   /zone/db MySQL

必要になったら、OpenSolarisの juicer 用を用意。

以下、zoneのディスク使用量。
mail zoneには、"pkg install lang-support-japanese" したので複数pkgが追加されています。webは何も入れてない素のzone。
データ情報がなければ、素のzone のサイズはかなり小さい。初期パッケージが本当に最低限なので、、、ある意味セキュアでもある。


$ zfs list
NAME USED AVAIL REFER MOUNTPOINT
rpool/zone/mail 351M 19.7G 22K /zone/mail
rpool/zone/mail/ROOT 351M 19.7G 19K legacy
rpool/zone/mail/ROOT/zbe 351M 19.7G 351M legacy
rpool/zone/web 242M 7.76G 22K /zone/remote
rpool/zone/web/ROOT 242M 7.76G 19K legacy
rpool/zone/web/ROOT/zbe 242M 7.76G 242M legacy
$



○/usr/localについて

OpenSolarisとして、/usr/local はありません。なので、ここには自前でmakeしたものを入れて使います。

で、/usr/local は同じFSをマウントする。書き込みはグローバルゾーンのみとし、他ゾーンはlofs(+ReadOnly) でマウントする。

*グローバルゾーン


# zfs create -o mountpoint=/usr/local rpool/local

*非グローバルゾーン


zonecfg:dev> add fs
zonecfg:dev:fs> set dir=/usr/local
zonecfg:dev:fs> set special=/usr/local
zonecfg:dev:fs> set type=lofs
zonecfg:dev:fs> set options=[ro,nodevices]
zonecfg:dev:fs> end

TokyoCabinet と TokyoTyrant を使う(インストール編)

shibuya.pm #12 に行ってきました。
よし、TokyoCabinet いってみよう〜。

インストール先は、$HOME/local以下を想定します。(perl-API は 普通に入れます)

TokyoCabinet


$ wget http://1978th.net/tokyocabinet/tokyocabinet-1.4.39.tar.gz
$ gzip -cd tokyocabinet-1.4.39.tar.gz | tar xf -
$ cd tokyocabinet-1.4.39
$ ./configure --prefix=$HOME/local
...
$ make
...
$ make install
...

この時点で、PATH に $HOME/local/bin、LD_LIBRARY_PATH に $HOME/local/lib を追加しておきましょう。
そうしないと、これ以後出てくる perl-API とか TokyoTyrant のMake等でコケる所があります。

TokyoCabinet perl-API
これは /usr/local/bin/perl の配下に入れてしまいます。


$ export PATH=$PATH:$HOME/local/bin # 私の場合
$ export LD_LIBRARY_PATH=$HOME/local/lib # 私の場合
$
$ wget http://1978th.net/tokyocabinet/perlpkg/tokyocabinet-perl-1.33.tar.gz
$ gzip -cd tokyocabinet-perl-1.33.tar.gz | tar xf -
$ cd tokyocabinet-perl-1.33
$ /usr/local/bin/perl Makefile.PL LIBS="-L$HOME/local/lib -L. -ltokyocabinet -lz -lbz2 -lpthread -lm -lc"
$ make
...
$ make test
...
$ pfexec make install
...

私の場合、make test で何度かコケテ、最終的に上記のLIBS=...になっています。Makefile.PL を直接書き換えたほうがスマートかも。

コケた時


$ make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
Can't load './blib/arch/auto/TokyoCabinet/TokyoCabinet.so' for module
TokyoCabinet: ld.so.1: perl: fatal: relocation error: file ./blib/arch/auto
/TokyoCabinet/TokyoCabinet.so: symbol tccmpdecimal: referenced symbol not found
at /usr/local/lib/perl5/5.10.1/i86pc-solaris-thread-multi-64int/DynaLoader.pm
line 200.
at test.pl line 7
Compilation failed in require at test.pl line 7.
BEGIN failed--compilation aborted at test.pl line 7.
# Looks like your test exited with 2 before it could output anything.
make: *** [test_dynamic] Error 2


$ ldd blib/arch/auto/TokyoCabinet/TokyoCabinet.so
libc.so.1 => /lib/libc.so.1
libm.so.2 => /lib/libm.so.2
$

ちゃんとパスが通ってmakeされた場合


$ ldd blib/arch/auto/TokyoCabinet/TokyoCabinet.so
libtokyocabinet.so.9 => [$HOME]/local/lib/libtokyocabinet.so.9
libz.so.1 => /usr/lib/libz.so.1
libbz2.so.1 => /usr/lib/libbz2.so.1
libpthread.so.1 => /usr/lib/libpthread.so.1
libm.so.2 => /usr/lib/libm.so.2
libc.so.1 => /usr/lib/libc.so.1
librt.so.1 => /lib/librt.so.1
libgcc_s.so.1 => /usr/sfw/lib/libgcc_s.so.1
$


TokyoTyrant


$ wget http://1978th.net/tokyotyrant/tokyotyrant-1.1.37.tar.gz
$ gzip -cd tokyotyrant-1.1.37.tar.gz | tar xf -
$ cd tokyotyrant-1.1.37
$ ./configure --prefix=$HOME/local CPPFLAGS=-I$HOME/local/include
$ make
$ make install
configure コケルたなら LDFLAGS=-L$HOME/local/lib を追加?

TokyoTyrant perl-API


$ wget http://1978th.net/tokyotyrant/perlpkg/tokyotyrant-perl-1.16.tar.gz
$ gzip -cd tokyotyrant-perl-1.16.tar.gz | tar xf -
$ cd tokyotyrant-perl-1.16
$ /usr/local/bin/perl Makefile.PL
$ make
...
$ pfexec make install
Installing /usr/local/lib/perl5/site_perl/5.10.1/TokyoTyrant.pm
Installing /usr/local/lib/perl5/site_perl/5.10.1/ttutest.pl
Installing /usr/local/lib/perl5/site_perl/5.10.1/tcrtest.pl
Installing /usr/local/lib/perl5/site_perl/5.10.1/TokyoTyrant.pod
Installing /usr/local/share/man/man3/TokyoTyrant.3
Appending installation info to /usr/local/lib/perl5/5.10.1/i86pc-solaris-thread-multi-64int/perllocal.pod
$

京都、行こう。〜PROJECT Kyoto のパッチをあてる〜

OpenSolarisバグフィックスですが、基本的にないようなものです。
Debianでいうところの、security.debian.org の apt-lineがほしいところです。

で、そのあたりを考慮したもので、PROJECT Kyoto(http://chototsumoushinp.dip.jp/projectkyoto/home.html) というのがあります。

で、今回のCIFSサーバのフリーズバグに対応したパッチを頂いてみました。


# beadm create 111b_kyoto
# beadm mount 111b_kyoto /a
# pkg -R /a set-publisher -O http://chototsumoushinp.dip.jp/pkg/release projectkyoto
# pkg -R /a install SUNWckr@0.5.11,5.11-0.111.4 SUNWcs@0.5.11,5.11-0.111.4 SUNWsmbs@0.5.11,5.11-0.111.4 SUNWsmbskr@0.5.11,5.11-0.111.4
# bootadm update-archive -R /a
# beadm unmount 111b_kyoto
# beadm activate 111b_kyoto
# reboot

CIFSサーバのフリーズは、今のところ3回ほど私のサーバでは起きている(かなり稀)のですが、これで発生しなくなるのかな。。。

 シングルユーザモードで立ち上げる方法

OBPは便利だったなぁと思いながら)ちょっと、リブートに失敗することがありました。でmulti-userモードだと、画面にエラーが出力されず、かつログファイルに書き出されないので、原因解明のためシングルユーザモードで起動させてみました。

google先生に聞くと、いくつか答えは返ってくるのですが、昔の情報すぎて no-GUIで立ち上げているはずが、普通にgdmが立ち上がってしまいました。

○方法:grub のパラメータ変更する
1. kernel行に "-s" をつける。
2. splashimage行を削除する。
3. foreground行を削除する。
4. background行を削除する。

変更前


title opensolaris
findroot (pool_rpool,0,a)
splashimage /boot/solaris.xpm
foreground d25f00
background 115d93
bootfs rpool/ROOT/opensolaris
kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS,console=graphics
module$ /platform/i86pc/$ISADIR/boot_archive

変更後


title opensolaris
findroot (pool_rpool,0,a)
bootfs rpool/ROOT/opensolaris
kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS -s
module$ /platform/i86pc/$ISADIR/boot_archive

当然ながら上記の変更は、起動時のgrubメニューから変更します。
(画面のメッセージ通りにやればできると思います)

これで、シングルユーザ(メンテナンス?)モードで立ち上がります。

"-s"の変わりに"-a"をつければInteractiveなbootをしてくれるようです。Solarisのbootオプションと同じにしてくれているのかなと思います。


○シングルユーザモードとはどういう状態か
milestoneが single-user に設定された状態のこと


$ svcadm milestone
Usage: svcadm milestone [-d]

-d make the specified milestone the default for system boot

Milestones can be specified using an FMRI or abbreviation.
The major milestones are as follows:

all
none
svc:/milestone/single-user:default
svc:/milestone/multi-user:default
svc:/milestone/multi-user-server:default

シングルユーザモードで立ち上げる場合は、grubのbootオプションで変更すればOK.
起動した後なら、以下でコマンドでできます。


svcadm milestone -d svc:/milestone/single-user:default

○戻す


svcadm milestone -d all

○マルチユーザモードにする(allとの違いはわからん)


svcadm milestone -d svc:/milestone/multi-user-server:default