Home NAS basing on OpenSolaris/ZFS

shuttle_SG33G5和很多第一批的Time Capsule用户一样,18月过后,我的TC-1TB死了,估计是电容击穿了。拿到苹果维修中心,人家说只能采用调换维修的方式,因为过保,要收费4,800元,而买一台全新的才2,300多。回到家,把TC拆了,将硬盘取出来,放到刚买的一个USB外置硬盘盒里,硬盘盒居然点不亮,心里一下就毛了,直想骂娘。要知道,我给儿子拍的照片和视频,还有积攒的很多电子书和资料,可都在里面呢。极其后悔,当初没把重要的数据刻盘备份。

第二天早起去鼎好,发现是店家给我的电源线有问题。插在Windows上,发现分区格式不支持。又一阵紧张,万一USB硬盘盒不能支持EFI分区,难不成我得找一台Mac Pro?在鼎好找了家苹果专卖店,将USB硬盘盒接到MBP上,结果能认出来,总算放心了。Time-Capsule是不敢买了,和老婆商量了一下,不如搞个准系统,用opensolaris/zfs自己攒一台Home NAS。在网上搜到了一家“北京准系统大本营”的店家,上周末和朋友约好一起去转转。

我起先买的是AOpen S180机箱(最多可放3块3.5寸的硬盘),加翔升的Atom 330套板(支持4个SATA-II接口)。回到家发现,CPU的风扇和机箱的风扇噪音比较大。问了下朋友,他买的浩鑫的SG33G5整机噪音比较小。不过价钱也贵出一大节,机箱/电源+主板就要1,950。和老婆合计了一下,咬了咬牙,换!第二天去E世界,换了SG33G5,上的是E1500双核赛扬处理器(330元)。

回到家,发现板载的Marvell网卡,solaris缺省不支持,需要第三方驱动。安装好了之后,以为总算是大功告成了。不过发现,Leopard上的Finder访问NFS巨慢无比。绝望地以为,是网卡驱动支持得不好。后来发现,从solaris上scp,速度还是很快的,google了一下,发现是Mac OS的固疾,再次鄙视Apple一下!最后花了一晚上,把TC硬盘上的东西,scp到solaris上。下一步,是要给rpool做mirror,被吓怕了。貌似有些麻烦,放假时再整了 ...

最近去村里买东西,都很不顺利,总要跑两遍,郁闷 ...

Setup Laconica on SAMP stack

Basically the similar steps as described in Quick Start Guide on Ubuntu 8.04.

  1. Install amp-dev (or webstack packages) on OpenSolaris (or Solaris production release), and install SunStudio and GNU autotools (JDS CBE toolset is recommended).
  2. Download the latest laconica archive file, and extract to apache2/2.2/htdocs, and edit the httpd.conf to enable "AllowOverride All" for htdocs directory.
  3. Edit config.php, setup mysql databases, configure fancy URL, as described in above document.
  4. Download sphinx-0.9.8.1 and apply this patch for sunstudio C++ compiler, build and install it as following,
  5. $ export PATH=$PATH:/path/to/mysql/bin
    $ ./configure; make; pfexec make install
    $ cd api/libsphinxclient; ./configure LDFLAGS="-lsocket -lnsl"; \
    > make; pfexec make install

  6. Use pecl(1) to install sphinx php extension, while you need export CC to SunStudio, otherwise, it would uses gcc even it's not in your $PATH. (Thanks to Sriram Natarajan for this tip, I used to download and build it manually.)
  7. $ export CC=/opt/SUNWspro/bin/cc
    $ pecl install sphinx

  8. Enable DNS and set it prior to NIS, otherwise email validation would fail.

OpenSolaris环保购物袋

这是公司为了庆祝OpenSolaris 2008.11发布,同时也作为新年礼物,发给我们员工的一个购物袋。帆布面料,做工扎实,贴心的小功能不少,真是让人爱不释手。要是公司多制作一些,允许员工另购,我肯定会多买几个,送给亲朋好友,呵呵。

what's the 'chash' in ips manifest?

chash: the sha1 hash of the compressed file.

While if you manually compress the file with gzip -n -9, you would find the sha1 value is still different with the one in the manifest file. By looking into ips/pkg's source code, it turns out that the head used in ips/pkg is a little different with the one gzip(1) generated,

-0000000 1f 8b 08 00 00 00 00 00 02 ff
+0000000 1f 8b 08 00 00 00 00 00 02 03

The last byte is to indicate the OS type, '03' stands for 'Unix', 'ff' means 'Unknown', refer to RFC1952. After you change the OS type to 'ff' in your manually compressed file, you would see the sha hash values are just the same.

调整 OpenSolaris nVIDIA 显卡外接投影仪的分辨率

我所使用的是Dell的一款笔记本,配备了nVIDIA的显卡。当外接投影仪的时候,用nvidia-settings(1)自动检测(Detect Displays),可以发现有另一个model(因为是VGA输出,所以通常是CRT-0),但是这个screen的分辨率不能调整、且仅为640x480。这对进行演讲来说非常不方便。可以用如下方法来解决:

  • 先点击“Save to X Configuration File”将这个设置保存到X的配置文件中,即/etc/X11/xorg.conf,
  • 然后编辑该配置文件,定位到ModelName为“CRT-0”的那个Monitor Section,调整水平和垂直刷新,例如:

        HorizSync 31.5 - 64.3
        VertRefresh 40.0 - 150.0

  • 然后退出并重启X,再运行nvidia-settings,就可以看到CRT-0有更多的分辨率可以选择了,不过好像只有4:3的分辨率可选。

详细信息可以参考nVIDIA驱动的README

How to switch to scim on Solaris/OpenSolaris snv_99

At first, install scim and your favorite input-method engines from pkg.opensolaris.org, you could list the available scim packages, by $ pkg list -a SUNWscim*. For nevada users, you need select the scim metacluster in installer.

Then, edit your $HOME/.profile to export the GTK_IM_MODULE to scim, and re-login


$ cat >> ~/.profile << EOF
> GTK_IM_MODULE=scim
> export GTK_IM_MODULE
> EOF

To switch back to iiim, you could simply comment out the above lines in your $HOME/.profile, and re-login.

glibc on OpenSolaris

Just saw the message on [osol-discuss], that David is working on porting gnu-libc porting to Solaris/OpenSolaris, and made really impressive progress. Likes the efforts for porting glibc to BSD, it makes the GNU/kOpenSolairs (which means OpenSolaris Kernel + GNU userland) to be reality.

Here are the references:

  1. http://csclub.uwaterloo.ca/~dtbartle/opensolaris
  2. https://savannah.nongnu.org/projects/glibc-bsd

scim packages are available on pkg.opensolaris.org

Just enjoy it :)

pkg:/SUNWscim-anthy@1.2.4,5.11-0.96:20080825T192330Z Info Manifest
pkg:/SUNWscim-chewing@0.3.1,5.11-0.96:20080825T192330Z Info Manifest
pkg:/SUNWscim-hangul@0.3.2,5.11-0.96:20080825T192331Z Info Manifest
pkg:/SUNWscim-pinyin@0.5.91,5.11-0.96:20080825T192331Z Info Manifest
pkg:/SUNWscim-sunpinyin@1.0,5.11-0.96:20080825T192335Z Info Manifest
pkg:/SUNWscim-tables-chinese@0.5.7,5.11-0.96:20080825T192355Z Info Manifest
pkg:/SUNWscim-tables-extra@0.5.7,5.11-0.96:20080825T192401Z Info Manifest
pkg:/SUNWscim-tables-india@0.5.7,5.11-0.96:20080825T192401Z Info Manifest
pkg:/SUNWscim-tables-japanese@0.5.7,5.11-0.96:20080825T192401Z Info Manifest
pkg:/SUNWscim-tables-korean@0.5.7,5.11-0.96:20080825T192402Z Info Manifest
pkg:/SUNWscim-tables@0.5.7,5.11-0.96:20080825T192354Z Info Manifest
pkg:/SUNWscim-thai@0.1.0,5.11-0.96:20080825T192402Z Info Manifest
pkg:/SUNWscim@1.4.7,5.11-0.96:20080825T192322Z Info Manifest

Our next plan is to integrate libm17n and scim-m17n. Stay tuned.

Build stardict-3.0.1 on OpenSolaris 2008.05

Before you start the build, make sure you have setup your build environment, you may refer to my blog "Setup Indiana as Developer Desktop for Gnu/Gnome".

Download the source tar file from stardict.sf.net, and apply the patch,


$ patch -p1 < stardict-3.0.1-on-ss12-patch.diff
$ ./autogen.sh --prefix=/usr --disable-festival --disable-espeak; make
# make install

The major problem of this porting, is related to my last entry, "Function Pointer as Template Parameter in SunStudio C++".